[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
Thu Mar 20 15:07:16 PDT 2025


================
@@ -0,0 +1,103 @@
+import * as vscode from "vscode";
+import * as child_process from "child_process";
+import * as util from "util";
+import { LLDBDapServer } from "./lldb-dap-server";
+import { createDebugAdapterExecutable } from "./debug-adapter-factory";
+import { ConfigureButton, showErrorMessage } from "./ui/show-error-message";
+import { ErrorWithNotification } from "./ui/error-with-notification";
+
+const exec = util.promisify(child_process.execFile);
+
+/**
+ * Determines whether or not the given lldb-dap executable supports executing
+ * in server mode.
+ *
+ * @param exe the path to the lldb-dap executable
+ * @returns a boolean indicating whether or not lldb-dap supports server mode
+ */
+async function isServerModeSupported(exe: string): Promise<boolean> {
+  const { stdout } = await exec(exe, ["--help"]);
+  return /--connection/.test(stdout);
+}
+
+export class LLDBDapConfigurationProvider
+  implements vscode.DebugConfigurationProvider
+{
+  constructor(private readonly server: LLDBDapServer) {}
+
+  async resolveDebugConfiguration(
+    folder: vscode.WorkspaceFolder | undefined,
+    debugConfiguration: vscode.DebugConfiguration,
----------------
matthewbastien wrote:

I really like this idea!

Playing around with your code locally, I found that we would also need some more complex validators for things like making sure `debugAdapterPort` and `debugAdapterExecutable` aren't set together. Would also be nice to have some of the validators coerce strings to numbers for things like the port information which accept both.

I think this definitely warrants a separate PR that consolidates the validation logic.

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


More information about the lldb-commits mailing list