[Lldb-commits] [PATCH] Change lldb_assert() to use llvm::sys::PrintBacktrace

Zachary Turner zturner at google.com
Wed Mar 4 17:06:38 PST 2015


Hi granata.enrico,

This way we get backtraces on all platforms, and in a consistent format.

http://reviews.llvm.org/D8069

Files:
  source/Utility/LLDBAssert.cpp

Index: source/Utility/LLDBAssert.cpp
===================================================================
--- source/Utility/LLDBAssert.cpp
+++ source/Utility/LLDBAssert.cpp
@@ -8,8 +8,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Utility/LLDBAssert.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Host/Host.h"
+
+#include <stdio.h>
+
+#include "llvm/Support/Signals.h"
 
 using namespace lldb_private;
 
@@ -24,15 +26,13 @@
         ;
     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());
+        fprintf(stderr, "Assertion failed: (%s), function %s, file %s, line %u\n",
+                         expr_text,
+                         func,
+                         file,
+                         line);
+        fprintf(stderr, "backtrace leading to the failure:\n");
+        llvm::sys::PrintStackTrace(stderr);
+        fprintf(stderr, "please file a bug report against lldb reporting this failure log, and as many details as possible\n");
     }
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8069.21246.patch
Type: text/x-patch
Size: 1494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150305/ef03fea3/attachment.bin>


More information about the lldb-commits mailing list