5

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?

5

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.

  • How to debug the kernel with gdb after that? – yum Mar 24 '11 at 2:53
  • I found this on google but YMMV. – coredump Mar 24 '11 at 3: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 3:31
  • 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
  • Here is a wonderfull guide to debug kernel techvolve.blogspot.com/2014/04/… . – Antonio Petricca Sep 4 '18 at 7:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.