0

I have Beagle bone running Linux.On the Host system I am using cross gdb (arm gdb) to debug kernel and kernel modules.

In my kernel build directory,there is no symlink(vmlinux-gdb.py) pointing to /build_directory/scripts/gdb/vmlinux-gdb.py. But the vmlinux-gdb.py is present in build_directory/scripts/gdb/vmlinux-gdb.py.

So i have directly given path of vmlinux-gdb.py in /root/.gdbinit file as follows

add-auto-load-safe-path build_directory/scripts/gdb/

I am able connect to target using GDB over serial port and the KGDB breakpoint hits on target.But the GDB scripts commands are not recognised.

If i run "apropos lx" on gdb prompt on host, there is no output.

If i run "lx-symbols" on gdb prompt on host, the output is undefined symbol "lx-symbol".

The setup has following configuration :

  1. CONFIG_GDB_SCRIPTS=y set in /boot/config file on target hardware.

  2. Target kernel version : 5.10.120

  3. Host kernel version : 5.11.0

  4. Cross GDB version on host : 7.10

Any inputs on how this can be resolved.

akumar
  • 39
  • 7
  • If there's no symlink something is wrong since the intended way to use the kernel's Python GDB scripts is through the symlink... you should try to get that first. – Marco Bonelli Sep 24 '22 at 14:12
  • @MarcoBonelli : I will try to get symlink in top level build directory. As the symlink is not present but /scripts/gdb/vmlinux-gdb.py is present, so will giving the path directly to /scripts/gdb/ not work.? Even from top level build directory it will go to /scripts/gdb/vmlinux-gdb.py to get the GDB scripts. – akumar Sep 24 '22 at 15:47
  • From my experience no it won't work. It's mostly because part of those scripts are generated at kernel build time, and (again from my experience) if the symlink is not present it means that not all the necessary pieces were built, so including the script with its real path does not work. – Marco Bonelli Sep 24 '22 at 18:15
  • @MarcoBonelli : have the CONFIG_GDB_SCRIPTS=y set in .config file for kernel build but the symlink vmlinux-gdb.py is not getting created in top level build directory. Do i need to do some other settings to get this symlink. – akumar Sep 28 '22 at 20:16

1 Answers1

0

Previously I was using default configuration for Beaglebone kernel downloaded from Beaglebone github. I removed the default configuration while building kernel. This generated the vmlinux-gdb.py symlink in Kernel build directory.

Also i have set the "add-auto-load-safe-path" command in /root/.config/gdb/gdbinit file. The path to set "add-auto-load-safe-path" is displayed when the "vmlinux" file is run with GDB. I suspect that path of gdbinit file varies from system-to-system. With these settings I am able to run lx commands.

akumar
  • 39
  • 7