summaryrefslogtreecommitdiffstats
path: root/libs/utils/CallStack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils/CallStack.cpp')
-rw-r--r--libs/utils/CallStack.cpp11
1 files changed, 9 insertions, 2 deletions
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);
}