[Lldb-commits] [lldb] [lldb-dap][vscode][windows] check if Python is installed properly before starting lldb-dap (PR #181124)

via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 12 04:03:31 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

This patch runs the `lldb-dap.exe --check-python` command before attempting to start lldb-dap in VSCode.

If the command fails, the extension will print an error and prevent lldb-dap from starting.

---
Full diff: https://github.com/llvm/llvm-project/pull/181124.diff


1 Files Affected:

- (modified) lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts (+10) 


``````````diff
diff --git a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
index deacdea145a41..53eaac92d1286 100644
--- a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
+++ b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
@@ -2,6 +2,7 @@ import { FSWatcher, watch as chokidarWatch } from "chokidar";
 import * as child_process from "node:child_process";
 import { isDeepStrictEqual } from "util";
 import * as vscode from "vscode";
+import * as os from "os";
 
 /**
  * Represents a running lldb-dap process that is accepting connections (i.e. in "server mode").
@@ -60,6 +61,15 @@ export class LLDBDapServer implements vscode.Disposable {
     }
 
     this.serverInfo = new Promise((resolve, reject) => {
+      if (os.platform() === "win32") {
+        const pythonCheckProcess = child_process.spawnSync(dapPath, ["--check-python"]);
+        if (pythonCheckProcess.stderr) {
+          vscode.window.showErrorMessage(
+            `Python is not installed correctly. Please install it to use lldb-dap.\n${pythonCheckProcess.stderr}`
+          );
+          return;
+        }
+      }
       const process = child_process.spawn(dapPath, dapArgs, options);
       process.on("error", (error) => {
         reject(error);

``````````

</details>


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


More information about the lldb-commits mailing list