Linux kernel debugging - make scripts_gdb - Error
Luis Machado
luis.machado@arm.com
Wed Apr 12 17:51:12 GMT 2023
Hi,
On 4/12/23 11:28, Little Tree via Gdb wrote:
> I am remotely debugging an AArch64 Linux kernel running on QEMU using gdb.
> I wish to make use of the Python support while debugging (for using the
> commands like lx-dmesg).
> Referring to this link
> https://docs.kernel.org/dev-tools/gdb-kernel-debugging.html , I understand
> that for Linux kernel 5.1 and above, the scripting support is to be built
> using the command "make scripts_gdb" after the Linux kernel is built. I am
> getting many errors while building (mostly related to x86).
>
> Do I have to set any arm specific environment variable before building? At
> present my build command is
>
> $make scripts_gdb
In my experience I didn't have to make scripts_gdb. After enabling the CONFIG_GDB_SCRIPTS option in the kernel configuration, the helper python scripts were left in the kernel build tree.
When you load vmlinux, gdb will automatically attempt to load the helper python scripts if you have the proper auto-load permissions.
I did run into issues with a more recent kernel where it says the following when I try to load vmlinux into gdb:
Traceback (most recent call last):
File "linux-arm64/vmlinux-gdb.py", line 25, in <module>
import linux.utils
File "linux-arm64/scripts/gdb/linux/utils.py", line 131, in <module>
atomic_long_counter_offset = atomic_long_type.get_type()['counter'].bitpos
KeyError: 'counter'
I'm not sure if that's a bug in the helper scripts due to a recent commit or not. I recall these steps working out-of-the-box though.
>
>
> Thanks a lot,
> Little
More information about the Gdb
mailing list