Crash Dump Analysis Patterns (Part 23a, Mac OS X)
This is a Mac OS X / GDB counterpart to Double Free (process heap) pattern previously described for Windows platforms:
(gdb) bt
#0 0x00007fff8479582a in __kill ()
#1 0x00007fff8e0e0a9c in abort ()
#2 0x00007fff8e13f84c in free ()
#3 0x00000001035a8ef4 in main (argc=1, argv=0x7fff631a7b20)
(gdb) x/2i 0x00000001035a8ef4-8
0x1035a8eec
0×1035a8eef
(gdb) frame 3
#3 0x00000001035a8ef4 in main (argc=1, argv=0x7fff631a7b20)
at .../DoubleFree/main.c:23
23 free(p2);
Current language: auto; currently minimal
(gdb) x/g $rbp-0x20
0x7fff631a7ae0: 0x00007fe6a8801400
(gdb) x/2w 0x00007fe6a8801400
0x7fe6a8801400: 0x00000000 0xb0000000
Here’s the source code of the modeling application:
int main(int argc, const char * argv[])
{
char *p1 = (char *) malloc (1024);
printf(“p1 = %p\n”, p1);
char *p2 = (char *) malloc (1024);
printf(“p2 = %p\n”, p2);
free(p2);
free(p1);
free(p2);
return 0;
}
- Dmitry Vostokov @ DumpAnalysis.org + TraceAnalysis.org -
Forthcoming Training: Accelerated Mac OS X Core Dump Analysis