https://github.com/vogelsgesang created https://github.com/llvm/llvm-project/pull/103482
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. >From 6c9da388efecf0e33acd6678081bfb04aca4939f Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang <avogelsges...@salesforce.com> Date: Tue, 13 Aug 2024 00:34:42 +0000 Subject: [PATCH] [lldb-dap] Expose log path in extension settings 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. --- lldb/tools/lldb-dap/package-lock.json | 4 ++-- lldb/tools/lldb-dap/package.json | 7 ++++++- lldb/tools/lldb-dap/src-ts/extension.ts | 26 ++++++++++++++++++++----- 3 files changed, 29 insertions(+), 8 deletions(-) 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; }, }; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits