From: Casey Chen <cachen@purestorage.com>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: yzhong@purestorage.com, Casey Chen <cachen@purestorage.com>
Subject: [PATCH] debug patch for perf report segfault
Date: Thu, 27 Jun 2024 15:36:19 -0600 [thread overview]
Message-ID: <20240627213619.718-3-cachen@purestorage.com> (raw)
In-Reply-To: <20240627213619.718-1-cachen@purestorage.com>
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
next prev parent reply other threads:[~2024-06-27 21:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 21:36 [PATCH 0/1] perf report: fix missing references to maps and map in thread__find_map Casey Chen
2024-06-27 21:36 ` [PATCH] perf probe: " Casey Chen
2024-07-02 22:50 ` Namhyung Kim
2024-06-27 21:36 ` Casey Chen [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-07-08 23:23 [PATCH 0/1] perf tool: fix handling NULL al->maps returned from thread__find_map Casey Chen
2024-07-08 23:23 ` [PATCH] debug patch for perf report segfault Casey Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240627213619.718-3-cachen@purestorage.com \
--to=cachen@purestorage.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=yzhong@purestorage.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).