Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1996)

Unified Diff: Source/wtf/Assertions.cpp

Issue 337653002: Oilpan: GC_TRACING: Improve object path dump (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Skip WebCore::Persistent frames automatically Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Assertions.cpp
diff --git a/Source/wtf/Assertions.cpp b/Source/wtf/Assertions.cpp
index 67c0675af4e072324b121b0f296390474df8da4c..1fcd38350a8513a444a6e6771c33e923ccf64f6a 100644
--- a/Source/wtf/Assertions.cpp
+++ b/Source/wtf/Assertions.cpp
@@ -262,24 +262,38 @@ void WTFReportBacktrace(int framesToShow)
WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip);
}
-void WTFPrintBacktrace(void** stack, int size)
+FrameToNameScope::FrameToNameScope(void* addr)
+ : m_name(0)
+ , m_cxaDemangled(0)
{
- for (int i = 0; i < size; ++i) {
- const char* mangledName = 0;
- char* cxaDemangled = 0;
#if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
- Dl_info info;
- if (dladdr(stack[i], &info) && info.dli_sname)
- mangledName = info.dli_sname;
- if (mangledName)
- cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0);
+ Dl_info info;
+ if (!dladdr(addr, &info) || !info.dli_sname)
+ return;
+ const char* mangledName = info.dli_sname;
+ if ((m_cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0)))
+ m_name = m_cxaDemangled;
+ else
+ m_name = mangledName;
+#else
+ (void)addr;
#endif
+}
+
+FrameToNameScope::~FrameToNameScope()
+{
+ free(m_cxaDemangled);
+}
+
+void WTFPrintBacktrace(void** stack, int size)
+{
+ for (int i = 0; i < size; ++i) {
+ FrameToNameScope frameToName(stack[i]);
const int frameNumber = i + 1;
- if (mangledName || cxaDemangled)
- printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
+ if (frameToName.nullableName())
+ printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], frameToName.nullableName());
else
printf_stderr_common("%-3d %p\n", frameNumber, stack[i]);
- free(cxaDemangled);
}
}
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698