[Lldb-commits] [PATCH] D49377: Move pretty stack trace printer into driver.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 17 03:09:37 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337261: Move pretty stack trace printer into driver. (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49377?vs=155684&id=155834#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49377

Files:
  lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
  lldb/trunk/tools/driver/Driver.cpp
  lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
  lldb/trunk/tools/lldb-server/lldb-server.cpp


Index: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
===================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
@@ -29,7 +29,6 @@
 #include "lldb/Host/windows/windows.h"
 #endif
 
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/TargetSelect.h"
 
 #include <string>
@@ -63,9 +62,6 @@
   }
 #endif
 
-#if not defined(__APPLE__)
-  llvm::EnablePrettyStackTrace();
-#endif
   Log::Initialize();
   HostInfo::Initialize();
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Index: lldb/trunk/tools/driver/Driver.cpp
===================================================================
--- lldb/trunk/tools/driver/Driver.cpp
+++ lldb/trunk/tools/driver/Driver.cpp
@@ -41,7 +41,10 @@
 #include "lldb/API/SBStringList.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
 #include <thread>
 
 #if !defined(__APPLE__)
@@ -1231,6 +1234,10 @@
   const char **argv = argvPointers.data();
 #endif
 
+  llvm::StringRef ToolName = argv[0];
+  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   SBDebugger::Initialize();
 
   SBHostOS::ThreadCreated("<lldb.driver.main-thread>");
Index: lldb/trunk/tools/lldb-server/lldb-server.cpp
===================================================================
--- lldb/trunk/tools/lldb-server/lldb-server.cpp
+++ lldb/trunk/tools/lldb-server/lldb-server.cpp
@@ -12,7 +12,10 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -45,6 +48,10 @@
 // main
 //----------------------------------------------------------------------
 int main(int argc, char *argv[]) {
+  llvm::StringRef ToolName = argv[0];
+  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   int option_error = 0;
   const char *progname = argv[0];
   if (argc < 2) {
Index: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
@@ -28,6 +28,9 @@
 
 // Third party headers:
 #include "lldb/API/SBHostOS.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
 #include <atomic>
 #include <csignal>
 #include <stdio.h>
@@ -169,6 +172,10 @@
 #endif //  _WIN32
 #endif // MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG
 
+  llvm::StringRef ToolName = argv[0];
+  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   // *** Order is important here ***
   bool bOk = DriverSystemInit();
   if (!bOk) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49377.155834.patch
Type: text/x-patch
Size: 3096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180717/06cc63cf/attachment-0001.bin>


More information about the lldb-commits mailing list