core dump addresses not byte aligned - android

I was examining some ARM crashes on Android and realised some memory addresses positions are not 2-byte aligned (THUMB/ARM) but some are. Does any one know why is that so? Here is an example tombstone:
Stack frame #00 pc 00072c9a /system/lib/libdvm.so (dvmAbort+170)
Stack frame #01 pc 00050f6b /system/lib/libdvm.so (ScopedCheck::checkInstanceFieldID(_jobject*, _jfieldID*)+379)
Stack frame #02 pc 0005db56 /system/lib/libdvm.so (Check_SetBooleanField(_JNIEnv*, _jobject*, _jfieldID*, unsigned char)+150)
Stack frame #03 pc 00003a93 /system/lib/libmytestt.so (Java_com_test_jni_MyLibWrapper_getMonitorSample+259)
Stack frame #04 pc 0002d850 /system/lib/libdvm.so (dvmPlatformInvoke+80)
Stack frame #05 pc 00085b48 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+648)
Stack frame #06 pc 000505db /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+59)
Stack frame #07 pc 0008b96d /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+317)
Stack frame #08 pc 00170ff1 /system/lib/libdvm.so
One can see that #00, #02 are 2 byte aligned while #01 and #03 are not. Any explanation of why is it so? Thanks.

I would guess that the odd addresses indicate that those functions are in THUMB mode, while the even addresses are in ARM mode. When returning from a function with bx lr, the processor will switch from ARM mode to THUMB or vice versa depending on the lowest bit of the address, so I'd guess this is what you end up seeing in the backtrace as well.

Related

Android NDK strange crash

I'm having a bad issue with Android NDK. My app crashes with error 11 but the problem is that the stack dump makes no sense.
********** Crash dump: **********
Build fingerprint: 'samsung/p4noterfub/p4noterf:4.1.2/JZO54K/N8000UBCML2:user/release-keys'
pid: 27557, tid: 27557, name: com.nirai.app >>> com.nirai.app <<<
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 5d2b601c
Stack frame #00 pc 000046d2 /system/bin/linker
Stack frame #01 pc 00005c3b /system/bin/linker
Stack frame #02 pc 0004f90d /system/lib/libandroid_runtime.so
Stack frame #03 pc 0001df30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #04 pc 0004d183 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
Stack frame #05 pc 00027360 /system/lib/libdvm.so
Stack frame #06 pc 0002bc68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #07 pc 0005fbb7 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
Stack frame #08 pc 00067165 /system/lib/libdvm.so
Stack frame #09 pc 00027360 /system/lib/libdvm.so
Stack frame #10 pc 0002bc68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #11 pc 0005f8f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
Stack frame #12 pc 00049773 /system/lib/libdvm.so
Stack frame #13 pc 0004c169 /system/lib/libandroid_runtime.so
Stack frame #14 pc 0004d2cb /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
Stack frame #15 pc 00000dcf /system/bin/app_process
Crash dump is completed
There's no reference to my lib (libtest.so) so I'm lost now!
Extra info:
NDK r8d
API 9
Testing on real unrooted device (emulator hangs with no crash)
The error seems to happen at System.load - your
NDK r8d is really old (~2012) , lot of bugs were fixed since then, strongly suggest you update to latest NDK version r10b and try rebuilding your app with new toolchain.

Random crashes on COCOS2dx game android

Android NDK error while running application find this error in logcat.
Build fingerprint: 'i1017/i1017/i1017:4.1.1/JRO03H/20130601.100904:eng/release-keys'
pid: 1981, tid: 1990, name: FinalizerDaemon >>> com.verve.rummy <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
Stack frame #00 pc 00013778 /system/lib/libc.so
Stack frame #01 pc 00015b55 /system/lib/libc.so (dlfree+1628)
Stack frame #02 pc 00016d03 /system/lib/libc.so (free+10)
Stack frame #03 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #04 pc 0004d083 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
Stack frame #05 pc 00027260 /system/lib/libdvm.so
Stack frame #06 pc 0002bb68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #07 pc 0005f7f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
Stack frame #08 pc 0005f81b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #09 pc 000543d3 /system/lib/libdvm.so
Stack frame #10 pc 00012b70 /system/lib/libc.so (__thread_entry+48)
Stack frame #11 pc 000122c8 /system/lib/libc.so (pthread_create+172)
I am getting this type of error in stack while running my android game.
Above i put my error log please help me for resolve this error.
Due to this my game crashes randomly.
I am using android NDK for build application
Sorry for my poor English.
Thanks in advance.

Insight into NDK-STACK output (Android)

I have been struggling with my application's almost random crashes that declare("corrupt memory heap signal 6"). I took my logcat when it crashed and ran ndk-stack on it, and got the following results. What is frustrating is that there is no fault address and the libraries that are listed are system libraries.
Any insight on how to move forward with this? If it helps, my Android application simply uses an Intent to launch a Camera Capture activity. Once the Capture is done, it calls finish() and returns.
Thanks!
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
The solution actually was related to libc.so, specifically the standard template library I was using in Android NDK linking. In my Android.MK file, I was using stlport_shared to link with native opencv library. Opencv actually does not support stlport_shared library, but rather gnu_stl_shared. With the change made, no problems of this type :)
Hope this helps with others who potentially have the same issue linking with other libraries. Always make sure they are compatible.

How to check crash log using android ndk in cocos2d-x

I use cocos2d-x to develop a game, after it runs perfectly in iOs, I turn around to android platform.
But it run somewhere in android, and I only receive some error log like this:
08-26 10:49:23.823: A/libc(2884): Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 2917 (Thread-285)
With this, I can't fix the crash log.
So my question is how can I check the stack of crash log?
And in SO, there are some similar questions, but with none useful answer to me.
Using ndk-stack to read crash logs
Unable to get line no from stack trace in android ndk
How to get Useful crashlog information Android Cocos2dx C++
I find the perfect answer in http://www.cocos2d-x.org/boards/6/topics/20437.
The solution is:
When you get errors like this on the LogCat, they are saved on $PROJECT_PATH/obj/local/armeabi where $PROJECT_PATH is the path to your cocos2d-x android project. To symbolicate the messages to something understandable, you can use the ndk-stack tool.
Open up the Terminal (or Cygwin, not sure though) and type in
cd $ANDROID_NDK
adb logcat | ./ndk-stack -sym $PROJECT_PATH/obj/local/armeabi
where:
$ANDROID_NDK is the path to your android NDK
$PROJECT_PATH is the path to your cocos2d-x android project
And I try it, and get the following stack-trace:
********** Crash dump: **********
Build fingerprint: 'google/soju/crespo:4.1.2/JZO54K/485486:user/release-keys'
pid: 2884, tid: 2917, name: Thread-285 >>> com.gumichina.allen <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000c
Stack frame #00 pc 0062bfb4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+20): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:82
Stack frame #01 pc 006d8094 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchHandler::~CCTouchHandler()+128): Routine ~CCTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:108
Stack frame #02 pc 006d8524 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+84): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193
Stack frame #03 pc 006d8570 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+20): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193
Stack frame #04 pc 0062bff4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+84): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:86
Stack frame #05 pc 006aade4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObjectAtIndex(cocos2d::_ccArray*, unsigned int, bool)+100): Routine ccArrayRemoveObjectAtIndex in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:197
Stack frame #06 pc 006aafa0 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObject(cocos2d::_ccArray*, cocos2d::CCObject*, bool)+72): Routine ccArrayRemoveObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:235
Stack frame #07 pc 0062fed4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCArray::removeObject(cocos2d::CCObject*, bool)+52): Routine removeObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCArray.cpp:295
Stack frame #08 pc 006d6c90 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::forceRemoveDelegate(cocos2d::CCTouchDelegate*)+500): Routine forceRemoveDelegate in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:200
Stack frame #09 pc 006d7888 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int)+1620): Routine touches in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:449
Stack frame #10 pc 006d7b74 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)+56): Routine touchesEnded in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:507
Stack frame #11 pc 0068acb8 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCEGLViewProtocol::handleTouchesEnd(int, int*, float*, float*)+124): Routine handleTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/CCEGLViewProtocol.cpp:333
Stack frame #12 pc 0069340c /mnt/asec/com.gumichina.allen-2/lib/liballen.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd+88): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/android/jni/TouchesJni.cpp:42
Stack frame #13 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #14 pc 0004ce73 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+390)
Stack frame #15 pc 0004ef8f /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+174)
Stack frame #16 pc 00027260 /system/lib/libdvm.so
Stack frame #17 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #18 pc 0005f5b1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
Stack frame #19 pc 0005f5db /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #20 pc 00054193 /system/lib/libdvm.so
Stack frame #21 pc 00012b90 /system/lib/libc.so (__thread_entry+48): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor
Stack frame #22 pc 000122f4 /system/lib/libc.so (pthread_create+172): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor

porting libjingle to Android issue

I found a very strange issue.when I try to invoke connect() in signal1.(sigslot.h).
m_connected_slots.push_back(conn);
it doesn't work.
For example.
std::list<_connection_base1<arg1_type, mt_policy> *> connections_list_test;
connections_list_test.push_back(conn);
If I create a temp list named connections_list_test.It can work and push_back is correctly.
But the m_connected_slots can't push_back.
Obviously I must be hitting some nonstandard behavior in the STL library i'm using.
Can you guys give some suggest about this issue? or some other android porting experience?
Here is some logs for this:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000008c
Stack frame #00 pc 00096f7a /data/data/com.molo.app/lib/libjingle_jni.so: Routine insert in /Users/gongchen/Dev/android-ndk-r8/sources/cxx-stl/stlport/stlport/stl/_list.h:427
Stack frame #01 pc 00098ae8 /data/data/com.molo.app/lib/libjingle_jni.so: Routine MoloClient in /Users/gongchen/Dev/Eclipse_workspace/P2Pdemo/jni/talk/mymolo/moloclient.cc:136
Stack frame #02 pc 00094f54 /data/data/com.molo.app/lib/libjingle_jni.so: Routine Java_com_molo_app_NativeMethod_doLogin in /Users/gongchen/Dev/Eclipse_workspace/P2Pdemo/jni/com_molo_app_NativeMethod.cc:215
Stack frame #03 pc 00017d74 /system/lib/libdvm.so
Stack frame #04 pc 00048f54 /system/lib/libdvm.so
Stack frame #05 pc 00041b16 /system/lib/libdvm.so
Stack frame #06 pc 0004e624 /system/lib/libdvm.so
Stack frame #07 pc 0001cfd4 /system/lib/libdvm.so
Stack frame #08 pc 000220dc /system/lib/libdvm.so
Stack frame #09 pc 00020fd0 /system/lib/libdvm.so
Stack frame #10 pc 0005f430 /system/lib/libdvm.so
Stack frame #11 pc 0005f656 /system/lib/libdvm.so
Stack frame #12 pc 00053b4e /system/lib/libdvm.so
Stack frame #13 pc 00011a7c /system/lib/libc.so
Stack frame #14 pc 00011640 /system/lib/libc.so

Categories

Resources