android c++打印堆栈
比如在BufferQueueConsumer.cpp打印堆栈
diff --git a/frameworks/native/libs/gui/Android.bp b/frameworks/native/libs/gui/Android.bp
index f734582377..b86ad34ee2 100644
--- a/frameworks/native/libs/gui/Android.bp
+++ b/frameworks/native/libs/gui/Android.bp
@@ -146,6 +146,8 @@ cc_defaults {
???????? "libbufferhub",
???????? "libbufferhubqueue", // TODO(b/70046255): Remove this once BufferHub is integrated into libgui.
???????? "libinput",
+??????? "libutils",
+??????? "libutilscallstack",
???????? "libpdx_default_transport",
???? ],
?
frameworks/native/libs/gui/BufferQueueConsumer.cpp
diff --git a/frameworks/native/libs/gui/BufferQueueConsumer.cpp b/frameworks/native/libs/gui/BufferQueueConsumer.cpp
index 638282a600..b3684d2fe9 100644
--- a/frameworks/native/libs/gui/BufferQueueConsumer.cpp
+++ b/frameworks/native/libs/gui/BufferQueueConsumer.cpp
@@ -39,7 +39,7 @@
?#include <binder/PermissionCache.h>
?#include <vndksupport/linker.h>
?#endif
-
+#include <utils/CallStack.h>
?#include <system/window.h>
?
?namespace android {
@@ -544,7 +544,9 @@ status_t BufferQueueConsumer::disconnect() {
???????? BQ_LOGE("disconnect: no consumer is connected");
???????? return BAD_VALUE;
???? }
-
+??? CallStack stack("disconnect");
+??? stack.update();
+??? stack.log("disconnect",ANDROID_LOG_ERROR,"");
???? mCore->mIsAbandoned = true;
???? mCore->mConsumerListener = nullptr;
???? mCore->mQueue.clear();
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!