| Index: base/debug_util_posix.cc
|
| diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
|
| index dfafc13bfae55a632dae35aa05971aea40082d81..7d7aca4c63687d1851e6baffd76b696805ba6cf8 100644
|
| --- a/base/debug_util_posix.cc
|
| +++ b/base/debug_util_posix.cc
|
| @@ -99,9 +99,11 @@ void DemangleSymbols(std::string* text) {
|
|
|
| // Gets the backtrace as a vector of strings. If possible, resolve symbol
|
| // names and attach these. Otherwise just use raw addresses. Returns true
|
| -// if any symbol name is resolved.
|
| +// if any symbol name is resolved. Returns false on error and *may* fill
|
| +// in |error_message| if an error message is available.
|
| bool GetBacktraceStrings(void **trace, int size,
|
| - std::vector<std::string>* trace_strings) {
|
| + std::vector<std::string>* trace_strings,
|
| + std::string* error_message) {
|
| bool symbolized = false;
|
|
|
| #if defined(USE_SYMBOLIZE)
|
| @@ -130,6 +132,8 @@ bool GetBacktraceStrings(void **trace, int size,
|
| }
|
| symbolized = true;
|
| } else {
|
| + if (error_message)
|
| + *error_message = safe_strerror(errno);
|
| for (int i = 0; i < size; ++i) {
|
| trace_strings->push_back(base::StringPrintf("%p", trace[i]));
|
| }
|
| @@ -282,7 +286,7 @@ void StackTrace::PrintBacktrace() {
|
| #endif
|
| fflush(stderr);
|
| std::vector<std::string> trace_strings;
|
| - GetBacktraceStrings(trace_, count_, &trace_strings);
|
| + GetBacktraceStrings(trace_, count_, &trace_strings, NULL);
|
| for (size_t i = 0; i < trace_strings.size(); ++i) {
|
| std::cerr << "\t" << trace_strings[i] << "\n";
|
| }
|
| @@ -294,11 +298,14 @@ void StackTrace::OutputToStream(std::ostream* os) {
|
| return;
|
| #endif
|
| std::vector<std::string> trace_strings;
|
| - if (GetBacktraceStrings(trace_, count_, &trace_strings)) {
|
| + std::string error_message;
|
| + if (GetBacktraceStrings(trace_, count_, &trace_strings, &error_message)) {
|
| (*os) << "Backtrace:\n";
|
| } else {
|
| - (*os) << "Unable get symbols for backtrace (" << safe_strerror(errno)
|
| - << "). Dumping raw addresses in trace:\n";
|
| + if (!error_message.empty())
|
| + error_message = " (" + error_message + ")";
|
| + (*os) << "Unable to get symbols for backtrace" << error_message << ". "
|
| + << "Dumping raw addresses in trace:\n";
|
| }
|
|
|
| for (size_t i = 0; i < trace_strings.size(); ++i) {
|
|
|