| Index: base/debug/stack_trace.cc
|
| diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
|
| index af4a6efc3ed2f60f3b7a04b2f592e9e886726dfc..43a23d95ac10ba0ca270a654cf1525a59b55ab58 100644
|
| --- a/base/debug/stack_trace.cc
|
| +++ b/base/debug/stack_trace.cc
|
| @@ -35,7 +35,7 @@ namespace debug {
|
|
|
| namespace {
|
|
|
| -#if HAVE_TRACE_STACK_FRAME_POINTERS
|
| +#if HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_WIN)
|
|
|
| #if defined(__arm__) && defined(__GNUC__) && !defined(__clang__)
|
| // GCC and LLVM generate slightly different frames on ARM, see
|
| @@ -142,7 +142,7 @@ void* LinkStackFrames(void* fpp, void* parent_fp) {
|
| return prev_parent_fp;
|
| }
|
|
|
| -#endif // HAVE_TRACE_STACK_FRAME_POINTERS
|
| +#endif // HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_WIN)
|
|
|
| } // namespace
|
|
|
| @@ -225,6 +225,18 @@ std::string StackTrace::ToString() const {
|
| size_t TraceStackFramePointers(const void** out_trace,
|
| size_t max_depth,
|
| size_t skip_initial) {
|
| +// TODO(699863): Merge the frame-pointer based stack unwinder into the
|
| +// base::debug::StackTrace platform-specific implementation files.
|
| +#if defined(OS_WIN)
|
| + 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 * sizeof(void*));
|
| + 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.
|
| @@ -258,8 +270,10 @@ size_t TraceStackFramePointers(const void** out_trace,
|
| }
|
|
|
| return depth;
|
| +#endif
|
| }
|
|
|
| +#if !defined(OS_WIN)
|
| ScopedStackFrameLinker::ScopedStackFrameLinker(void* fp, void* parent_fp)
|
| : fp_(fp),
|
| parent_fp_(parent_fp),
|
| @@ -270,6 +284,7 @@ ScopedStackFrameLinker::~ScopedStackFrameLinker() {
|
| CHECK_EQ(parent_fp_, previous_parent_fp)
|
| << "Stack frame's parent pointer has changed!";
|
| }
|
| +#endif // !defined(OS_WIN)
|
|
|
| #endif // HAVE_TRACE_STACK_FRAME_POINTERS
|
|
|
|
|