| Index: base/debug/stack_trace_posix.cc
|
| diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
|
| index da86bdc059b303634fb4db5e9eb957cc7a10e6a7..ebd18525b9ae73675995bc4d44af960f378627a7 100644
|
| --- a/base/debug/stack_trace_posix.cc
|
| +++ b/base/debug/stack_trace_posix.cc
|
| @@ -16,6 +16,7 @@
|
| #include <sys/types.h>
|
| #include <unistd.h>
|
|
|
| +#include <algorithm>
|
| #include <map>
|
| #include <memory>
|
| #include <ostream>
|
| @@ -716,14 +717,16 @@ bool EnableInProcessStackDumping() {
|
| return success;
|
| }
|
|
|
| -StackTrace::StackTrace() {
|
| - // NOTE: This code MUST be async-signal safe (it's used by in-process
|
| - // stack dumping signal handler). NO malloc or stdio is allowed here.
|
| +StackTrace::StackTrace(size_t count) {
|
| +// NOTE: This code MUST be async-signal safe (it's used by in-process
|
| +// stack dumping signal handler). NO malloc or stdio is allowed here.
|
|
|
| #if !defined(__UCLIBC__)
|
| + count = std::min(arraysize(trace_), count);
|
| +
|
| // Though the backtrace API man page does not list any possible negative
|
| // return values, we take no chance.
|
| - count_ = base::saturated_cast<size_t>(backtrace(trace_, arraysize(trace_)));
|
| + count_ = base::saturated_cast<size_t>(backtrace(trace_, count));
|
| #else
|
| count_ = 0;
|
| #endif
|
|
|