I only get stripped binary whenever I build for Android. (It’s always stripped with arm-linux-androideabi-strip)
When I get crash, I cannot get line number with addr2line If I don’t have unstripped binary.
How can I get unstripped binary? It’s useful for debugging.
Is it possible with current hxcpp?
Here’s something else that might do what you want.
<haxedef name="HXCPP_CHECK_POINTER" />
<haxedef name="HXCPP_STACK_LINE" />
This explicitly checks each pointer, and prints stack trace before the app crashes. The stack trace includes Haxe line numbers rather than C++ line numbers.
If that isn’t enough and you need an unstripped binary, open up your .hxcpp_config.xml
file.
First, add this to the “vars” section:
<set name="nostrip" value="1" if="HXCPP_DEBUG_LINK" />
Now check the bottom of the file for an “exes” section. If it isn’t there, create it. Add this to the “exes” section:
<compiler id="android-gcc" exe="arm-linux-androideabi-g++" if="android">
<flag value="-g" if="HXCPP_DEBUG_LINK" />
</compiler>
Finally, set the flag in include.xml:
<haxedef name = "HXCPP_DEBUG_LINK" />
Supposedly, HXCPP_DEBUG_LINK
is enough by itself, but I think they removed it. You could replace it with something else, but I figure this is more future-proof because they might bring it back.
Important note: don’t release the app if you compiled with these options. It will make the app much easier to decompile.
(I assume you knew that already, but other people might not.)
Thanks for your detailed answer!
I’d rather want to send stripped binary to my Android device and keep unstripped binary on desktop computer for debuging, though it appears to be impossible to keep both stripped and unstripped, just by specifying options.
For now I set these options only when I need them.