Android系统下打印函数调用栈信息 c++打印

一、需要添加3部分

1、依赖的库

libutilscallstack.so

Android.mk下添加LOCAL_SHARED_LIBRARIES := libdl libdisplaydebug libsdmutils libutilscallstack

如果不添加对libutilscallstack.so的引用,出现以下错误

hardware/qcom/display/sdm/libs/core/display_base.cpp:41:10: fatal error: ‘utils/CallStack.h’ file not found
#include
^~~~~~~~~~~~~~~~~~~

ld.lld: error: undefined symbol: android::CallStack::CallStack()

referenced by display_base.cpp:549 (hardware/qcom/display/sdm/libs/core/display_base.cpp:549)
out/target/product/trinket/obj/SHARED_LIBRARIES/libsdmcore_intermediates/display_base.o:(sdm::DisplayBase::SetDisplayState(sdm::DisplayState, bool, int*))

ld.lld: error: undefined symbol: android::CallStack::update(int, int)

referenced by display_base.cpp:550 (hardware/qcom/display/sdm/libs/core/display_base.cpp:550)
out/target/product/trinket/obj/SHARED_LIBRARIES/libsdmcore_intermediates/display_base.o:(sdm::DisplayBase::SetDisplayState(sdm::DisplayState, bool, int*))

ld.lld: error: undefined symbol: android::CallStack::dump(int, int, char const*) const

referenced by display_base.cpp:551 (hardware/qcom/display/sdm/libs/core/display_base.cpp:551)
out/target/product/trinket/obj/SHARED_LIBRARIES/libsdmcore_intermediates/display_base.o:(sdm::DisplayBase::SetDisplayState(sdm::DisplayState, bool, int*))

ld.lld: error: undefined symbol: android::CallStack::log(char const*, android_LogPriority, char const*) const

referenced by display_base.cpp:552 (hardware/qcom/display/sdm/libs/core/display_base.cpp:552)
out/target/product

你可能感兴趣的:(android,c++,android,studio)