linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add option for generating BTF types of global variables
@ 2025-02-07  1:20 Stephen Brennan
  2025-02-07  1:20 ` [PATCH 1/2] kallsyms: output rodata to ".kallsyms_rodata" Stephen Brennan
  2025-02-07  1:20 ` [PATCH 2/2] btf: Add the option to include global variable types Stephen Brennan
  0 siblings, 2 replies; 17+ messages in thread
From: Stephen Brennan @ 2025-02-07  1:20 UTC (permalink / raw)
  To: Masahiro Yamada, Arnd Bergmann
  Cc: Andrii Nakryiko, Nicolas Schier, Kees Cook, KP Singh,
	Stephen Brennan, Martin KaFai Lau, Sami Tolvanen,
	Eduard Zingerman, linux-arch, Stanislav Fomichev, Kent Overstreet,
	Pasha Tatashin, Jiri Olsa, John Fastabend, Jann Horn,
	Ard Biesheuvel, Yonghong Song, Hao Luo, Andrew Morton,
	linux-kbuild, Daniel Borkmann, Nathan Chancellor, linux-debuggers,
	Alexei Starovoitov, Song Liu, linux-kernel, bpf

Hello everyone,

These patches add the CONFIG_DEBUG_INFO_BTF_GLOBAL_VARS option, which instructs
pahole to include types of global variables. Pahole >= 1.28 is required. More
context for what this feature enables can be seen in patch 2, as well as the
series which introduced this feature to pahole [1].

To demonstrate the functionality, my "btf_2024" branch of drgn (the current
development branch for the BTF debugging feature, despite the name) can be used
as below to debug a running kernel with these patches enabled.

    git clone https://github.com/brenns10/drgn -b btf_2024
    cd drgn
    python setup.py build_ext -i
    sudo python -m drgn --no-default-symbols --btf -k

The "--no-default-symbols" ensures that drgn doesn't accidentially find & use
your DWARF debuginfo :)

The resulting debugging session supports a similar level of capability as drgn
with DWARF debuginfo: variable & function types are available, stack traces may
be unwound (using ORC), and the kallsyms symbol table is available. You can also
try various drgn "contrib" scripts which implement useful utilities. All of the
ones I could readily test are working with BTF, for example:

    sudo python -m drgn --no-default-symbols --btf -k contrib/slabinfo.py

[1] https://lore.kernel.org/all/20241002235253.487251-1-stephen.s.brennan@oracle.com/#t

Stephen Brennan (2):
  kallsyms: output rodata to ".kallsyms_rodata"
  btf: Add the option to include global variable types

 include/asm-generic/vmlinux.lds.h |  1 +
 lib/Kconfig.debug                 | 10 ++++++++++
 scripts/Makefile.btf              |  3 +++
 scripts/kallsyms.c                |  2 +-
 4 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.43.5


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

end of thread, other threads:[~2025-05-12 11:15 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07  1:20 [PATCH 0/2] Add option for generating BTF types of global variables Stephen Brennan
2025-02-07  1:20 ` [PATCH 1/2] kallsyms: output rodata to ".kallsyms_rodata" Stephen Brennan
2025-02-15 14:21   ` Masahiro Yamada
2025-02-24 18:51     ` Andrii Nakryiko
2025-02-25  1:24       ` Stephen Brennan
2025-02-25 16:59         ` Andrii Nakryiko
2025-02-07  1:20 ` [PATCH 2/2] btf: Add the option to include global variable types Stephen Brennan
2025-02-07 23:50   ` Alexei Starovoitov
2025-02-11 23:58     ` Stephen Brennan
2025-02-14  1:18       ` Alexei Starovoitov
2025-02-18 23:09         ` Stephen Brennan
2025-02-25 21:47           ` Andrii Nakryiko
2025-02-25 10:01     ` Alan Maguire
2025-02-25 21:52       ` Andrii Nakryiko
2025-02-26 14:20         ` Alan Maguire
2025-02-26 16:57           ` Andrii Nakryiko
2025-05-12 11:15       ` Tony Ambardar

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