In NDK (Only-native-C++) applications what is the correct way to set a programmatic debug trap? I mean stopping the application with possiblity to examine call stack, variables, etc.
For instance, under WIN32 debug trap in my GameEngine is declared as
#define DIE() __asm{ int 3 }
and for iOS it’s
# if TARGET_IPHONE_SIMULATOR
# define DIE() {__asm__("int3");}
# else
# define DIE() {__asm__("trap");}
# endif
What would be a correct one for an Android NDK application?
__android_log_assert(…) from “android/log.h” should do the work.
This should break you into debugger since it raises SIGTRAP.
See http://mobilepearls.com/labs/native-android-api/ for a usage summary.