Skip to content
Advertisement

GDB: breakpoint in linux built-in module fails

I am debugging linux kernel using two virtual machines connected via serial port.

Target machine awaits connection from remote gdb, by inserting kgdbwait() and kgdboc=ttyS0,115200 in the correct entry in /boot/grub/grub.cfg.

In Host machine

sudo gdb ./vmlinux

Symbols are read and I am supposed to be able to put breakpoints on function names.

(gdb) break oom_kill_process
Breakpoint 1 at 0xc1172ef0: file mm/oom_kill.c, line 843.

Works fine!

However, if I set a breakpoint at htb_dequeue_tree which is found here, I get the following error:

(gdb) break htb_dequeue_tree

No symbol “htb_dequeue_tree” in current context.

Advertisement

Answer

The problem was that HTB is a built-in module which is dynamically inserted, hence when making, it is not included in the vmlinux file which contains the symbols.

To fix this, it has to be changed to an internal part and not a module, and this can be done in menuconfig

Just run

make menuconfig

Find the module, and change it from <m> to <*>

Remake your kernel, install modules and install, this should result in a new vmlinux which will contain the symbols of the desired module so you will be able to breakpoint at any linefunction name.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement