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

Unified Diff: base/debug/stack_trace.cc

Issue 2361353002: Link stack frames of JNI stubs to JNI callbacks. (Closed)
Patch Set: Simplify - remove FakeStackFrame, etc. Created 4 years, 2 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: base/debug/stack_trace.cc
diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
index f3ffef360f0680a8a36cdabc4fa43c5ee1fc390c..8b95a2c17cff1a0249b5faa1818ac91114efc9e9 100644
--- a/base/debug/stack_trace.cc
+++ b/base/debug/stack_trace.cc
@@ -176,6 +176,17 @@ uintptr_t ScanStackForNextFrame(uintptr_t fp, uintptr_t stack_end) {
return 0;
}
+// Links stack frame |fp| to |parent_fp|, so that during stack unwinding
Primiano Tucci (use gerrit) 2016/10/13 20:03:21 I think you commented this already in the .h. Usua
Dmitry Skiba 2016/10/17 22:09:11 That was for ScopedStackFrameLinker thing, and I r
+// TraceStackFramePointers() visits |parent_fp| after visiting |fp|.
+// Both frame pointers must come from __builtin_frame_address().
+// Returns previous stack frame |fp| was linked to.
+void* LinkStackFrames(void* fpp, void* parent_fp) {
+ uintptr_t fp = reinterpret_cast<uintptr_t>(fpp) - kStackFrameAdjustment;
+ void* prev_parent_fp = reinterpret_cast<void**>(fp)[0];
+ reinterpret_cast<void**>(fp)[0] = parent_fp;
+ return prev_parent_fp;
+}
+
#endif // HAVE_TRACE_STACK_FRAME_POINTERS
} // namespace
@@ -245,6 +256,13 @@ size_t TraceStackFramePointers(const void** out_trace,
return depth;
}
+ScopedStackFrameLinker::ScopedStackFrameLinker(void* fp, void* parent_fp)
+ : fp_(fp), original_parent_fp_(LinkStackFrames(fp, parent_fp)) {}
+
+ScopedStackFrameLinker::~ScopedStackFrameLinker() {
+ LinkStackFrames(fp_, original_parent_fp_);
Primiano Tucci (use gerrit) 2016/10/13 20:03:21 could you add a CHECK here that verifies that the
Dmitry Skiba 2016/10/17 22:09:11 Done.
+}
+
#endif // HAVE_TRACE_STACK_FRAME_POINTERS
} // namespace debug

Powered by Google App Engine
This is Rietveld 408576698