[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 22 17:13:13 PST 2024
================
@@ -5028,36 +5218,52 @@ int main(int argc, char *argv[]) {
#endif
// Initialize LLDB first before we do anything.
- lldb::SBDebugger::Initialize();
+ lldb::SBError error = lldb::SBDebugger::InitializeWithErrorHandling();
+ if (error.Fail()) {
+ llvm::errs() << "Failed to initialize LLDB: " << error.GetCString() << "\n";
+ return EXIT_FAILURE;
+ }
// Terminate the debugger before the C++ destructor chain kicks in.
auto terminate_debugger =
llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
- DAP dap = DAP(program_path.str(), default_repl_mode);
+ if (portno != -1) {
+ llvm::errs() << llvm::format("Listening on port %i...\n", portno);
+ return AcceptConnection(program_path.str(), pre_init_commands, log,
+ default_repl_mode, portno);
+ }
+
+ if (!unix_socket_path.empty()) {
----------------
ashgti wrote:
I adjusted this to take a single `--connection` argument that we can use to create a listener for instead of two arguments.
https://github.com/llvm/llvm-project/pull/116392
More information about the lldb-commits
mailing list