C++层打堆栈

C/C++打函数调用栈

Android.bp文件中引入

    shared_libs: [
        "libcutils",
        "liblog",
        "libutils",
    ],

普通log

#include <android/log.h>
#define LOGI(args...) __android_log_print(ANDROID_LOG_INFO, "YourTag", ##args)

调用栈

#include <utils/CallStack.h>
android::CallStack stack(("djtang"));
11-28 16:40:20.478 28858 29024 D djtang  : #00 pc 01272b2b  /system/b2g/libxul.so (_ZN20GeckoInputDispatcher9notifyKeyEPKN7android13NotifyKeyArgsE+26)
11-28 16:40:20.478 28858 29024 D djtang  : #01 pc 01262205  /system/b2g/libxul.so (_ZN7android19QueuedInputListener5flushEv+34)
11-28 16:40:20.478 28858 29024 D djtang  : #02 pc 01265c51  /system/b2g/libxul.so (_ZN7android11InputReader8loopOnceEv+356)
11-28 16:40:20.478 28858 29024 D djtang  : #03 pc 0126225b  /system/b2g/libxul.so (_ZN7android17InputReaderThread10threadLoopEv+8)
11-28 16:40:20.478 28858 29024 D djtang  : #04 pc 00010079  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+112)
11-28 16:40:20.478 28858 29024 D djtang  : #05 pc 000415cb  /system/lib/libc.so (_ZL15__pthread_startPv+30)
11-28 16:40:20.478 28858 29024 D djtang  : #06 pc 00019265  /system/lib/libc.so (__start_thread+6)

发布了28 篇原创文章 · 获赞 40 · 访问量 4822

猜你喜欢

转载自blog.csdn.net/qq_34211365/article/details/103296492