转载请注明出处: http://blog.csdn.net/zhangyang0402/article/details/16378353
android中发生native crash时,会在/data/tombstones/目录下生成tombstone文件。其中,错误的地方经常遇到fault addr deadbaad。如下:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR),
fault addr deadbaad
r0 00000062 r1 deadbaad r2 00000003 r3 00000063
r4 401820f0 r5 00000000 r6 40194a4c r7 00000000
r8 4017e699 r9 4018d4e0 sl 4017e7e1 fp 00001250
ip 00000000 sp 5e4ffaa8 lr 4016c47d pc 4015837a cpsr 00000030
d0 4f2f49206b736920 d1 6f666e4965736165
d2 0065005600270072 d3 006f006900730072
d4 0061007400610044 d5 0065007300610062
d6 006f0066006e0049 d7 0045004800570020
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000000000004bff d17 ffffffffffffffff
d18 0000000000004801 d19 0033006c00640032
d20 0065006500350061 d21 006e007800680030
d22 0000000000000004 d23 00690034006f0072
d24 3fd99a27ad32ddf5 d25 3fe555b0aaeac752
d26 0000000000000000 d27 0000000000000000
d28 0000000000000005 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 20000010
backtrace:
#00 pc 0001437a /system/lib/libc.so
#01 pc 00015ded /system/lib/libc.so (dlfree+372)
#02 pc 00016edf /system/lib/libc.so (free+10)
......
看了下代码,一般是在heap corrucption的时候,调用abort()->__libc_android_abort()
在__libc_android_abort()中,
{
......
/* temporary, for bug hunting */
/* seg fault seems to produce better debuggerd results than SIGABRT */
*((char*)0xdeadbaad) = 39;
/* -- */
......
}
故意向0xdeadbaad地址写数据,引起SIGSEGV错误。这样,我们在tombsone中就看到fault addr deadbaad了。