JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, labath, zturner.
Herald added a reviewer: jfb.
We used to have a pretty stack trace printer in SystemInitializerCommon. This
was disabled on Apple because we didn't want the library to be setting signal
handlers, as this was causing issues when loaded into Xcode. However, I think
it's useful to have this for the LLDB driver, so I moved it up to use the
PrettyStackTraceProgram in the driver's main.
https://reviews.llvm.org/D49377
Files:
source/Initialization/SystemInitializerCommon.cpp
tools/driver/Driver.cpp
Index: tools/driver/Driver.cpp
===================================================================
--- tools/driver/Driver.cpp
+++ 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__)
@@ -1225,6 +1228,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: source/Initialization/SystemInitializerCommon.cpp
===================================================================
--- source/Initialization/SystemInitializerCommon.cpp
+++ 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: tools/driver/Driver.cpp
===================================================================
--- tools/driver/Driver.cpp
+++ 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__)
@@ -1225,6 +1228,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: source/Initialization/SystemInitializerCommon.cpp
===================================================================
--- source/Initialization/SystemInitializerCommon.cpp
+++ 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);
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits