gmanolache / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

StackwalkerAMD64 doesn't fall back to stack scanning #402

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
=== test code ===
static int foo()
{
  //int* v = NULL;
  //*v = 10;
  strncpy(NULL, NULL, 10);
}

static int bar()
{
  foo();
}

int main(int argc, char** argv)
{
  google_breakpad::ExceptionHandler handler(".", NULL, MinidumpCallback, NULL, true);

  bar();

  return 0;
}

===

Run program to get dump file.  When running minidump_stackwalk, the output is 
simply:
Thread 0 (crashed)
 0  libc-2.11.1.so + 0x8b757
    rbx = 0x00000000   r12 = 0x00400ad0   r13 = 0xa4da8970   r14 = 0x00000000
    r15 = 0x00000000   rip = 0xa6496757   rsp = 0xa4da8768   rbp = 0xa4da8780

whereas dereferencing a NULL ptr (commented out code) results in 
minidump_stackwalk giving this detail:
Thread 0 (crashed)
 0  testcrash!foo [main.cpp : 15 + 0x4]
    rbx = 0x00000000   r12 = 0x00400a80   r13 = 0x0b2c0170   r14 = 0x00000000
    r15 = 0x00000000   rip = 0x00400b74   rsp = 0x0b2bff88   rbp = 0x0b2bff88
 1  testcrash!bar [main.cpp : 21 + 0x4]
    rbx = 0x00000000   r12 = 0x00400a80   r13 = 0x0b2c0170   r14 = 0x00000000
    r15 = 0x00000000   rip = 0x00400b89   rsp = 0x0b2bff98   rbp = 0x0b2bffa0
 2  testcrash!main [main.cpp : 29 + 0x4]
    rbx = 0x00000000   r12 = 0x00400a80   r13 = 0x0b2c0170   r14 = 0x00000000
    r15 = 0x00000000   rip = 0x00400c54   rsp = 0x0b2bffb0   rbp = 0x0b2c0090
 3  libc-2.11.1.so + 0x1ec4c
    rbx = 0x00000000   r12 = 0x00400a80   r13 = 0x0b2c0170   r14 = 0x00000000
    r15 = 0x00000000   rip = 0x1d344c4d   rsp = 0x0b2c00a0   rbp = 0x00000000

Using google-breakpad from svn revision 682 (current) on Linux 2.6.32 x86_64.

Original issue reported on code.google.com by cjstimp...@gmail.com on 14 Sep 2010 at 9:24

GoogleCodeExporter commented 9 years ago
You don't have symbols for libc, and the x86-64 stackwalker doesn't try to scan 
the stack for return addresses like the x86 stackwalker. (The x86-64 ABI says 
you don't need to have a frame pointer by default, so we rely on the .eh_frame 
or DWARF data to do stack walking.)

This is filed in Mozilla's bugzilla as: 
https://bugzilla.mozilla.org/show_bug.cgi?id=571578

Original comment by ted.mielczarek on 24 Sep 2010 at 1:33

GoogleCodeExporter commented 9 years ago
I fixed this in r704, FYI.

Original comment by ted.mielczarek on 25 Oct 2010 at 2:05