[Lldb-commits] [lldb] [lldb-dap][vscode][windows] check if Python is installed properly before starting lldb-dap (PR #181124)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 29 04:12:41 PDT 2026
https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/181124
>From 0a348776b7fda66d3de2ae1e0fc62ce15e5db173 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 12 Feb 2026 13:01:36 +0100
Subject: [PATCH 1/2] [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);
>From 4cab18e1a610bf650510a0dd2e5f7d92baa8489d Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Wed, 29 Apr 2026 12:12:24 +0100
Subject: [PATCH 2/2] fixup! [lldb-dap][vscode][windows] check if Python is
installed properly before starting lldb-dap
---
.../lldb-dap/extension/src/lldb-dap-server.ts | 25 ++++++++++++-------
1 file changed, 16 insertions(+), 9 deletions(-)
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 53eaac92d1286..0e9edd44eb76b 100644
--- a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
+++ b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
@@ -60,16 +60,23 @@ export class LLDBDapServer implements vscode.Disposable {
return this.serverInfo;
}
- 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;
- }
+ if (os.platform() === "win32") {
+ const pythonCheckProcess = child_process.spawnSync(dapPath, [
+ "--check-python",
+ ]);
+ if (pythonCheckProcess.status !== 0) {
+ await vscode.window.showErrorMessage(
+ "Python is not installed correctly. Please install it to use lldb-dap.",
+ {
+ modal: true,
+ detail: pythonCheckProcess.stderr?.toString() ?? "",
+ },
+ );
+ return undefined;
}
+ }
+
+ this.serverInfo = new Promise((resolve, reject) => {
const process = child_process.spawn(dapPath, dapArgs, options);
process.on("error", (error) => {
reject(error);
More information about the lldb-commits
mailing list