Skip to content

kernel.spec: include the GDB plugin in kernel-debuginfo

Provide the GDB plugin files in the debuginfo package so that consumers can use it when dubugging the kernel via GDB [1]. While it spossible to do it without this plugin to some extent, it becomes essential when you want to debug also code inside modules. And it provides many more convenience commands on top of that.

Place the plugin files beside vmlinux so that gdb can auto-load it (after some path setup). Example gdb command line using manually extracted debuginfo RPM contents:

gdb --directory <extracted_dir>/usr/src/debug/*/linux-<kver> \
    --cd <extracted_dir>/usr/lib/debug/lib/modules/<kver> \
    -iex 'add-auto-load-safe-path <extracted_dir>/usr/lib/debug/lib/modules/<kver>' \
    -ex 'target remote <gdb_socket_or_port>' vmlinux

I occasionally use this to debug kernels built as an RPM and having the plugin included will be very useful to me.

[1] https://docs.kernel.org/dev-tools/gdb-kernel-debugging.html

Merge request reports