[Lldb-commits] [lldb] r337261 - Move pretty stack trace printer into driver.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 17 03:04:19 PDT 2018
Author: jdevlieghere
Date: Tue Jul 17 03:04:19 2018
New Revision: 337261
URL: http://llvm.org/viewvc/llvm-project?rev=337261&view=rev
Log:
Move pretty stack trace printer into driver.
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.
Differential revision: https://reviews.llvm.org/D49377
Modified:
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
Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=337261&r1=337260&r2=337261&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Tue Jul 17 03:04:19 2018
@@ -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 @@ void SystemInitializerCommon::Initialize
}
#endif
-#if not defined(__APPLE__)
- llvm::EnablePrettyStackTrace();
-#endif
Log::Initialize();
HostInfo::Initialize();
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=337261&r1=337260&r2=337261&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Tue Jul 17 03:04:19 2018
@@ -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 @@ main(int argc, char const *argv[])
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>");
Modified: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=337261&r1=337260&r2=337261&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Tue Jul 17 03:04:19 2018
@@ -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 @@ int main(int argc, char const *argv[]) {
#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) {
Modified: lldb/trunk/tools/lldb-server/lldb-server.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-server.cpp?rev=337261&r1=337260&r2=337261&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-server.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-server.cpp Tue Jul 17 03:04:19 2018
@@ -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 @@ static void terminate() { g_debugger_lif
// 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) {
More information about the lldb-commits
mailing list