Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDB: lx-symbols undefined command

I am following the guide below: Debugging kernel and modules via gdb

When I try to load the module symbols using the command below: (gdb) lx-symbols

gdb says that the command is undefined. How do I add these helper command to gdb?

gdb info: gdb-7.6.1-51.el7.x86-64 on Centos 7.0

like image 286
Chu Bun Avatar asked Mar 17 '15 16:03

Chu Bun


2 Answers

You have to get the latest kernel sources (may be 4.0-rc4) or backport the patch. Basically see if you have script/gdb/ directory like this in your kernel sources. Because that is where you get these scripts.

Then you follow the steps mentioned in Debugging kernel and modules via gdb

like image 87
Milind Dumbare Avatar answered Nov 17 '22 18:11

Milind Dumbare


add-auto-load-safe-path

Usage:

gdb -ex add-auto-load-safe-path /path/to/linux/kernel/source/root

Now the GDB scripts are automatically loaded, and lx-symbols is available.

Here is a minimal fully automated Buildroot + QEMU example with detailed instructions.