Skip to content

Commit 03cc6b2

Browse files
authored
Adding setupCommands to attach configuraitons (#1593)
Addressing #1581
1 parent 8cb05ed commit 03cc6b2

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

Extension/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,31 @@
765765
"default": {}
766766
}
767767
}
768+
},
769+
"setupCommands": {
770+
"type": "array",
771+
"description": "One or more GDB/LLDB commands to execute in order to setup the underlying debugger. Example: \"setupCommands\": [ { \"text\": \"-enable-pretty-printing\", \"description\": \"Enable GDB pretty printing\", \"ignoreFailures\": true }].",
772+
"items": {
773+
"type": "object",
774+
"properties": {
775+
"text": {
776+
"type": "string",
777+
"description": "The debugger command to execute.",
778+
"default": ""
779+
},
780+
"description": {
781+
"type": "string",
782+
"description": "Optional description for the command.",
783+
"default": ""
784+
},
785+
"ignoreFailures": {
786+
"type": "boolean",
787+
"description": "If true, failures from the command should be ignored. Default value is false.",
788+
"default": "false"
789+
}
790+
}
791+
},
792+
"default": []
768793
}
769794
}
770795
}

Extension/src/Debugger/configurations.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalPrope
125125

126126
let body: string = formatString(`{
127127
\t${indentJsonString(CreateAttachString(name, this.miDebugger, this.executable))},
128-
\t"MIMode": "${this.MIMode}"{0}
129-
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : ""]);
128+
\t"MIMode": "${this.MIMode}"{0}{1}
129+
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
130+
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
130131

131132
return {
132133
"label": this.snippetPrefix + name,
@@ -162,12 +163,12 @@ export class PipeTransportConfigurations extends Configuration {
162163
public GetAttachConfiguration(): IConfigurationSnippet {
163164
let name: string = `(${this.MIMode}) Pipe Attach`;
164165

165-
let body: string = `
166+
let body: string = formatString(`
166167
{
167168
\t${indentJsonString(CreateRemoteAttachString(name, this.miDebugger, this.executable))},
168169
\t${indentJsonString(CreatePipeTransportString(this.pipeProgram, this.MIMode))},
169-
\t"MIMode": "${this.MIMode}"
170-
}`;
170+
\t"MIMode": "${this.MIMode}"{0}
171+
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
171172
return {
172173
"label": this.snippetPrefix + name,
173174
"description": `Pipe Attach with ${this.MIMode}.`,
@@ -239,11 +240,11 @@ export class WSLConfigurations extends Configuration {
239240
public GetAttachConfiguration(): IConfigurationSnippet {
240241
let name: string = `(${this.MIMode}) Bash on Windows Attach`;
241242

242-
let body: string = `
243+
let body: string = formatString(`
243244
{
244245
\t${indentJsonString(CreateAttachString(name, this.miDebugger, this.executable))},
245-
\t${indentJsonString(CreatePipeTransportString(this.bashPipeProgram, this.MIMode))}
246-
}`;
246+
\t${indentJsonString(CreatePipeTransportString(this.bashPipeProgram, this.MIMode))}{0}
247+
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
247248

248249
return {
249250
"label": this.snippetPrefix + name,

0 commit comments

Comments
 (0)