| Index: base/debug/stack_trace.h
|
| diff --git a/base/debug/stack_trace.h b/base/debug/stack_trace.h
|
| index 23e7b5164b63472409a92e992c5c1095dfa48d26..1d73171fa46813635f2123a075610962730ed0f8 100644
|
| --- a/base/debug/stack_trace.h
|
| +++ b/base/debug/stack_trace.h
|
| @@ -102,6 +102,13 @@ class BASE_EXPORT StackTrace {
|
| };
|
|
|
| #if HAVE_TRACE_STACK_FRAME_POINTERS
|
| +
|
| +// Used by TraceStackFramePointers() to store info about the stack.
|
| +struct BASE_EXPORT PerThreadStackInfo {
|
| + PerThreadStackInfo();
|
| + uintptr_t start_address;
|
| +};
|
| +
|
| // Traces the stack by using frame pointers. This function is faster but less
|
| // reliable than StackTrace. It should work for debug and profiling builds,
|
| // but not for release builds (although there are some exceptions).
|
| @@ -110,9 +117,21 @@ class BASE_EXPORT StackTrace {
|
| // after skipping |skip_initial| frames. Note that the function itself is not
|
| // added to the trace so |skip_initial| should be 0 in most cases.
|
| // Returns number of frames written.
|
| -BASE_EXPORT size_t TraceStackFramePointers(const void** out_trace,
|
| - size_t max_depth,
|
| - size_t skip_initial);
|
| +//
|
| +// Note on |stack_info|. By default the function relies on heuristics to check
|
| +// whether a stack pointer is within the stack before dereferencing it. That
|
| +// works, but is not very reliable. Proper way to check that is to ask the OS
|
| +// for the stack info, but that is costly thing to do on each call.
|
| +// This is what |stack_info| is for - it provides a place where function
|
| +// caches info about the stack. Put it in your per-thread data structure, pass
|
| +// into the function, and voila - stack pointers are properly checked without
|
| +// any runtime overhead.
|
| +BASE_EXPORT size_t TraceStackFramePointers(
|
| + const void** out_trace,
|
| + size_t max_depth,
|
| + size_t skip_initial,
|
| + PerThreadStackInfo* stack_info = nullptr);
|
| +
|
| #endif // HAVE_TRACE_STACK_FRAME_POINTERS
|
|
|
| namespace internal {
|
|
|