6

I've already finishing compiling the kernel from source,

but how to compile it with debug symbols,what additional steps to I need to take?

yum
  • 539
  • 5
  • 9
  • 16

1 Answers1

8

You need CONFIG_DEBUG_INFO=y on the config.

More exactly, the question is Compile the kernel with debug info (DEBUG_INFO) [N/y/?] and it's under the Kernel debugging (DEBUG_KERNEL) [Y/n/?] header. You may need to enable some other option below this one to get to the right one.

coredump
  • 12,573
  • 2
  • 34
  • 53
  • How to debug the kernel with gdb after that? – yum Mar 24 '11 at 02:53
  • I found [this](http://www.cs.wm.edu/~kearns/001lab.d/kernel_gdb.html) on google but YMMV. – coredump Mar 24 '11 at 03:13
  • I've already compiled the kernel with `CONFIG_DEBUG_INFO=y`,but `gdb /usr/src/linux-2.6.32.9/vmlinux /proc/kcore` still can't read symbols:`Reading symbols from /usr/src/linux-2.6.32.9/vmlinux...(no debugging symbols found)...done.` – yum Mar 25 '11 at 03:31
  • https://www.kernel.org/pub/linux/kernel/people/jwessel/kdb/ seems to be a solid guide to attaching the debugger to a kernel. – whitey04 Apr 30 '15 at 22:39
  • 1
    Here is a wonderfull guide to debug kernel http://techvolve.blogspot.com/2014/04/debugging-virtualbox-vms-linux-kernel.html . – Antonio Petricca Sep 04 '18 at 07:12