While I haven't worked in kernel space yet, I know how to do this in userland (and it's probably the same):But thats not all, you can compile your source code under gcc with debuging symbols using "-g". This will add all the debuging symbols in the kernel image itself (Thus making it bigger ). I think there is a way to make this symbol file seperate, if so, please let me know.
Compile the program in two steps. When creating the object file, add debugging information. When linking, keep it in the debug version and remove it from the standard one:
Code: Select all
gcc -g -c program.c -o program.o
gcc program.o -o program.dbg
gcc program.o -s -o program
Code: Select all
strip program.dbg --only-keep-debug
Code: Select all
gcc -g program.c -o program
strip program --only-keep-debug -o program.dbg
strip program
Code: Select all
gdb --exec program --symbols program.dbg
Code: Select all
add-symbol-file program.dbg