Print in code

  1. New header file
#include "utils/CallStack.h"
Copy the code
  1. Where you want to print the CallStack
android::CallStack stack(("print callstack")); // The string can be customizedCopy the code
  1. Added shared Libraries to android. mk
LOCAL_SHARED_LIBRARIES += libutilscallStack If necessary, add LOCAL_C_INCLUDES += $(TOP)/system/core/includeCopy the code

Command line printing

debuggerd -b pid
Copy the code

The CMD script prints the Camera Provider CallStack

Adb wait - for - device, the adb's remount set Folder = "Log_ % date: date: ~ 0, 4% % % % ~ 5, 2 date: ~ 8, 2 _ % % time: % % ~ 0, 2 time: ~ % _ % time: 3, 2 ~ 6, 2%" rd  /s /q %Folder%\ mkdir %Folder% adb wait-for-device adb shell "ps -ef | grep camera | grep -v grep | grep android.hardware.camera.provider | awk '{print $2}' | xargs debuggerd -b" > %Folder%\callstack.dumpCopy the code