Skip to content

Commit 047cbfe

Browse files
committed
[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
1 parent 7669455 commit 047cbfe

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lldb/tools/lldb-server/lldb-server.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
5050
// main
5151
int main(int argc, char *argv[]) {
5252
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
53-
llvm::StringRef ToolName = argv[0];
54-
llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
5553
llvm::PrettyStackTraceProgram X(argc, argv);
5654

5755
int option_error = 0;

lldb/tools/lldb-vscode/lldb-vscode.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
#include "llvm/Option/Option.h"
5050
#include "llvm/Support/Errno.h"
5151
#include "llvm/Support/FileSystem.h"
52+
#include "llvm/Support/InitLLVM.h"
5253
#include "llvm/Support/Path.h"
54+
#include "llvm/Support/PrettyStackTrace.h"
5355
#include "llvm/Support/raw_ostream.h"
5456

5557
#include "JSONUtils.h"
@@ -3078,6 +3080,9 @@ void LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg,
30783080
}
30793081

30803082
int main(int argc, char *argv[]) {
3083+
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
3084+
llvm::PrettyStackTraceProgram X(argc, argv);
3085+
30813086
llvm::SmallString<256> program_path(argv[0]);
30823087
llvm::sys::fs::make_absolute(program_path);
30833088
g_vsc.debug_adaptor_path = program_path.str().str();

0 commit comments

Comments
 (0)