0

I am trying to debug an aarch64 Linux kernel loaded in QEMU from x86 host. When 'lx-symbols' command executed for loading the symbols from gdb, it has shown

Undefined command: "lx-symbols"

The I have tried executing 'add-auto-load-safe-path' command as shown below

gdb-multiarch  /mykernelbuild/linux/arch/arm64/boot/Image

gdb) target remote localhost:9000
Remote debugging using localhost:9000
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.

add-auto-load-safe-path /mykernelbuild/linux/scripts/gdb

Still 'lx-symbols' is returning error. I have tried adding this to '~/.gdbint' and restarting 'gdb-multiarch' as well. I have tried adding the filename also to the path

add-auto-load-safe-path /mykernelbuild/linux/scripts/gdb/vmlinux-gdb.py

still no success, any hint is greatly appreciated...

Little Tree
  • 63
  • 1
  • 6

1 Answers1

1

gdb-multiarch /mykernelbuild/linux/arch/arm64/boot/Image

You are debugging Image, and not vmlinux. So GDB will attempt to auto-load Image-gdb.py (which is nowhere to be found).

I have no idea what boot/Image is, but you probably want to be debugging boot/vmlinux instead.

Update:

add-auto-load-safe-path /mykernelbuild/linux/scripts/gdb

Now GDB is complaining about the /mykernelbuild/linux/scripts/gdb not being in the auto-load-safe-path (which it wouldn't be since you haven't added it yet).

You want something like:

gdb-multiarch -ex 'add-auto-load-safe-path /mykernelbuild/linux/scripts/gdb' \
  /mykernel/linux/vmlinux
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Thank you very much. `$ gdb-multiarch /mykernel/linux/vmlinux ... Reading symbols from /mykernel/linux/vmlinux... Traceback (most recent call last): File "/mykernel/linux/vmlinux-gdb.py", line 25, in import linux.utils File "/mykernel/linux/scripts/gdb/linux/utils.py", line 131, in atomic_long_counter_offset = atomic_long_type.get_type()['counter'].bitpos KeyError: 'counter'` `add-auto-load-safe-path /mykernelbuild/linux/scripts/gdb (gdb) lx-symbols` lx-symbols still returns undefined command, but I am able to see the source now. Anything wrong here? – Little Tree Nov 05 '22 at 02:12
  • Thank you. The error still remains, it looks like the python script has some error. My default python is 2.7.18. can it be related to that? – Little Tree Nov 05 '22 at 04:00