[Lldb-commits] [lldb] [lldb-dap] Refactoring IOStream into Transport handler. (PR #130026)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 12 10:23:45 PDT 2025


================
@@ -210,12 +209,33 @@ struct DAP {
   // will contain that expression.
   std::string last_nonempty_var_expression;
 
-  DAP(llvm::StringRef client_name, llvm::StringRef path, std::ofstream *log,
-      lldb::IOObjectSP input, lldb::IOObjectSP output, ReplMode repl_mode,
-      std::vector<std::string> pre_init_commands);
+  /// Creates a new DAP sessions.
+  ///
+  /// \param[in] path
+  ///     Path to the lldb-dap binary.
+  /// \param[in] log
+  ///     Log file stream, if configured.
+  /// \param[in] default_repl_mode
+  ///     Default repl mode behavior, as configured by the binary.
+  /// \param[in] pre_init_commands
+  ///     LLDB commands to execute as soon as the debugger instance is allocaed.
+  /// \param[in] client_name
+  ///     Debug session client name, for example 'stdin/stdout' or 'client_1'.
----------------
ashgti wrote:

> What's the reason for moving the `path` and `client_name` apart?

I tried to reorganize the parameters into more constant between DAP sessions to more unique per DAP session. i.e. 

* `path` is basically a constant (its the path to `lldb-dap` itself)
* `log` is also either setup or not at launch
* `default_repl_mode` and `pre_init_commands` are CLI flags that affect the starting conditions of the DAP session
* `client_name` and `transport` are the most unique values for the DAP session.

> If the `client_name` is stored in the `Transport` class, do we need to duplicate it in the `DAP` object? Does it (not) make sense to get it from the transport instance?

I'll update this to access the client name from the transport.

https://github.com/llvm/llvm-project/pull/130026


More information about the lldb-commits mailing list