diff options
author | Zachary Turner <zturner@google.com> | 2015-03-06 20:45:43 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-03-06 20:45:43 +0000 |
commit | a893d3014b763c20071cd9525428489357850f00 (patch) | |
tree | c951e9dfd9d7904f02e76d2e24809b5b5bb92396 /lldb/source/Core | |
parent | 829c7347d1f51eadf536687b04b0c2e35581d864 (diff) | |
download | bcm5719-llvm-a893d3014b763c20071cd9525428489357850f00.tar.gz bcm5719-llvm-a893d3014b763c20071cd9525428489357850f00.zip |
Remove Host::Backtrace in favor of llvm::sys::PrintStackTrace()
This removes Host::Backtrace from the codebase, and changes all
call sites to use llvm::sys::PrintStackTrace(). This makes the
functionality available for all platforms, and even for platforms
which currently had a supported implementation of Host::Backtrace,
this patch should enable richer information in stack traces, such
as file and line number information, as well as giving it the
ability to unwind through inlined functions.
llvm-svn: 231511
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Log.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Core/Module.cpp | 10 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index fe4cfb366c8..2ac538470a6 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -29,6 +29,8 @@ #include "lldb/Interpreter/Args.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Signals.h" using namespace lldb; using namespace lldb_private; @@ -122,8 +124,13 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args) header.PrintfVarArg (format, args); stream_sp->Printf("%s\n", header.GetData()); - if (m_options.Test (LLDB_LOG_OPTION_BACKTRACE)) - Host::Backtrace (*stream_sp, 1024); + if (m_options.Test(LLDB_LOG_OPTION_BACKTRACE)) + { + std::string back_trace; + llvm::raw_string_ostream stream(back_trace); + llvm::sys::PrintStackTrace(stream); + stream_sp->PutCString(back_trace.c_str()); + } stream_sp->Flush(); } } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 2a1663be5cc..d394118cba7 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -40,6 +40,9 @@ #include "Plugins/ObjectFile/JIT/ObjectFileJIT.h" +#include "llvm/Support/raw_os_ostream.h" +#include "llvm/Support/Signals.h" + using namespace lldb; using namespace lldb_private; @@ -1234,7 +1237,12 @@ Module::LogMessageVerboseBacktrace (Log *log, const char *format, ...) log_message.PrintfVarArg (format, args); va_end (args); if (log->GetVerbose()) - Host::Backtrace (log_message, 1024); + { + std::string back_trace; + llvm::raw_string_ostream stream(back_trace); + llvm::sys::PrintStackTrace(stream); + log_message.PutCString(back_trace.c_str()); + } log->PutCString(log_message.GetString().c_str()); } } |