[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240627213619.718-3-cachen@purestorage.com>
Date: Thu, 27 Jun 2024 15:36:19 -0600
From: Casey Chen <cachen@...estorage.com>
To: linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: yzhong@...estorage.com,
Casey Chen <cachen@...estorage.com>
Subject: [PATCH] debug patch for perf report segfault
Debug patch to apply on 0dd5041c9a0e ("perf addr_location: Add
init/exit/copy functions")
---
tools/perf/util/callchain.c | 4 ++++
tools/perf/util/callchain.h | 9 +++++++++
tools/perf/util/machine.c | 8 ++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index b0dafc758173..2c1d9b8ff8d9 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -1067,6 +1067,10 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
node->ip = ip;
map__zput(node->ms.map);
node->ms = *ms;
+ if (ms && !ms->maps) {
+ pr_info("%s addr of node->ms %p ms %p has no maps map %p symbol %p\n",
+ __func__, &node->ms, ms, ms->map, ms->sym);
+ }
node->ms.map = map__get(node->ms.map);
node->branch = branch;
node->nr_loop_iter = nr_loop_iter;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index d95615daed73..8bba51be33a9 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -6,6 +6,7 @@
#include <linux/rbtree.h>
#include "map_symbol.h"
#include "branch.h"
+#include "debug.h"
struct addr_location;
struct evsel;
@@ -213,6 +214,14 @@ static inline void callchain_cursor_commit(struct callchain_cursor *cursor)
{
cursor->curr = cursor->first;
cursor->pos = 0;
+ if (cursor->curr) {
+ struct callchain_cursor_node *curr = cursor->curr;
+ struct map_symbol *ms = &curr->ms;
+ if (ms && !ms->maps) {
+ pr_info("%s: cursor %p curr %p ms %p\n", __func__, cursor, curr, ms);
+ dump_stack();
+ }
+ }
}
/* Cursor reading iteration helpers */
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 9fcf357a4d53..e6c90bb6b842 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2357,6 +2357,10 @@ static int add_callchain_ip(struct thread *thread,
goto out;
}
thread__find_symbol(thread, *cpumode, ip, &al);
+ if (!al.maps) {
+ pr_info("%s: i'm here! al.map %p al.sym %p ip >= PERF_CONTEXT_MAX: %d cpumode %d ip 0x%lx\n",
+ __func__, al.map, al.sym, ip >= PERF_CONTEXT_MAX, *cpumode, ip);
+ }
}
if (al.sym != NULL) {
@@ -2384,8 +2388,8 @@ static int add_callchain_ip(struct thread *thread,
ms.map = map__get(al.map);
ms.sym = al.sym;
- if (!branch && append_inlines(cursor, &ms, ip) == 0)
- goto out;
+// if (!branch && append_inlines(cursor, &ms, ip) == 0)
+// goto out;
srcline = callchain_srcline(&ms, al.addr);
err = callchain_cursor_append(cursor, ip, &ms,
--
2.34.1
Powered by blists - more mailing lists