[sysprof] libsysprof: include process ID when cmdline is not available
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof: include process ID when cmdline is not available
- Date: Wed, 26 Feb 2020 16:48:28 +0000 (UTC)
commit 26bf532a8cdc6bcda4db14f4c5b4229a76bac409
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 26 08:48:05 2020 -0800
libsysprof: include process ID when cmdline is not available
We shouldn't really hit this, but if we do, it's easy enough to synthesize
a real parent node for the process in question.
src/libsysprof/sysprof-callgraph-profile.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/libsysprof/sysprof-callgraph-profile.c b/src/libsysprof/sysprof-callgraph-profile.c
index ce70d24..3b2c832 100644
--- a/src/libsysprof/sysprof-callgraph-profile.c
+++ b/src/libsysprof/sysprof-callgraph-profile.c
@@ -339,6 +339,13 @@ sysprof_callgraph_profile_generate_worker (GTask *task,
cmdline = g_hash_table_lookup (cmdlines, GINT_TO_POINTER (sample->frame.pid));
+ if (cmdline == NULL)
+ {
+ gchar *pidstr = g_strdup_printf ("[Process %d]", sample->frame.pid);
+ g_hash_table_insert (cmdlines, GINT_TO_POINTER (sample->frame.pid), pidstr);
+ cmdline = pidstr;
+ }
+
#if 0
/* This assertion appears to hold true, but since we're taking in
* untrusted data from capture files, it's not safe to assume. But in
@@ -413,9 +420,7 @@ sysprof_callgraph_profile_generate_worker (GTask *task,
g_array_index (resolved, SysprofAddress, len++) = POINTER_TO_U64 (name);
}
- if (cmdline != NULL)
- g_array_index (resolved, guint64, len++) = POINTER_TO_U64 (cmdline);
-
+ g_array_index (resolved, guint64, len++) = POINTER_TO_U64 (cmdline);
g_array_index (resolved, guint64, len++) = POINTER_TO_U64 ("[Everything]");
stack_stash_add_trace (resolved_stash, (gpointer)resolved->data, len, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]