[Lldb-commits] [lldb] 7898866 - [lldb-dap] Expose log path in extension settings (#103482)

via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 15 04:19:35 PDT 2024


Author: Adrian Vogelsgesang
Date: 2024-08-15T13:19:32+02:00
New Revision: 7898866065f6c9b72b5fa3e45e565baf8a5e7609

URL: https://github.com/llvm/llvm-project/commit/7898866065f6c9b72b5fa3e45e565baf8a5e7609
DIFF: https://github.com/llvm/llvm-project/commit/7898866065f6c9b72b5fa3e45e565baf8a5e7609.diff

LOG: [lldb-dap] Expose log path in extension settings (#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.

Added: 
    

Modified: 
    lldb/tools/lldb-dap/package-lock.json
    lldb/tools/lldb-dap/package.json
    lldb/tools/lldb-dap/src-ts/extension.ts

Removed: 
    


################################################################################
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;
     },
   };
 }


        


More information about the lldb-commits mailing list