From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH] perf dwarf-aux: Check .eh_frame section for CFA
Date: Fri, 2 Oct 2026 15:42:41 -0700 [thread overview]
Message-ID: <20261002224242.396135-1-namhyung@kernel.org> (raw)
The die_get_cfa() only calls dwarf_getcfi() which handles .debug_frame
section. But most binaries have .eh_frame instead so it would fail.
Let's call dwarf_getcfi_elf() first to try .eh_frame section and then
fallback to .debug_frame.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/dwarf-aux.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 54f8b5ec74a2fe70..af3913e661fce79e 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -1886,9 +1886,14 @@ int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset)
Dwarf_Op *ops = NULL;
size_t nops;
- cfi = dwarf_getcfi(dwarf);
- if (cfi == NULL)
- return -1;
+ /* try to get .eh_frame section */
+ cfi = dwarf_getcfi_elf(dwarf_getelf(dwarf));
+ if (cfi == NULL) {
+ /* and then try .debug_frame section */
+ cfi = dwarf_getcfi(dwarf);
+ if (cfi == NULL)
+ return -1;
+ }
if (!dwarf_cfi_addrframe(cfi, pc, &frame) &&
!dwarf_frame_cfa(frame, &ops, &nops) &&
--
2.56.0.rc1.315.gc6ed9934b7-goog
reply other threads:[~2026-10-02 22:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261002224242.396135-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®