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

neha naik nehanaik27 at gmail.com
Fri Apr 19 17:41:53 EDT 2013


Hi Sankar,
  I found this article for debugging third party module sometime back. I
have not used it still (I kind of look at the hexadeciamal gibberish still
:) ).
 But you can give it a try :

http://www.linux.com/learn/linux-training/33991-the-kernel-newbie-corner-kernel-and-module-debugging-with-gdb

Regards,
Neha

On Fri, Apr 19, 2013 at 12:25 PM, Sankar P <sankar.curiosity at gmail.com>wrote:

> 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
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130419/466c07bd/attachment.html 


More information about the Kernelnewbies mailing list