diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json index 9cc653cee405b..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,10 +419,10 @@ }, { "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+=.*)|^\\w+)$" + "pattern": "^\\w+(=.*)?$" }, "default": [] } @@ -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. For example `{ \"FOO\": \"1\" }`", + "patternProperties": { + ".*": { + "type": "string" + } + }, + "default": {} + }, + { + "type": "array", + "markdownDescription": "Additional environment variables to set when launching the debug adapter executable. For example `[\"FOO=1\", \"BAR\"]`", + "items": { + "type": "string", + "pattern": "^\\w+(=.*)?$" + }, + "default": [] + } + ] + }, "program": { "type": "string", "description": "Path to the program to attach to." 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;