mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Documentation: How to use GDB to decode OOPSes
@ 2007-05-28  7:46 Pekka J Enberg
  2007-05-29 23:44 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka J Enberg @ 2007-05-28  7:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

From: Pekka Enberg <penberg@cs.helsinki.fi>

Adds instructions how to use GDB to figure out the exact location of
an OOPS to Documentation/BUG-HUNTING.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 Documentation/BUG-HUNTING |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Index: 2.6/Documentation/BUG-HUNTING
===================================================================
--- 2.6.orig/Documentation/BUG-HUNTING	2007-02-05 09:46:58.000000000 +0200
+++ 2.6/Documentation/BUG-HUNTING	2007-05-28 10:38:55.000000000 +0300
@@ -191,6 +191,30 @@ >        mov        0xd0(%esp), %ebp    
 >        mov        0x8(%ebp), %ebx         ! %ebx = skb->sk
 >        mov        0x13c(%ebx), %eax       ! %eax = inet_sk(sk)->opt
 
+In addition, you can use GDB to figure out the exact file and line
+number of the OOPS from the vmlinux file. If you have
+CONFIG_DEBUG_INFO enabled, you can simply copy the EIP value from the
+OOPS:
+
+ EIP:    0060:[<c021e50e>]    Not tainted VLI
+
+And use GDB to translate that to human-readable form:
+
+  gdb vmlinux
+  (gdb) l *0xc021e50e
+
+If you don't have CONFIG_DEBUG_INFO enabled, you use the function
+offset from the OOPS:
+
+ EIP is at vt_ioctl+0xda8/0x1482
+
+And recompile the kernel with CONFIG_DEBUG_INFO enabled:
+
+  make vmlinux
+  gdb vmlinux
+  (gdb) p vt_ioctl
+  (gdb) l *(0x<address of vt_ioctl> + 0xda8)
+
 Another very useful option of the Kernel Hacking section in menuconfig is
 Debug memory allocations. This will help you see whether data has been
 initialised and not set before use etc. To see the values that get assigned

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Documentation: How to use GDB to decode OOPSes
  2007-05-28  7:46 [PATCH] Documentation: How to use GDB to decode OOPSes Pekka J Enberg
@ 2007-05-29 23:44 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-05-29 23:44 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel

On Mon, 28 May 2007 10:46:18 +0300 (EEST)
Pekka J Enberg <penberg@cs.helsinki.fi> wrote:

> +In addition, you can use GDB to figure out the exact file and line
> +number of the OOPS from the vmlinux file. If you have
> +CONFIG_DEBUG_INFO enabled, you can simply copy the EIP value from the
> +OOPS:
> +
> + EIP:    0060:[<c021e50e>]    Not tainted VLI
> +
> +And use GDB to translate that to human-readable form:
> +
> +  gdb vmlinux
> +  (gdb) l *0xc021e50e
> +
> +If you don't have CONFIG_DEBUG_INFO enabled, you use the function
> +offset from the OOPS:
> +
> + EIP is at vt_ioctl+0xda8/0x1482
> +
> +And recompile the kernel with CONFIG_DEBUG_INFO enabled:
> +
> +  make vmlinux
> +  gdb vmlinux
> +  (gdb) p vt_ioctl
> +  (gdb) l *(0x<address of vt_ioctl> + 0xda8)
> +

yeah.  Often this process will tell you that the oops was in
spin_lock_irq() or list_add() or something useless like that.

So the next step is to start adding and subtracting 4, 8, 12, ...
to the EIP value until you "fall out" of the inlined function and 
back into the callee.

But I'm not sure that I'd want to have to describe that process
(especially the means by which one determines that it is necessary)
to normal people ;)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-29 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-28  7:46 [PATCH] Documentation: How to use GDB to decode OOPSes Pekka J Enberg
2007-05-29 23:44 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome