Skip to content

Commit 30eb193

Browse files
authored
[LLDB][lldb-dap][vscode-lldb] Add Environment configuration for the lldb-dap process (#108948)
Frequently, environment variables such as `LLDB_USE_NATIVE_PDB_READER` are needed to be able to use lldb-dap in vscode This PR adds a way to set the environment for the lldb-dap process using configuration.
1 parent e1b40dc commit 30eb193

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

lldb/tools/lldb-dap/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lldb/tools/lldb-dap/package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lldb-dap",
33
"displayName": "LLDB DAP",
4-
"version": "0.2.5",
4+
"version": "0.2.6",
55
"publisher": "llvm-vs-code-extensions",
66
"homepage": "https://lldb.llvm.org",
77
"description": "LLDB debugging from VSCode",
@@ -78,6 +78,15 @@
7878
"scope": "resource",
7979
"type": "string",
8080
"description": "The log path for lldb-dap (if any)"
81+
},
82+
"lldb-dap.environment": {
83+
"scope": "resource",
84+
"type": "object",
85+
"default": {},
86+
"description": "The environment of the lldb-dap process.",
87+
"additionalProperties": {
88+
"type": "string"
89+
}
8190
}
8291
}
8392
},

lldb/tools/lldb-dap/src-ts/extension.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
2525
if (log_path) {
2626
env["LLDBDAP_LOG"] = log_path;
2727
}
28-
28+
const configEnvironment = config.get<{ [key: string]: string }>("environment") || {};
2929
if (path) {
30-
return new vscode.DebugAdapterExecutable(path, [], { env });
30+
const dbgOptions = {
31+
env: {
32+
...configEnvironment,
33+
...env,
34+
}
35+
};
36+
return new vscode.DebugAdapterExecutable(path, [], dbgOptions);
3137
} else if (packageJSONExecutable) {
3238
return new vscode.DebugAdapterExecutable(
3339
packageJSONExecutable.command,
@@ -36,6 +42,7 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
3642
...packageJSONExecutable.options,
3743
env: {
3844
...packageJSONExecutable.options?.env,
45+
...configEnvironment,
3946
...env,
4047
},
4148
},

0 commit comments

Comments
 (0)