1

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?

2
  • Is it a kernel you have built or a kernel provided by your Linux distro? For the latter, the debug info GDB needs can actually be in a separate file rather than in ext4.ko itself. You can look for the packages like kernel-*-debug, kernel-*-debuginfo, etc., in the repositories of your distro. Commented Dec 28, 2012 at 7:24
  • BTW, could you describe a bit what you are trying to find out about ext4 with kgdb? In some cases, there could be easier ways to collect the data you need than using a debugger. Commented Dec 28, 2012 at 7:27

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.