TPEGFX/dump b2g stack
< TPEGFX
Jump to navigation
Jump to search
- Dump kernel call stack
void func()
{
dump_stack()
}
- Dump user-space call stack
android.mk:
LOCAL_SHARED_LIBRARIES += libutils
#include <utils/CallStack.h>
void func()
{
...
android::CallStack stack;
stack.update( );
stack.log("XXX"); // after android 4.4
stack.dump("XXX"); // before android 4.4
...
}
- The log should like
D/bignose ( 8131): #01 pc 00c50c53 /system/b2g/libxul.so D/bignose ( 8131): #02 pc 00b638e5 /system/b2g/libxul.so D/bignose ( 8131): #03 pc 00bbe341 /system/b2g/libxul.so ...
- Use addr2line
cmd:
cat ~/tmp/stackLog.txt | awk '{print "./prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-addr2line --demangle -f -e /Users/bignose/work/mozilla/gecko/git/obj/mozilla_central/gecko_obj-nexus5-l/dist/bin/libxul.so " $6}' | bash
result:
mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*)
/Users/bignose/work/mozilla/gecko/git/obj/mozilla_central/gecko_obj-nexus5-l/dom/bindings/../../../../../mozilla_central/dom/bindings/BindingUtils.cpp:2609
CallJSNative
/Users/bignose/work/mozilla/gecko/git/obj/mozilla_central/gecko_obj-nexus5-l/js/src/../../../../../mozilla_central/js/src/jscntxtinlines.h:235
Interpret
/Users/bignose/work/mozilla/gecko/git/obj/mozilla_central/gecko_obj-nexus5-l/js/src/../../../../../mozilla_central/js/src/vm/Interpreter.cpp:2955
...