[Lldb-commits] [lldb] 047cbfe - [lldb] Print stack trace when lldb-vscode crashes

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 29 14:21:07 PDT 2021


Author: Jonas Devlieghere
Date: 2021-03-29T14:20:59-07:00
New Revision: 047cbfe2bbf22a9da1bd27cafcee4eb1453965dc

URL: https://github.com/llvm/llvm-project/commit/047cbfe2bbf22a9da1bd27cafcee4eb1453965dc
DIFF: https://github.com/llvm/llvm-project/commit/047cbfe2bbf22a9da1bd27cafcee4eb1453965dc.diff

LOG: [lldb] Print stack trace when lldb-vscode crashes

Print LLVM's pretty stack trace when lldb-vscode crashes. Also removes
the unnecessary call to PrintStackTraceOnErrorSignal in lldb-server as
it's already part of InitLLVM.

Differential revision: https://reviews.llvm.org/D99535

Added: 
    

Modified: 
    lldb/tools/lldb-server/lldb-server.cpp
    lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-server/lldb-server.cpp b/lldb/tools/lldb-server/lldb-server.cpp
index 749a381ebca0..acf6780524e2 100644
--- a/lldb/tools/lldb-server/lldb-server.cpp
+++ b/lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@ static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 243461780cfd..9a6a0f5b69f0 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@ void LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg,
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();


        


More information about the lldb-commits mailing list