[Lldb-commits] [lldb] [lldb-dap] Expose log path in extension settings (PR #103482)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 13 15:24:05 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Adrian Vogelsgesang (vogelsgesang)
<details>
<summary>Changes</summary>
lldb-dap already supports a log file which can be enabled by setting the `LLDBDAP_LOG` environment variable. With this commit, the log location can be set directly through the VS-Code extension settings.
Also, this commit bumps the version number, such that the new VS Code extension gets published to the Marketplace.
---
Full diff: https://github.com/llvm/llvm-project/pull/103482.diff
3 Files Affected:
- (modified) lldb/tools/lldb-dap/package-lock.json (+2-2)
- (modified) lldb/tools/lldb-dap/package.json (+6-1)
- (modified) lldb/tools/lldb-dap/src-ts/extension.ts (+21-5)
``````````diff
diff --git a/lldb/tools/lldb-dap/package-lock.json b/lldb/tools/lldb-dap/package-lock.json
index 8c70cc2d30e144..96570e42dbfdc4 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "lldb-dap",
- "version": "0.2.0",
+ "version": "0.2.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "lldb-dap",
- "version": "0.2.0",
+ "version": "0.2.4",
"license": "Apache 2.0 License with LLVM exceptions",
"devDependencies": {
"@types/node": "^18.11.18",
diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index 97e4efe7bac19d..4f4261d1718c01 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -1,7 +1,7 @@
{
"name": "lldb-dap",
"displayName": "LLDB DAP",
- "version": "0.2.3",
+ "version": "0.2.4",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://lldb.llvm.org",
"description": "LLDB debugging from VSCode",
@@ -73,6 +73,11 @@
"scope": "resource",
"type": "string",
"description": "The path to the lldb-dap binary."
+ },
+ "lldb-dap.log-path": {
+ "scope": "resource",
+ "type": "string",
+ "description": "The log path for lldb-dap (if any)"
}
}
},
diff --git a/lldb/tools/lldb-dap/src-ts/extension.ts b/lldb/tools/lldb-dap/src-ts/extension.ts
index 791175f7b46224..7df09f7a29dad7 100644
--- a/lldb/tools/lldb-dap/src-ts/extension.ts
+++ b/lldb/tools/lldb-dap/src-ts/extension.ts
@@ -14,13 +14,29 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
session: vscode.DebugSession,
packageJSONExecutable: vscode.DebugAdapterExecutable | undefined,
): Promise<vscode.DebugAdapterExecutable | undefined> {
- const path = vscode.workspace
- .getConfiguration("lldb-dap", session.workspaceFolder)
- .get<string>("executable-path");
+ const config = vscode.workspace
+ .getConfiguration("lldb-dap", session.workspaceFolder);
+ const path = config.get<string>("executable-path");
+ const log_path = config.get<string>("log-path");
+
+ let env : { [key: string]: string } = {};
+ if (log_path) {
+ env["LLDBDAP_LOG"] = log_path;
+ }
+
if (path) {
- return new vscode.DebugAdapterExecutable(path, []);
+ return new vscode.DebugAdapterExecutable(path, [], {env});
+ } else if (packageJSONExecutable) {
+ return new vscode.DebugAdapterExecutable(packageJSONExecutable.command, packageJSONExecutable.args, {
+ ...packageJSONExecutable.options,
+ env: {
+ ...packageJSONExecutable.options?.env,
+ ...env
+ }
+ });
+ } else {
+ return undefined;
}
- return packageJSONExecutable;
},
};
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/103482
More information about the lldb-commits
mailing list