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) |