This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb7e2c2acb8ee: [lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger (authored by JDevlieghere). Herald added a project: LLDB.
Changed prior to commit: https://reviews.llvm.org/D99702?vs=334586&id=334588#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99702/new/ https://reviews.llvm.org/D99702 Files: 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 @@ -44,6 +44,7 @@ #include <vector> #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/ScopeExit.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" @@ -3112,6 +3113,10 @@ // Initialize LLDB first before we do anything. lldb::SBDebugger::Initialize(); + // Terminate the debugger before the C++ destructor chain kicks in. + auto terminate_debugger = + llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); }); + RegisterRequestCallbacks(); int portno = -1; @@ -3165,8 +3170,5 @@ ++packet_idx; } - // We must terminate the debugger in a thread before the C++ destructor - // chain messes everything up. - lldb::SBDebugger::Terminate(); return EXIT_SUCCESS; }
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp =================================================================== --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -44,6 +44,7 @@ #include <vector> #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/ScopeExit.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" @@ -3112,6 +3113,10 @@ // Initialize LLDB first before we do anything. lldb::SBDebugger::Initialize(); + // Terminate the debugger before the C++ destructor chain kicks in. + auto terminate_debugger = + llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); }); + RegisterRequestCallbacks(); int portno = -1; @@ -3165,8 +3170,5 @@ ++packet_idx; } - // We must terminate the debugger in a thread before the C++ destructor - // chain messes everything up. - lldb::SBDebugger::Terminate(); return EXIT_SUCCESS; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits