@@ -401,7 +401,7 @@ void Process_makeCommandStr(Process* this) {
401401 return ;
402402 if (this -> state == 'Z' && !this -> mergedCommand .str )
403403 return ;
404- if (Process_isUserlandThread (this ) && settings -> showThreadNames )
404+ if (Process_isUserlandThread (this ) && settings -> showThreadNames && ( showThreadNames == mc -> prevShowThreadNames ) )
405405 return ;
406406
407407 /* this->mergedCommand.str needs updating only if its state or contents changed.
@@ -500,7 +500,7 @@ void Process_makeCommandStr(Process* this) {
500500 assert (cmdlineBasenameStart <= (int )strlen (cmdline ));
501501
502502 if (!showMergedCommand || !procExe || !procComm ) { /* fall back to cmdline */
503- if (showMergedCommand && showThreadNames && !procExe && procComm && strlen (procComm )) { /* Prefix column with comm */
503+ if (showMergedCommand && (! Process_isUserlandThread ( this ) || showThreadNames ) && !procExe && procComm && strlen (procComm )) { /* Prefix column with comm */
504504 if (strncmp (cmdline + cmdlineBasenameStart , procComm , MINIMUM (TASK_COMM_LEN - 1 , strlen (procComm ))) != 0 ) {
505505 WRITE_HIGHLIGHT (0 , strlen (procComm ), commAttr , CMDLINE_HIGHLIGHT_FLAG_COMM );
506506 str = stpcpy (str , procComm );
@@ -524,7 +524,7 @@ void Process_makeCommandStr(Process* this) {
524524 assert (exeBasenameOffset <= (int )strlen (procExe ));
525525
526526 bool haveCommInExe = false;
527- if (procExe && procComm && showThreadNames ) {
527+ if (procExe && procComm && (! Process_isUserlandThread ( this ) || showThreadNames ) ) {
528528 haveCommInExe = strncmp (procExe + exeBasenameOffset , procComm , TASK_COMM_LEN - 1 ) == 0 ;
529529 }
530530
@@ -556,14 +556,14 @@ void Process_makeCommandStr(Process* this) {
556556 /* Try to match procComm with procExe's basename: This is reliable (predictable) */
557557 if (searchCommInCmdline ) {
558558 /* commStart/commEnd will be adjusted later along with cmdline */
559- haveCommInCmdline = showThreadNames && findCommInCmdline (procComm , cmdline , cmdlineBasenameStart , & commStart , & commEnd );
559+ haveCommInCmdline = (! Process_isUserlandThread ( this ) || showThreadNames ) && findCommInCmdline (procComm , cmdline , cmdlineBasenameStart , & commStart , & commEnd );
560560 }
561561
562562 int matchLen = matchCmdlinePrefixWithExeSuffix (cmdline , cmdlineBasenameStart , procExe , exeBasenameOffset , exeBasenameLen );
563563
564564 bool haveCommField = false;
565565
566- if (!haveCommInExe && !haveCommInCmdline && procComm && showThreadNames ) {
566+ if (!haveCommInExe && !haveCommInCmdline && procComm && (! Process_isUserlandThread ( this ) || showThreadNames ) ) {
567567 WRITE_SEPARATOR ;
568568 WRITE_HIGHLIGHT (0 , strlen (procComm ), commAttr , CMDLINE_HIGHLIGHT_FLAG_COMM );
569569 str = stpcpy (str , procComm );
@@ -583,7 +583,7 @@ void Process_makeCommandStr(Process* this) {
583583 WRITE_SEPARATOR ;
584584 }
585585
586- if (!haveCommInExe && haveCommInCmdline && !haveCommField && showThreadNames )
586+ if (!haveCommInExe && haveCommInCmdline && !haveCommField && (! Process_isUserlandThread ( this ) || showThreadNames ) )
587587 WRITE_HIGHLIGHT (commStart , commEnd - commStart , commAttr , CMDLINE_HIGHLIGHT_FLAG_COMM );
588588
589589 /* Display cmdline if it hasn't been consumed by procExe */
0 commit comments