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

Unified Diff: base/debug/stack_trace.cc

Issue 2707223002: Make --enable-heap-profiling=native "work" on Windows. (Closed)
Patch Set: Created 3 years, 10 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 83eb415ec1e0ee631af590e69d258f66d8693e99..f880e906ad49cbe017489d5a4df9cc9d1de72dd4 100644
--- a/base/debug/stack_trace.cc
+++ b/base/debug/stack_trace.cc
@@ -223,6 +223,18 @@ std::string StackTrace::ToString() const {
size_t TraceStackFramePointers(const void** out_trace,
size_t max_depth,
size_t skip_initial) {
+#if defined(OS_WIN)
+ // LOG(ERROR) << "&fp=" << _AddressOfReturnAddress();
+ // LOG(ERROR) << "fp=" << _ReturnAddress();
+ StackTrace stack(max_depth);
+ size_t count = 0;
+ const void* const* frames = stack.Addresses(&count);
+ if (count < skip_initial)
+ return 0u;
+ count -= skip_initial;
+ memcpy(out_trace, frames + skip_initial, count);
+ return count;
+#elif defined(OS_POSIX)
// Usage of __builtin_frame_address() enables frame pointers in this
// function even if they are not enabled globally. So 'fp' will always
// be valid.
@@ -256,6 +268,7 @@ size_t TraceStackFramePointers(const void** out_trace,
}
return depth;
+#endif
}
ScopedStackFrameLinker::ScopedStackFrameLinker(void* fp, void* parent_fp)

Powered by Google App Engine
This is Rietveld 408576698