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

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: Backtrace 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
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index 5d6ff063e6de245e9a040cce3ef058e9371e1213..72db0042679745f777c1af6f30db7bd97e194e8e 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,37 @@ void Heap::dumpPathToObjectOnNextGC(void* p)
{
static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p);
}
+
+String Heap::createBacktraceString()
+{
+ // Skip the followings:
+ // - WTFGetBacktrace
+ // - Heap::createBacktraceString
+ // - Persistent::recordBacktrace
+ // - Persistent::Persistent
+ const int framesToSkip = 4;
haraken 2014/06/16 01:15:40 It would be better if we could determine this numb
tkent 2014/06/16 02:34:47 Done.
+ const int framesToShow = 4;
+ typedef void* FramePointer;
+ FramePointer* stackFrame = static_cast<FramePointer*>(alloca((framesToShow + framesToSkip) * sizeof(FramePointer)));
+ int stackFrameSize = framesToShow + framesToSkip;
+ WTFGetBacktrace(stackFrame, &stackFrameSize);
+
+ StringBuilder builder;
+ builder.append("Persistent");
+ bool gotFirstName = false;
+ for (int i = framesToSkip; i < stackFrameSize; ++i) {
+ FrameToNameScope frameToName(stackFrame[i]);
+ if (!frameToName.nullableName())
+ continue;
+ if (!gotFirstName) {
+ gotFirstName = true;
+ builder.append(" ... Backtrace:");
+ }
+ builder.append("\n\t");
+ builder.append(frameToName.nullableName());
+ }
+ return builder.toString().replace("WebCore::", "");
+}
#endif
void Heap::pushTraceCallback(void* object, TraceCallback callback)

Powered by Google App Engine
This is Rietveld 408576698