Reputation: 185
I'm debugging my Android project with C code, the logcat message shows that:
I/DEBUG (13509): backtrace:
I/DEBUG (13509): #00 pc 000106dc /system/lib/libc.so (dlmalloc+1463)
I/DEBUG (13509): #01 pc 0000cf3f /system/lib/libc.so (malloc+10)
I/DEBUG (13509): #02 pc 00011d0d /system/lib/libutils.so (android::SharedBuffer::alloc(unsigned int)+8)
I/DEBUG (13509): #03 pc 00014cf7 /system/lib/libutils.so (android::VectorImpl::setCapacity(unsigned int)+22)
I/DEBUG (13509): #04 pc 0007fd79 /system/lib/libandroid_runtime.so (android::TextLayoutValue::TextLayoutValue(unsigned int)+108)
I/DEBUG (13509): #05 pc 000811a9 /system/lib/libandroid_runtime.so (android::TextLayoutCache::getValue(SkPaint const*, unsigned short const*, int, int, int, int)+184)
I/DEBUG (13509): #06 pc 00081589 /system/lib/libandroid_runtime.so (android::TextLayoutEngine::getValue(SkPaint const*, unsigned short const*, int, int, int, int)+36)
I/DEBUG (13509): #07 pc 0007f799 /system/lib/libandroid_runtime.so (android::TextLayout::getTextRunAdvances(SkPaint*, unsigned short const*, int, int, int, int, float*, float*)+42)
I/DEBUG (13509): #08 pc 0007c60d /system/lib/libandroid_runtime.so
I/DEBUG (13509): #09 pc 0007c7f9 /system/lib/libandroid_runtime.so
I/DEBUG (13509): #10 pc 0001e690 /system/lib/libdvm.so (dvmPlatformInvoke+112)
I/DEBUG (13509): #11 pc 0005100f /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+426)
I/DEBUG (13509): #12 pc 00027aa0 /system/lib/libdvm.so
I/DEBUG (13509): #13 pc 0002ce84 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
I/DEBUG (13509): #14 pc 000674bf /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
I/DEBUG (13509): #15 pc 0007066f /system/lib/libdvm.so
I/DEBUG (13509): #16 pc 00027aa0 /system/lib/libdvm.so
I/DEBUG (13509): #17 pc 0002ce84 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
I/DEBUG (13509): #18 pc 000671a1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
I/DEBUG (13509): #19 pc 0004d2d7 /system/lib/libdvm.so
I/DEBUG (13509): #20 pc 0004d391 /system/lib/libandroid_runtime.so
I/DEBUG (13509): #21 pc 0004e22d /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+540)
I/DEBUG (13509): #22 pc 00000e67 /system/bin/app_process
I/DEBUG (13509): #23 pc 000128b3 /system/lib/libc.so (__libc_init+38)
I/DEBUG (13509): #24 pc 00000b74 /system/bin/app_process
The message tell me the problem is malloc, it seems the bug is from libandroid_runtim.
How to know what is the problem in my project? Because the message show nothing about my code location, includes java and c.
Please kindly help me to fix this problem. It's bother me for a long time. Thanks very much.
Upvotes: 0
Views: 2625
Reputation: 16152
You got a NULL dereference (that's what the 0x00000000 indicates). Since it's in malloc, that probably means that you corrupted the memory allocator's internal structures by writing outside malloc's returned area at some time before the signal. I would suggest using valgrind to detect that exact point, I think it's usable on Android with some effort.
Upvotes: 1