summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-03-22 04:15:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-03-22 04:15:33 +0000
commit7133f8638e105548f6cca66a0ba9a6951993b7de (patch)
tree0674b016136a1d891fcf6303444a41f980bf486e /libs
parent50210b9a8d19cb90fc283d8d99e46cd34ac17d2e (diff)
parentcab25d680e644d962041d05a319e485b96136a5d (diff)
downloadframeworks_native-7133f8638e105548f6cca66a0ba9a6951993b7de.zip
frameworks_native-7133f8638e105548f6cca66a0ba9a6951993b7de.tar.gz
frameworks_native-7133f8638e105548f6cca66a0ba9a6951993b7de.tar.bz2
Merge "improved CallStack a bit" into jb-mr2-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/IMemory.cpp4
-rw-r--r--libs/ui/Region.cpp4
-rw-r--r--libs/utils/CallStack.cpp11
-rw-r--r--libs/utils/RefBase.cpp12
4 files changed, 15 insertions, 16 deletions
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index cd2451a..07cb41a 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -246,9 +246,7 @@ BpMemoryHeap::~BpMemoryHeap() {
if (VERBOSE) {
ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d",
binder.get(), this, mSize, mHeapId);
- CallStack stack;
- stack.update();
- stack.dump("callstack");
+ CallStack stack(LOG_TAG);
}
munmap(mBase, mSize);
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 1a613f8..488fba3 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -530,9 +530,7 @@ bool Region::validate(const Region& reg, const char* name, bool silent)
}
if (result == false && !silent) {
reg.dump(name);
- CallStack stack;
- stack.update();
- stack.dump("");
+ CallStack stack(LOG_TAG);
}
return result;
}
diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp
index 66fabeb..e60f5d8 100644
--- a/libs/utils/CallStack.cpp
+++ b/libs/utils/CallStack.cpp
@@ -30,6 +30,11 @@ CallStack::CallStack() :
mCount(0) {
}
+CallStack::CallStack(const char* logtag, int32_t ignoreDepth, int32_t maxDepth) {
+ this->update(ignoreDepth+1, maxDepth);
+ this->dump(logtag);
+}
+
CallStack::CallStack(const CallStack& rhs) :
mCount(rhs.mCount) {
if (mCount) {
@@ -96,7 +101,7 @@ void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) {
mCount = count > 0 ? count : 0;
}
-void CallStack::dump(const char* prefix) const {
+void CallStack::dump(const char* logtag, const char* prefix) const {
backtrace_symbol_t symbols[mCount];
get_backtrace_symbols(mStack, mCount, symbols);
@@ -104,7 +109,9 @@ void CallStack::dump(const char* prefix) const {
char line[MAX_BACKTRACE_LINE_LENGTH];
format_backtrace_line(i, &mStack[i], &symbols[i],
line, MAX_BACKTRACE_LINE_LENGTH);
- ALOGD("%s%s", prefix, line);
+ ALOG(LOG_DEBUG, logtag, "%s%s",
+ prefix ? prefix : "",
+ line);
}
free_backtrace_symbols(symbols, mCount);
}
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index 3d3a595..e538f68 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -110,7 +110,7 @@ public:
char inc = refs->ref >= 0 ? '+' : '-';
ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
#if DEBUG_REFS_CALLSTACK_ENABLED
- refs->stack.dump();
+ refs->stack.dump(LOG_TAG);
#endif
refs = refs->next;
}
@@ -124,16 +124,14 @@ public:
char inc = refs->ref >= 0 ? '+' : '-';
ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
#if DEBUG_REFS_CALLSTACK_ENABLED
- refs->stack.dump();
+ refs->stack.dump(LOG_TAG);
#endif
refs = refs->next;
}
}
if (dumpStack) {
ALOGE("above errors at:");
- CallStack stack;
- stack.update();
- stack.dump();
+ CallStack stack(LOG_TAG);
}
}
@@ -269,9 +267,7 @@ private:
ref = ref->next;
}
- CallStack stack;
- stack.update();
- stack.dump();
+ CallStack stack(LOG_TAG);
}
}