[Lldb-commits] [PATCH] D99535: [lldb] Print stack trace when lldb-vscode crashes

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 29 13:20:26 PDT 2021


JDevlieghere created this revision.
JDevlieghere added reviewers: teemperor, clayborg, wallace.
JDevlieghere requested review of this revision.

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`.


https://reviews.llvm.org/D99535

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


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ 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 @@
 }
 
 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();
Index: lldb/tools/lldb-server/lldb-server.cpp
===================================================================
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@
 // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99535.333969.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210329/8a3e296b/attachment.bin>


More information about the lldb-commits mailing list