scripts: script from kerneloops.org to pretty print oops dumps
commit5aea50b5c76b07f2b6bda3426dba998156eaf6d0
authorArjan van de Ven <arjan@infradead.org>
Tue, 6 Jan 2009 22:40:57 +0000 (6 14:40 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:12 +0000 (6 15:59 -0800)
tree20e522f88586e8c0835893e9236dded9fc6d87f2
parentd6624f996ae539344e8d748cce1117ae7af06fbf
scripts: script from kerneloops.org to pretty print oops dumps

We're struggling all the time to figure out where the code came from that
oopsed..  The script below (a adaption from a script used by
kerneloops.org) can help developers quite a bit, at least for non-module
cases.

It works and looks like this:

[/home/arjan/linux]$ dmesg | perl scripts/markup_oops.pl vmlinux
 {
  struct agp_memory *memory;

  memory = agp_allocate_memory(agp_bridge, pg_count, type);
 c055c10f: 89 c2                 mov    %eax,%edx
  if (memory == NULL)
 c055c111: 74 19                 je     c055c12c <agp_allocate_memory_wrap+0x30>
 /* This function must only be called when current_controller != NULL */
 static void agp_insert_into_pool(struct agp_memory * temp)
 {
  struct agp_memory *prev;

  prev = agp_fe.current_controller->pool;
 c055c113: a1 ec dc 8f c0        mov    0xc08fdcec,%eax
*c055c118: 8b 40 10              mov    0x10(%eax),%eax     <----- faulting instruction

  if (prev != NULL) {
 c055c11b: 85 c0                 test   %eax,%eax
 c055c11d: 74 05                 je     c055c124 <agp_allocate_memory_wrap+0x28>
  prev->prev = temp;
 c055c11f: 89 50 04              mov    %edx,0x4(%eax)
  temp->next = prev;
 c055c122: 89 02                 mov    %eax,(%edx)
  }
  agp_fe.current_controller->pool = temp;
 c055c124: a1 ec dc 8f c0        mov    0xc08fdcec,%eax
 c055c129: 89 50 10              mov    %edx,0x10(%eax)
  if (memory == NULL)
  return NULL;

  agp_insert_into_pool(memory);

so in this case, we faulted while dereferencing agp_fe.current_controller
pointer, and we get to see exactly which function and line it affects...
Personally I find this very useful, and I can see value for having this
script in the kernel for more-than-just-me to use.

Caveats:
* It only works for oopses not-in-modules
* It only works nicely for kernels compiled with CONFIG_DEBUG_INFO
* It's not very fast.
* It only works on x86

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/markup_oops.pl [new file with mode: 0644]