[Lldb-commits] [lldb] [LLDB][lldb-dap][vscode-lldb] Add Environment configuration for the lldb-dap process (PR #108948)

via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 17 12:44:15 PDT 2024


https://github.com/serby2000 updated https://github.com/llvm/llvm-project/pull/108948

>From 30e1a6fdc39f637095eec89584f6b163bc53037d Mon Sep 17 00:00:00 2001
From: Serby <serbanus2000 at yahoo.com>
Date: Tue, 17 Sep 2024 12:19:36 +0300
Subject: [PATCH 1/2] vscode-lldb - Add Environment configuration for the
 lldb-dap process

---
 lldb/tools/lldb-dap/package-lock.json   |  4 ++--
 lldb/tools/lldb-dap/package.json        | 11 ++++++++++-
 lldb/tools/lldb-dap/src-ts/extension.ts | 11 +++++++++--
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/lldb/tools/lldb-dap/package-lock.json b/lldb/tools/lldb-dap/package-lock.json
index 96570e42dbfdc4..8663659715590a 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.4",
+  "version": "0.2.6",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "lldb-dap",
-      "version": "0.2.4",
+      "version": "0.2.6",
       "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 d35accfb6ec4e8..cbe098b6fc7e37 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.5",
+  "version": "0.2.6",
   "publisher": "llvm-vs-code-extensions",
   "homepage": "https://lldb.llvm.org",
   "description": "LLDB debugging from VSCode",
@@ -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"
+          }
         }
       }
     },
diff --git a/lldb/tools/lldb-dap/src-ts/extension.ts b/lldb/tools/lldb-dap/src-ts/extension.ts
index fdc4f47b238b5a..36d3dfba18c142 100644
--- a/lldb/tools/lldb-dap/src-ts/extension.ts
+++ b/lldb/tools/lldb-dap/src-ts/extension.ts
@@ -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,
@@ -36,6 +42,7 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
             ...packageJSONExecutable.options,
             env: {
               ...packageJSONExecutable.options?.env,
+              ...configEnvironment,
               ...env,
             },
           },

>From 29bc146ff5c0f6ee00b17cb3b4df4f503e1addf5 Mon Sep 17 00:00:00 2001
From: Serban <serbyme-git at yahoo.com>
Date: Tue, 17 Sep 2024 16:23:41 +0300
Subject: [PATCH 2/2] Update lldb/tools/lldb-dap/package.json

Whitespaces instead of tabs for indentation in package.json

Co-authored-by: Adrian Vogelsgesang <adrian.vogelsgesang at tum.de>
---
 lldb/tools/lldb-dap/package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index cbe098b6fc7e37..33b09d56ab17e2 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -79,7 +79,7 @@
           "type": "string",
           "description": "The log path for lldb-dap (if any)"
         },
-		"lldb-dap.environment": {
+        "lldb-dap.environment": {
           "scope": "resource",
           "type": "object",
           "default": {},



More information about the lldb-commits mailing list