[PATCH] Documentation: How to use GDB to decode OOPSes

From: Pekka J Enberg
Date: Mon May 28 2007 - 03:47:22 EST


From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/