Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92
像Java, C++带类继承,有时候分析流程会找晕,可以通过dump callstack快速了解调用过程
Java中:
Log.e("kris",Log.getStackTraceString(new Throwable()));
C++中:
#include <utils/CallStack.h>
android::CallStack cs("kris");
android.mk
LOCAL_SHARED_LIBRARIES := \
libutils \
Kernel中:
dump_stack();
Java和C++ log示例如下:
kris@:~/rk3288/frameworks/base$ adb logcat -s kris
--------- beginning of main
--------- beginning of system
01-06 07:53:13.505 555 555 E kris : java.lang.Throwable
01-06 07:53:13.505 555 555 E kris : at com.android.server.camera.CameraService.notifyMediaserverLocked(CameraService.java:263)
01-06 07:53:13.505 555 555 E kris : at com.android.server.camera.CameraService.switchUserLocked(CameraService.java:228)
01-06