hxcpp icon indicating copy to clipboard operation
hxcpp copied to clipboard

How to got stack trace of null access in a Thread on android

Open hypergeome opened this issue 2 years ago • 0 comments

Hi,

I am having an openfl project that built for android. There is a thread in which there is null access. I put a big try catch insie the thread_func and it does catch null pointer exception, but it is not clear which line cause it.

haxe CallStack.exceptionStack return epmty in this case.

I built it as debug with the following inside project.xml

<define name="openfl-enable-handle-error" if="debug" />
<haxedef name="HXCPP_CHECK_POINTER" if="debug" />  <!--makes null references cause errors-->
<haxedef name="HXCPP_STACK_TRACE" if="debug" />
<haxedef name="HXCPP_STACK_LINE" if="debug" />
<haxedef name="HXCPP_DEBUG_LINK" if="debug" />

I tried to get crash dump on android and it does not show it either, just show till this

********** Crash dump: ********** Build fingerprint: 'samsung/m11qnnxx/m11q:11/RP1A.200720.012/M115FXXU3BVD1:user/release-keys' pid: 6534, tid: 6815, name: SDLThread >>> net.ent.contactmanager <<< signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- Stack frame 05-31 15:55:47.545 6820 6820 F DEBUG : #00 pc 00065668 /apex/com.android.runtime/lib/bionic/libc.so (abort+172) (BuildId: 13bc715234d0861084dc092396cf9938) Stack frame 05-31 15:55:47.546 6820 6820 F DEBUG : #01 pc 0203df3b /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so (__gnu_cxx::__verbose_terminate_handler()+230): Routine __gnu_cxx::__verbose_terminate_handler() at /usr/local/google/buildbot/src/android/ndk-r15-release/toolchain/gcc/gcc-4.9/libstdc++-v3/libsupc++/vterminate.cc:95 Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #02 pc 02012ee1 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so (__cxxabiv1::__terminate(void ()())+4): Routine __cxxabiv1::__terminate(void ()()) at /usr/local/google/buildbot/src/android/ndk-r15-release/toolchain/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_terminate.cc:47 Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #03 pc 02012fe9 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so (std::terminate()+8): Routine std::terminate() at /usr/local/google/buildbot/src/android/ndk-r15-release/toolchain/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_terminate.cc:57 (discriminator 1) Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #04 pc 0201317b /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so (__cxa_throw+110): Routine __cxa_throw at /usr/local/google/buildbot/src/android/ndk-r15-release/toolchain/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_throw.cc:87 Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #05 pc 01e162f8 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so: Routine hx::Throw(Dynamic) at C:/HaxeToolkit/haxe/lib/hxcpp/4,2,1/src/hx/StdLibs.cpp:66 (discriminator 4) Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #06 pc 019b8e64 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so: Routine _hx_run at D:\git\ent\haxe\ContactManager\bin\android\obj/./src/util/_ENTThread/HaxeThread.cpp:129 (discriminator 2) Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #07 pc 019b8f24 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so: Routine __run at D:\git\ent\haxe\ContactManager\bin\android\obj/./src/util/_ENTThread/HaxeThread.cpp:139 Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #08 pc 01df2880 /data/app/~~NjrXS18t4Ysa7VLsTF0gIg==/net.ent.contactmanager-Oial7NoNCEBS9suVVI9BIQ==/lib/arm/libApplicationMain.so: Routine hxThreadFunc(void*) at C:/HaxeToolkit/haxe/lib/hxcpp/4,2,1/src/hx/Thread.cpp:267 (discriminator 2) Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #09 pc 000b0567 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) (BuildId: 13bc715234d0861084dc092396cf9938) Stack frame 05-31 15:55:47.547 6820 6820 F DEBUG : #10 pc 00066b37 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: 13bc715234d0861084dc092396cf9938)

So, not sure how can I get exact line in generated cpp file that does null access. Please help.

hypergeome avatar May 31 '22 09:05 hypergeome