Fwd: Building kernel modules with debuginfo and printing line numbers in kernel oops message / coredump
On Mon, Apr 22, 2013 at 6:00 AM, arshad hussain <arshad.super@gmail.com> wrote:
On Mon, Apr 22, 2013 at 5:58 AM, arshad hussain <arshad.super@gmail.com> wrote:
On Fri, Apr 19, 2013 at 11:55 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
"myfunctionname +0x2507 +5679"
It's not hex gibberish. What it saying is that, at the time of crash the EIP was pointing withing function "myfunctionname" and offset 0x2507 bytes. Use objdump binary to more detail of your simple.ko
Thanks. But is there not a way to get the line numbers and filenames printed automatically instead of the memory addresses ? For example, in gdb, in userspace, if there is a crash, we can get the line numbers printed when there is a crash. Can the kernel crash/oops handler similarly not print the filenames and linenumbers automatically ? Is there a configuration or hack for getting it that way ? -- Sankar P http://psankar.blogspot.com -- Sankar P http://psankar.blogspot.com
On Mon, Apr 22, 2013 at 12:56 PM, Sankar P <sankar.curiosity@gmail.com> wrote:
Thanks.
But is there not a way to get the line numbers and filenames printed automatically instead of the memory addresses ? For example, in gdb, in userspace, if there is a crash, we can get the line numbers printed when there is a crash. Can the kernel crash/oops handler similarly not print the filenames and linenumbers automatically ? Is there a configuration or hack for getting it that way ?
Hi... try enabling kdb or kgdb, and at the same time make sure your kernel is compiled with symbol built in it. IIRC, that would make it spill line numbers during oops, but that is rather kdb/kgdb specific though -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
participants (2)
-
Mulyadi Santosa -
Sankar P