summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-11-21 21:04:55 -0800
committerAlex Ray <aray@google.com>2013-07-30 13:56:58 -0700
commit11189f5f797ef29ee670ab4683f97c2cfc109899 (patch)
tree5cf6e6ffbf472a8d7a7e28808263e2de4f255d09 /libs
parentf36821289cfa4a1924be4c0800f0e1ac29241c0a (diff)
downloadsystem_core-11189f5f797ef29ee670ab4683f97c2cfc109899.zip
system_core-11189f5f797ef29ee670ab4683f97c2cfc109899.tar.gz
system_core-11189f5f797ef29ee670ab4683f97c2cfc109899.tar.bz2
Use libcorkscrew to format the stack trace.
Change-Id: I3a5439ada76bc77c2dd491eaed2272e16a811cc7
Diffstat (limited to 'libs')
-rw-r--r--libs/utils/CallStack.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp
index b4c581b..c2a5e55 100644
--- a/libs/utils/CallStack.cpp
+++ b/libs/utils/CallStack.cpp
@@ -101,17 +101,10 @@ void CallStack::dump(const char* prefix) const {
get_backtrace_symbols(mStack, mCount, symbols);
for (size_t i = 0; i < mCount; i++) {
- const backtrace_frame_t& frame = mStack[i];
- const backtrace_symbol_t& symbol = symbols[i];
- const char* mapName = symbol.map_name ? symbol.map_name : "<unknown>";
- const char* symbolName = symbol.demangled_name ? symbol.demangled_name : symbol.name;
- if (symbolName) {
- LOGD("%s#%02d pc %08x %s (%s)\n", prefix,
- int(i), uint32_t(symbol.relative_pc), mapName, symbolName);
- } else {
- LOGD("%s#%02d pc %08x %s\n", prefix,
- int(i), uint32_t(symbol.relative_pc), mapName);
- }
+ char line[MAX_BACKTRACE_LINE_LENGTH];
+ format_backtrace_line(i, &mStack[i], &symbols[i],
+ line, MAX_BACKTRACE_LINE_LENGTH);
+ LOGD("%s%s", prefix, line);
}
free_backtrace_symbols(symbols, mCount);
}
@@ -122,17 +115,12 @@ String8 CallStack::toString(const char* prefix) const {
get_backtrace_symbols(mStack, mCount, symbols);
for (size_t i = 0; i < mCount; i++) {
- const backtrace_frame_t& frame = mStack[i];
- const backtrace_symbol_t& symbol = symbols[i];
- const char* mapName = symbol.map_name ? symbol.map_name : "<unknown>";
- const char* symbolName = symbol.demangled_name ? symbol.demangled_name : symbol.name;
- if (symbolName) {
- str.appendFormat("%s#%02d pc %08x %s (%s)\n", prefix,
- int(i), uint32_t(symbol.relative_pc), mapName, symbolName);
- } else {
- str.appendFormat("%s#%02d pc %08x %s\n", prefix,
- int(i), uint32_t(symbol.relative_pc), mapName);
- }
+ char line[MAX_BACKTRACE_LINE_LENGTH];
+ format_backtrace_line(i, &mStack[i], &symbols[i],
+ line, MAX_BACKTRACE_LINE_LENGTH);
+ str.append(prefix);
+ str.append(line);
+ str.append("\n");
}
free_backtrace_symbols(symbols, mCount);
return str;