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

Unified Diff: Source/platform/heap/Heap.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/platform/heap/Heap.h ('k') | Source/wtf/Assertions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index 5d6ff063e6de245e9a040cce3ef058e9371e1213..df3f5a8bbd44807645c43051be3791784e1455f8 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -1472,10 +1472,12 @@ public:
static void dumpPathToObjectFromObjectGraph(const ObjectGraph& graph, uintptr_t target)
{
- fprintf(stderr, "Path to %lx of %s\n", target, classOf(reinterpret_cast<const void*>(target)).ascii().data());
ObjectGraph::const_iterator it = graph.find(target);
+ if (it == graph.end())
+ return;
+ fprintf(stderr, "Path to %lx of %s\n", target, classOf(reinterpret_cast<const void*>(target)).ascii().data());
while (it != graph.end()) {
- fprintf(stderr, "<- %lx of %s\n", it->value.first, it->value.second.ascii().data());
+ fprintf(stderr, "<- %lx of %s\n", it->value.first, it->value.second.utf8().data());
it = graph.find(it->value.first);
}
fprintf(stderr, "\n");
@@ -1607,6 +1609,41 @@ void Heap::dumpPathToObjectOnNextGC(void* p)
{
static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p);
}
+
+String Heap::createBacktraceString()
+{
+ int framesToShow = 3;
+ int stackFrameSize = 16;
+ ASSERT(stackFrameSize >= framesToShow);
+ typedef void* FramePointer;
+ FramePointer* stackFrame = static_cast<FramePointer*>(alloca(sizeof(FramePointer) * stackFrameSize));
+ WTFGetBacktrace(stackFrame, &stackFrameSize);
+
+ StringBuilder builder;
+ builder.append("Persistent");
+ bool didAppendFirstName = false;
+ // Skip frames before/including "WebCore::Persistent".
+ bool didSeePersistent = false;
+ for (int i = 0; i < stackFrameSize && framesToShow > 0; ++i) {
+ FrameToNameScope frameToName(stackFrame[i]);
+ if (!frameToName.nullableName())
+ continue;
+ if (strstr(frameToName.nullableName(), "WebCore::Persistent")) {
+ didSeePersistent = true;
+ continue;
+ }
+ if (!didSeePersistent)
+ continue;
+ if (!didAppendFirstName) {
+ didAppendFirstName = true;
+ builder.append(" ... Backtrace:");
+ }
+ builder.append("\n\t");
+ builder.append(frameToName.nullableName());
+ --framesToShow;
+ }
+ return builder.toString().replace("WebCore::", "");
+}
#endif
void Heap::pushTraceCallback(void* object, TraceCallback callback)
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/wtf/Assertions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698