[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
Adrian Vogelsgesang via lldb-commits
lldb-commits at lists.llvm.org
Sat Nov 16 06:48:59 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()) {
----------------
vogelsgesang wrote:
we might want to handle the case that the user specified both a `portno` and a `socket_path`?
Does it make sense to listen on both? Does it maybe also make sense to listen on multiple ports and multiple socket paths? Or should we report an error if both a port and a socket are specified?
https://github.com/llvm/llvm-project/pull/116392
More information about the lldb-commits
mailing list