libsysprof: avoid duplicate process records

We want the first process record, but subsequent records should
be ignored, except that we want to take the appropriate comm[]
action from them.
This commit is contained in:
Christian Hergert
2023-09-01 14:09:17 -07:00
parent 30123284b6
commit 5f94e09f9c
3 changed files with 34 additions and 2 deletions

View File

@ -25,6 +25,7 @@
#include "sysprof-document-frame-private.h"
#include "sysprof-document-process-private.h"
#include "sysprof-mount.h"
#include "sysprof-symbol-private.h"
#include "sysprof-thread-info.h"
struct _SysprofDocumentProcess
@ -159,7 +160,7 @@ sysprof_document_process_init (SysprofDocumentProcess *self)
}
const char *
sysprof_document_process_get_command_line (SysprofDocumentProcess *self)
_sysprof_document_process_get_comm (SysprofDocumentProcess *self)
{
const SysprofCaptureProcess *proc;
@ -170,6 +171,21 @@ sysprof_document_process_get_command_line (SysprofDocumentProcess *self)
return SYSPROF_DOCUMENT_FRAME_CSTRING (self, proc->cmdline);
}
const char *
sysprof_document_process_get_command_line (SysprofDocumentProcess *self)
{
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_PROCESS (self), 0);
/* Prefer ProcessInfo symbol name which gets updated from
* subsequent comm[] updates for process records.
*/
if (self->process_info != NULL &&
self->process_info->symbol != NULL)
return self->process_info->symbol->name;
return _sysprof_document_process_get_comm (self);
}
/**
* sysprof_document_process_list_memory_maps:
* @self: a #SysprofDocumentProcess