[Lldb-commits] [lldb] [lldb-dap] Add `debugAdapterEnv` for `attach` requests & improve regex (PR #157980)
Roy Shi via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 11 17:49:53 PDT 2025
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/157980
>From 265efab57c62479bb296bd59e0673d9935e9767f Mon Sep 17 00:00:00 2001
From: Roy Shi <royshi at meta.com>
Date: Wed, 10 Sep 2025 17:38:53 -0700
Subject: [PATCH 1/3] [lldb-dap] Add missing `debugAdapterEnv` into `attach`
configuration
---
lldb/tools/lldb-dap/package.json | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index 9cc653cee405b..51b76536cfca5 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -672,6 +672,29 @@
},
"markdownDescription": "The list of additional arguments used to launch the debug adapter executable. Overrides any user or workspace settings."
},
+ "debugAdapterEnv": {
+ "anyOf": [
+ {
+ "type": "object",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `{ \"FOO\": \"1\" }`",
+ "patternProperties": {
+ ".*": {
+ "type": "string"
+ }
+ },
+ "default": {}
+ },
+ {
+ "type": "array",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `[\"FOO=1\", \"BAR\"]`",
+ "items": {
+ "type": "string",
+ "pattern": "^((\\w+=.*)|^\\w+)$"
+ },
+ "default": []
+ }
+ ]
+ },
"program": {
"type": "string",
"description": "Path to the program to attach to."
>From 38ec521eccfdb91a6d43c068b15ec9e6886563ef Mon Sep 17 00:00:00 2001
From: Roy Shi <royshi at meta.com>
Date: Wed, 10 Sep 2025 17:58:11 -0700
Subject: [PATCH 2/3] Improve debugAdapterEnv's regex
---
lldb/tools/lldb-dap/package.json | 4 ++--
lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index 51b76536cfca5..3d8b18bed0108 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -422,7 +422,7 @@
"markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `[\"FOO=1\", \"BAR\"]`",
"items": {
"type": "string",
- "pattern": "^((\\w+=.*)|^\\w+)$"
+ "pattern": "^\\w+(=.*)?$"
},
"default": []
}
@@ -689,7 +689,7 @@
"markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `[\"FOO=1\", \"BAR\"]`",
"items": {
"type": "string",
- "pattern": "^((\\w+=.*)|^\\w+)$"
+ "pattern": "^\\w+(=.*)?$"
},
"default": []
}
diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts
index f7e92ee95ca32..7060638a94864 100644
--- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts
+++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts
@@ -92,7 +92,7 @@ function validateDAPEnv(debugConfigEnv: any): boolean {
Array.isArray(debugConfigEnv) &&
debugConfigEnv.findIndex(
(entry) =>
- typeof entry !== "string" || !/^((\\w+=.*)|^\\w+)$/.test(entry),
+ typeof entry !== "string" || !/^\w+(=.*)?$/.test(entry),
) !== -1
) {
return false;
>From 68fdd63f242d082343c218794dfd428b6b20cd62 Mon Sep 17 00:00:00 2001
From: Roy Shi <royshi at meta.com>
Date: Thu, 11 Sep 2025 17:46:31 -0700
Subject: [PATCH 3/3] Use 'For example ...'
---
lldb/tools/lldb-dap/package.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index 3d8b18bed0108..0290a5f18f800 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -409,7 +409,7 @@
"anyOf": [
{
"type": "object",
- "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `{ \"FOO\": \"1\" }`",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. For example `{ \"FOO\": \"1\" }`",
"patternProperties": {
".*": {
"type": "string"
@@ -419,7 +419,7 @@
},
{
"type": "array",
- "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `[\"FOO=1\", \"BAR\"]`",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. For example `[\"FOO=1\", \"BAR\"]`",
"items": {
"type": "string",
"pattern": "^\\w+(=.*)?$"
@@ -676,7 +676,7 @@
"anyOf": [
{
"type": "object",
- "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `{ \"FOO\": \"1\" }`",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. For example `{ \"FOO\": \"1\" }`",
"patternProperties": {
".*": {
"type": "string"
@@ -686,7 +686,7 @@
},
{
"type": "array",
- "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. E.g. `[\"FOO=1\", \"BAR\"]`",
+ "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. For example `[\"FOO=1\", \"BAR\"]`",
"items": {
"type": "string",
"pattern": "^\\w+(=.*)?$"
More information about the lldb-commits
mailing list