https://github.com/charles-zablit created 
https://github.com/llvm/llvm-project/pull/181124

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.

>From 0a348776b7fda66d3de2ae1e0fc62ce15e5db173 Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Thu, 12 Feb 2026 13:01:36 +0100
Subject: [PATCH] [lldb-dap][vscode][windows] check if Python is installed
 properly before starting lldb-dap

---
 lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to