[Lldb-commits] [lldb] [lldb-dap] Allow providing debug adapter arguments in the extension (PR #129262)

Matthew Bastien via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 7 15:06:29 PST 2025


================
@@ -137,53 +157,59 @@ export class LLDBDapDescriptorFactory
 
     const dbgOptions = {
       env: {
-        ...executable?.options?.env,
         ...configEnvironment,
         ...env,
       },
     };
-    const dbgArgs = executable?.args ?? [];
----------------
matthewbastien wrote:

Alright, this took a bit of re-organizing since the `DebugAdapterDescriptorFactory` does not gracefully stop the debug session if it returns `undefined`. Instead, VS Code shows a modal with an error message that suggests that the extension may not have activated properly which is... unhelpful in this case.

I've moved the logic for starting the server and prompting the user for input to a new `DebugConfigurationProvider` which can stop the session gracefully and even open the `launch.json` for editing if something goes wrong.

In order to facilitate this, I had to add two new properties to the launch configuration that are used by the `DebugAdapterDescriptorFactory` to tell VS Code how to launch the debug adapter:

- `debugAdapterHostname` - the hostname for an existing lldb-dap server
- `debugAdapterPort `- the port for an existing lldb-dap server

This has the added bonus of allowing the user to start their own lldb-dap process in server mode if they really wanted to.

The `DebugAdapterDescriptorFactory` will also throw an error if the executable parameter is set.

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


More information about the lldb-commits mailing list