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
diff --git a/lldb/source/Utility/LLDBAssert.cpp b/lldb/source/Utility/LLDBAssert.cpp
index 875dd51..c11c24b 100644
--- a/lldb/source/Utility/LLDBAssert.cpp
+++ b/lldb/source/Utility/LLDBAssert.cpp
@@ -8,9 +8,12 @@
//===----------------------------------------------------------------------===//
#include "lldb/Utility/LLDBAssert.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Host/Host.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Signals.h"
+
+using namespace llvm;
using namespace lldb_private;
void
@@ -24,15 +27,10 @@
;
else
{
- StreamString stream;
- stream.Printf("Assertion failed: (%s), function %s, file %s, line %u\n",
- expr_text,
- func,
- file,
- line);
- stream.Printf("backtrace leading to the failure:\n");
- Host::Backtrace(stream, 1000);
- stream.Printf("please file a bug report against lldb reporting this failure log, and as many details as possible\n");
- printf("%s\n", stream.GetData());
+ errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
+ expr_text, func, file, line);
+ errs() << "backtrace leading to the failure:\n";
+ llvm::sys::PrintStackTrace(errs());
+ errs() << "please file a bug report against lldb reporting this failure log, and as many details as possible\n";
}
}