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
 #include
 #endif
-
+#include
 #include
 
 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();

你可能感兴趣的:(android,c++,开发语言)