Building kernel modules with debuginfo and printing line numbers in kernel oops message / coredump

Sankar P sankar.curiosity at gmail.com
Fri Apr 19 14:25:49 EDT 2013


Hi,

I have written a kernel module which I build using:

Makefile (edited a bit)
==========
obj-m := simple.o
simple-objs := s.o

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

=======

Everything builds fine. But my kernel module caused an oops and the
message was something like:

myfunctionname +0x2507 +5679

or some hexadecimal gibberish. I know that I can use some external
tool to find out what these addresses mean. But, is there a way I can
get the kernel oops message to print these information along with line
number ?

Is there a way to build the kernel module with debug symbols ? In user
space, I usually do "-g" or "-ggdb" and it will give me line numbers
and filenames neatly while dumping stacktrace. Is there a similar
facility available for out of tree kernel modules too ?

Even if I give :

$ CFLAGS="-ggdb" make

The output file size (.ko) is not changed.

Can someone help me with building kernel modules with debug info and
get the filename and line numbers printed in the oops messages /
coredump ?

Thanks.


--
Sankar P
http://psankar.blogspot.com



More information about the Kernelnewbies mailing list