Building kernel modules with debuginfo and printing line numbers in kernel oops message / coredump
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
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-ker... Regards, Neha On Fri, Apr 19, 2013 at 12:25 PM, Sankar P <sankar.curiosity@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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Neha, On Sat, Apr 20, 2013 at 3:11 AM, neha naik <nehanaik27@gmail.com> wrote:
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-ker...
Thanks. But this article seem to talk about using gdb for the kernel development. I am more interested in getting the default dmesg output to show the stack traces with proper filenames and line numbers :)
Regards, Neha
On Fri, Apr 19, 2013 at 12:25 PM, Sankar P <sankar.curiosity@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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Sankar P http://psankar.blogspot.com
On Sat, Apr 20, 2013 at 11:04 AM, <Valdis.Kletnieks@vt.edu> wrote:
On Fri, 19 Apr 2013 23:55:49 +0530, Sankar P said:
myfunctionname +0x2507 +5679
That function is too honking big and needs to be refactored. :)
hehe Actually I just typed some random numbers to explain my problem, that I get hexadecimal numbers. Thanks. -- Sankar P http://psankar.blogspot.com
participants (3)
-
neha naik -
Sankar P -
Valdis.Kletnieks@vt.edu