linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Support .gnu_debugdata for symbols in perf
@ 2025-02-13 19:05 Stephen Brennan
  2025-02-13 19:05 ` [PATCH 1/1] tools: perf: support .gnu_debugdata for symbols Stephen Brennan
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Brennan @ 2025-02-13 19:05 UTC (permalink / raw)
  To: Namhyung Kim, Ingo Molnar, Arnaldo Carvalho de Melo,
	Peter Zijlstra
  Cc: Stephen Brennan, linux-perf-users, Adrian Hunter, Liang, Kan,
	James Clark, Athira Rajeev, linux-kernel, Chaitanya S Prakash,
	Alexander Shishkin, Jiri Olsa, Mark Rutland, Ian Rogers

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-19 22:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 19:05 [PATCH 0/1] Support .gnu_debugdata for symbols in perf Stephen Brennan
2025-02-13 19:05 ` [PATCH 1/1] tools: perf: support .gnu_debugdata for symbols Stephen Brennan
2025-02-14 19:30   ` Andi Kleen
2025-02-19 21:15     ` Namhyung Kim
2025-02-19 21:57       ` Stephen Brennan
2025-02-19 22:14         ` Namhyung Kim

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).