[Lldb-commits] [lldb] [lldb-dap] Support finding the lldb-dap binary (PR #118547)
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 3 14:25:14 PST 2024
================
@@ -28,6 +23,70 @@ export class LLDBDapDescriptorFactory
return true;
}
+ static async findDAPExecutable(): Promise<string | undefined> {
+ let executable = "lldb-dap";
+ if (process.platform === "win32") {
+ executable = "lldb-dap.exe";
+ }
+
+ // Prefer lldb-dap from Xcode on Darwin.
+ if (process.platform === "darwin") {
+ try {
+ const exec = util.promisify(require("child_process").execFile);
+ let { stdout, stderr } = await exec("/usr/bin/xcrun", [
+ "-find",
+ executable,
+ ]);
+ if (stdout) {
+ return stdout.toString().trimEnd();
+ }
+ } catch (error) {}
+ }
+
+ // Find lldb-dap in the user's path.
+ let env_path =
+ process.env["PATH"] ||
+ (process.platform === "win32" ? process.env["Path"] : null);
----------------
walter-erquinigo wrote:
```suggestion
process.platform === "win32" ? process.env["Path"] : process.env["PATH"]
```
https://github.com/llvm/llvm-project/pull/118547
More information about the lldb-commits
mailing list