Skip to content

[LLDB][lldb-dap][vscode-lldb] Add Environment configuration for the lldb-dap process #108948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/tools/lldb-dap/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion lldb/tools/lldb-dap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lldb-dap",
"displayName": "LLDB DAP",
"version": "0.2.5",
"version": "0.2.6",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://lldb.llvm.org",
"description": "LLDB debugging from VSCode",
Expand Down Expand Up @@ -78,6 +78,15 @@
"scope": "resource",
"type": "string",
"description": "The log path for lldb-dap (if any)"
},
"lldb-dap.environment": {
"scope": "resource",
"type": "object",
"default": {},
"description": "The environment of the lldb-dap process.",
"additionalProperties": {
"type": "string"
}
}
}
},
Expand Down
11 changes: 9 additions & 2 deletions lldb/tools/lldb-dap/src-ts/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
if (log_path) {
env["LLDBDAP_LOG"] = log_path;
}

const configEnvironment = config.get<{ [key: string]: string }>("environment") || {};
if (path) {
return new vscode.DebugAdapterExecutable(path, [], { env });
const dbgOptions = {
env: {
...configEnvironment,
...env,
}
};
return new vscode.DebugAdapterExecutable(path, [], dbgOptions);
} else if (packageJSONExecutable) {
return new vscode.DebugAdapterExecutable(
packageJSONExecutable.command,
Expand All @@ -36,6 +42,7 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
...packageJSONExecutable.options,
env: {
...packageJSONExecutable.options?.env,
...configEnvironment,
...env,
},
},
Expand Down
Loading