gaoqiangscut
gaoqiangscut

Reputation: 11

kgdb cannot find the source code when debugging kernel module

I want to debug a kernel module with kgdb,do as the following:

gdb: add-symbol-file /home/gaoqiang/kernel-32/fs/ext4/ext4.ko 0xffffffffa0122000 -s .bss 0xffffffffa016b380 -s .data 0xffffffffa0168400

gdb: break ext4_getattr gdb: c

I successfully get to the break point,but gdb told me :"[ No Source Available ]" then how to get gdb to find source code for the module?

Upvotes: 1

Views: 614

Answers (2)

Milind Dumbare
Milind Dumbare

Reputation: 3234

 (gdb)set solib-search-path /home/gaoqiang/kernel-32/fs/ext4/

Upvotes: 1

GeekFactory
GeekFactory

Reputation: 399

As per your problem

(gdb) add-symbol-file /home/gaoqiang/kernel-32/fs/ext4/ext4.ko 0xffffffffa0122000 -s .bss 0xffffffffa016b380 -s .data 0xffffffffa0168400

I assume that the module is present in the directory /home/gaoqiang/kernel-32/fs/ext4/. If your source code is also in directory the gdb would not have given the error/warning.

So if the source files for ext4.ko module say ext4.c and the rest are not present in that directory, copy them to the directory.

Upvotes: 1

Related Questions