Index: base/debug/stack_trace_android.cc |
diff --git a/base/debug/stack_trace_android.cc b/base/debug/stack_trace_android.cc |
index 1e8038568e13bc5058d9d154d22d2110bc52b2cb..329204c8c6a3824fbac6b102a25ab7152ef3addb 100644 |
--- a/base/debug/stack_trace_android.cc |
+++ b/base/debug/stack_trace_android.cc |
@@ -7,6 +7,8 @@ |
#include <android/log.h> |
#include <stddef.h> |
#include <unwind.h> |
+ |
+#include <algorithm> |
#include <ostream> |
#include "base/debug/proc_maps_linux.h" |
@@ -67,8 +69,10 @@ bool EnableInProcessStackDumping() { |
return (sigaction(SIGPIPE, &action, NULL) == 0); |
} |
-StackTrace::StackTrace() { |
- StackCrawlState state(reinterpret_cast<uintptr_t*>(trace_), kMaxTraces); |
+StackTrace::StackTrace(size_t count) { |
+ count = std::min(arraysize(trace_), count); |
+ |
+ StackCrawlState state(reinterpret_cast<uintptr_t*>(trace_), count); |
_Unwind_Backtrace(&TraceStackFrame, &state); |
count_ = state.frame_count; |
} |