[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250213190542.3249050-1-stephen.s.brennan@oracle.com>
Date: Thu, 13 Feb 2025 11:05:37 -0800
From: Stephen Brennan <stephen.s.brennan@...cle.com>
To: Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Cc: Stephen Brennan <stephen.s.brennan@...cle.com>,
linux-perf-users@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
James Clark <james.clark@...aro.org>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org,
Chaitanya S Prakash <chaitanyas.prakash@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Mark Rutland <mark.rutland@....com>,
Ian Rogers <irogers@...gle.com>
Subject: [PATCH 0/1] Support .gnu_debugdata for symbols in perf
Hello all,
A while back, Fedora implemented a "MiniDebugInfo" feature[1]. This allows the
full symbol table of a binary to be compressed into a fake ELF file and embedded
within the ".gnu_debugdata" section. The standard RPMs thus include the full
symbol information, at least enough to provide symbol names for stack traces. As
part of the project, support for .gnu_debugdata was implemented in GDB. However,
perf does not yet have support for it.
For Fedora, RHEL, and all the derivatives, there is already the ".eh_frame"
section in ELF files, which allows perf to unwind stacks with "--call-graph
dwarf", and in some cases, there may be frame pointers to make it even easier
and more efficient to gather stack traces.
But once the data is recorded, perf may still be missing the symbol names for
many functions, because it doesn't have support for .gnu_debugdata.
This patch is a first stab at implementing that support. To demonstrate, here is
a diff between a sample output by "perf script" before and after the change:
@@ -16,9 +16,9 @@
55fdc45c837f rl_read_key+0x17f (/usr/bin/bash)
55fdc45a744b readline_internal_char+0x6b (/usr/bin/bash)
55fdc45a776c readline+0x4c (/usr/bin/bash)
- 55fdc4509dbe [unknown] (/usr/bin/bash)
- 55fdc450ce28 [unknown] (/usr/bin/bash)
- 55fdc450ebb9 [unknown] (/usr/bin/bash)
+ 55fdc4509dbe yy_readline_get+0xae (/usr/bin/bash)
+ 55fdc450ce28 shell_getc.lto_priv.0+0x278 (/usr/bin/bash)
+ 55fdc450ebb9 read_token.part.0+0x49 (/usr/bin/bash)
55fdc4512739 yyparse+0x3f9 (/usr/bin/bash)
55fdc4515bbc parse_command+0x3c (/usr/bin/bash)
55fdc4515d8c read_command+0x6c (/usr/bin/bash)
I believe this support will be even more important in the future, if and when
SFrame becomes supported: then we will have an efficient unwinder that doesn't
require debuginfo to be installed. But users won't be able to take full
advantage of their perf recordings without having the best symbol information
available.
My approach almost certainly can be improved: I'm not sure whether there is a
strong preference to decompress the ".gnu_debugdata" into a temporary file, or
if keeping it in-memory is good enough. I'd love feedback, since I know this
approach is a bit rough around the edges.
Thanks,
Stephen
[1]: https://fedoraproject.org/wiki/Features/MiniDebugInfo
Stephen Brennan (1):
tools: perf: support .gnu_debugdata for symbols
tools/perf/util/dso.c | 2 +
tools/perf/util/dso.h | 1 +
tools/perf/util/symbol-elf.c | 141 ++++++++++++++++++++++++++++++++++-
tools/perf/util/symbol.c | 2 +
tools/perf/util/symsrc.h | 1 +
5 files changed, 143 insertions(+), 4 deletions(-)
--
2.43.5
Powered by blists - more mailing lists