Android NDK R8提供四套運行時環境來支持c++特性:
System, gabi++, stlport, gnustl
Gnustl支持 C++exceptions, C++ RTTI, Standard Library. 其他的不一定全支持。
動態調試:
1. 手動添加log.v()
2. 棧跟蹤 new Exception(“print trace”).printStackTrace();
3. DDMS中的Method Profiling Start/Stop Method Profiling
Android.os.Debug.startMethodTracing(“aa”); func();Android.os.Debug.stopMethodTracing
aa.trace將生成在/mnt/sdcard/aa.trace. adb pull /mnt/sdcard/aa.trace.
4. 使用IDA Pro調試android原生程序
Adb shell chmod 755 /data/local/tmp/debugnativeapp
Adb shell chmod 755 /data/local/tmp/android_server
Adb shell /data/local/tmp/android_server
Adb forward tcp:23946 tcp:23946
Menu->Debugger->run->remote ArmLinux/android dbbugger application:/data/local/tmp/debugnativeapp
directory:/data/local/tmp
hostname:localhost port:23946
點OK,ida會遠程執行debugnativeapp並中斷在main入口處。
5. 使用IDA Pro調試android原生動態庫
Adb shell chmod 755 /data/local/tmp/android_server
Adb shell /data/local/tmp/android_server
Adb forward tcp:23946 tcp:23946
Menu->Debugger->Attach->remoteArmLinux/android dbbugger
hostname:localhost port:23946
6. 用gdb代替ida調試