Allow for highlighting of deleted executables to be configured

Fixes #383
This commit is contained in:
Benny Baumann 2020-12-19 16:46:00 +01:00 committed by BenBE
parent d9feff150c
commit bf07c713ba
4 changed files with 8 additions and 2 deletions

View File

@ -107,6 +107,7 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
Panel_add(super, (Object*) CheckItem_newByRef("Show custom thread names", &(settings->showThreadNames)));
Panel_add(super, (Object*) CheckItem_newByRef("Show program path", &(settings->showProgramPath)));
Panel_add(super, (Object*) CheckItem_newByRef("Highlight program \"basename\"", &(settings->highlightBaseName)));
Panel_add(super, (Object*) CheckItem_newByRef("Highlight out-dated/removed programs", &(settings->highlightDeletedExe)));
Panel_add(super, (Object*) CheckItem_newByRef("Merge exe, comm and cmdline in Command", &(settings->showMergedCommand)));
Panel_add(super, (Object*) CheckItem_newByRef("- Try to find comm in cmdline (when Command is merged)", &(settings->findCommInCmdline)));
Panel_add(super, (Object*) CheckItem_newByRef("- Try to strip exe from cmdline (when Command is merged)", &(settings->stripExeFromCmdline)));

View File

@ -594,7 +594,7 @@ void Process_writeCommand(const Process* this, int attr, int baseAttr, RichStrin
const bool highlightBaseName = this->settings->highlightBaseName;
const bool highlightSeparator = true;
const bool highlightDeleted = true;
const bool highlightDeleted = this->settings->highlightDeletedExe;
if (!this->mergedCommand.str) {
int len = 0;
@ -766,7 +766,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
const char* procExe;
if (this->procExe) {
attr = CRT_colors[Process_isUserlandThread(this) ? PROCESS_THREAD_BASENAME : PROCESS_BASENAME];
if (this->procExeDeleted)
if (this->procExeDeleted && this->settings->highlightDeletedExe)
attr = CRT_colors[FAILED_READ];
procExe = this->procExe + this->procExeBasenameOffset;
} else {

View File

@ -175,6 +175,8 @@ static bool Settings_read(Settings* this, const char* fileName, unsigned int ini
this->showProgramPath = atoi(option[1]);
} else if (String_eq(option[0], "highlight_base_name")) {
this->highlightBaseName = atoi(option[1]);
} else if (String_eq(option[0], "highlight_deleted_exe")) {
this->highlightDeletedExe = atoi(option[1]);
} else if (String_eq(option[0], "highlight_megabytes")) {
this->highlightMegabytes = atoi(option[1]);
} else if (String_eq(option[0], "highlight_threads")) {
@ -307,6 +309,7 @@ int Settings_write(const Settings* this, bool onCrash) {
fprintf(fd, "show_thread_names=%d\n", (int) this->showThreadNames);
fprintf(fd, "show_program_path=%d\n", (int) this->showProgramPath);
fprintf(fd, "highlight_base_name=%d\n", (int) this->highlightBaseName);
fprintf(fd, "highlight_deleted_exe=%d\n", (int) this->highlightDeletedExe);
fprintf(fd, "highlight_megabytes=%d\n", (int) this->highlightMegabytes);
fprintf(fd, "highlight_threads=%d\n", (int) this->highlightThreads);
fprintf(fd, "highlight_changes=%d\n", (int) this->highlightChanges);
@ -368,6 +371,7 @@ Settings* Settings_new(unsigned int initialCpuCount) {
this->treeView = false;
this->allBranchesCollapsed = false;
this->highlightBaseName = false;
this->highlightDeletedExe = true;
this->highlightMegabytes = false;
this->detailedCPUTime = false;
this->countCPUsFromOne = false;

View File

@ -54,6 +54,7 @@ typedef struct Settings_ {
bool hideKernelThreads;
bool hideUserlandThreads;
bool highlightBaseName;
bool highlightDeletedExe;
bool highlightMegabytes;
bool highlightThreads;
bool highlightChanges;