diff options
Diffstat (limited to 'base/debug_util_posix.cc')
-rw-r--r-- | base/debug_util_posix.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc index 7d7aca4..7e74aef 100644 --- a/base/debug_util_posix.cc +++ b/base/debug_util_posix.cc @@ -312,3 +312,12 @@ void StackTrace::OutputToStream(std::ostream* os) { (*os) << "\t" << trace_strings[i] << "\n"; } } + +std::string StackTrace::AsString() { + std::vector<std::string> trace_strings; + std::string output; + GetBacktraceStrings(trace_, count_, &trace_strings, NULL); + for (size_t i = 0; i < trace_strings.size(); ++i) + output += "\t" + trace_strings[i] + "\n"; + return output; +} |