洞察NDK-STACK输出(Android)

时间:2014-03-03 18:44:43

标签: android unix android-ndk

我一直在努力应对我的应用程序几乎随机崩溃的声明(“损坏的内存堆信号6”)。当我崩溃并在其上运行ndk-stack时,我拿走了我的logcat,得到了以下结果。令人沮丧的是没有故障地址,列出的库是系统库。

有关如何推进此方面的任何见解?如果它有帮助,我的Android应用程序只是使用Intent来启动Camera Capture活动。 Capture完成后,会调用finish()并返回。

谢谢!

pid: 31136, tid: 31136, name: .testquickstart  >>> com.example.testquickstart <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00  pc 00021f90  /system/lib/libc.so (tgkill+12)
Stack frame #01  pc 00012fe1  /system/lib/libc.so (pthread_kill+48)
Stack frame #02  pc 000131f5  /system/lib/libc.so (raise+10)
Stack frame #03  pc 00011f2b  /system/lib/libc.so
Stack frame #04  pc 00021844  /system/lib/libc.so (abort+4)
Stack frame #05  pc 00012a11  /system/lib/libc.so
Stack frame #06  pc 0000f11d  /system/lib/libc.so
Stack frame #07  pc 000116eb  /system/lib/libc.so (dlfree+1222)
Stack frame #08  pc 0000dc0b  /system/lib/libc.so (free+10)
Stack frame #09  pc 0000d2dd  /system/lib/libutils.so (android::SharedBuffer::dealloc(android::SharedBuffer const*)+6)
Stack frame #10  pc 0000f9ef  /system/lib/libutils.so (android::VectorImpl::_shrink(unsigned int, unsigned int)+134)
Stack frame #11  pc 0000ae25  /system/lib/libinput.so (android::MotionEvent::initialize(int, int, int, int, int, int, int, float, float, float, float, long long, long long, unsigned int, an
droid::PointerProperties const*, android::PointerCoords const*)+116)
Stack frame #12  pc 0000f635  /system/lib/libinput.so (android::InputConsumer::initializeMotionEvent(android::MotionEvent*, android::InputMessage const*)+174)
Stack frame #13  pc 0000faeb  /system/lib/libinput.so (android::InputConsumer::consume(android::InputEventFactoryInterface*, bool, long long, unsigned int*, android::InputEvent**)+282)
Stack frame #14  pc 00062ef5  /system/lib/libandroid_runtime.so (android::NativeInputEventReceiver::consumeEvents(_JNIEnv*, bool, long long, bool*)+80)
Stack frame #15  pc 000630f9  /system/lib/libandroid_runtime.so (android::NativeInputEventReceiver::handleEvent(int, int, void*)+52)
Stack frame #16  pc 000107bb  /system/lib/libutils.so (android::Looper::pollInner(int)+478)
Stack frame #17  pc 00010869  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
Stack frame #18  pc 0006a121  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
Stack frame #19  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #20  pc 0004e123  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame #21  pc 00026fe0  /system/lib/libdvm.so
Stack frame #22  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
Stack frame #23  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #24  pc 00060865  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
Stack frame #25  pc 000687c7  /system/lib/libdvm.so
Stack frame #26  pc 00026fe0  /system/lib/libdvm.so
Stack frame #27  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
Stack frame #28  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #29  pc 00060581  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
Stack frame #30  pc 00049d0b  /system/lib/libdvm.so
Stack frame #31  pc 0004cde7  /system/lib/libandroid_runtime.so

1 个答案:

答案 0 :(得分:0)

解决方案实际上与libc.so相关,特别是我在Android NDK链接中使用的标准模板库。在我的Android.MK文件中,我使用stlport_shared链接本机opencv库。 Opencv实际上不支持stlport_shared库,而是支持gnu_stl_shared。随着改变,没有这种类型的问题:)

希望这有助于其他可能与其他库链接相同问题的人。始终确保它们兼容。