diff --git a/package.json b/package.json index 58ca3e3d..7d1924f8 100644 --- a/package.json +++ b/package.json @@ -108,9 +108,15 @@ }, "debuggerArgs": { "default": [], - "description": "Additional arguments to pass to GDB", + "description": "Additional arguments to pass to GDB command line", "type": "array" - }, + }, + "postLaunchCommands": { + "default": [], + "type": "array", + "items": "string", + "description": "Additional GDB Commands to be executed after the main attach sequequnce has finished. (Machine interface commands should include - prefix)." + }, "device": { "default": "", "description": "Target Device Identifier", @@ -519,9 +525,15 @@ }, "debuggerArgs": { "default": [], - "description": "Additional arguments to pass to GDB", + "description": "Additional arguments to pass to GDB command line", "type": "array" - }, + }, + "postLaunchCommands": { + "default": [], + "type": "array", + "items": "string", + "description": "Additional GDB Commands to be executed after the main attach sequequnce has finished. (Machine interface commands should include - prefix)." + }, "device": { "default": "", "description": "Target Device Identifier", diff --git a/src/common.ts b/src/common.ts index a1bb8876..b5fe1b4d 100644 --- a/src/common.ts +++ b/src/common.ts @@ -58,6 +58,7 @@ export interface ConfigurationArguments extends DebugProtocol.LaunchRequestArgum serverpath: string; device: string; debuggerArgs: string[]; + postLaunchCommands: string[]; svdFile: string; swoConfig: SWOConfiguration; graphConfig: any[]; diff --git a/src/frontend/configprovider.ts b/src/frontend/configprovider.ts index 37209513..57b7a962 100644 --- a/src/frontend/configprovider.ts +++ b/src/frontend/configprovider.ts @@ -54,6 +54,7 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati }); } if (!config.graphConfig) { config.graphConfig = []; } + if (!config.postLaunchCommands) { config.postLaunchCommands = []; } switch (type) { case 'jlink': diff --git a/src/gdb.ts b/src/gdb.ts index d37983ee..a71b2fbb 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -213,6 +213,8 @@ export class GDBDebugSession extends DebugSession { let commands = attach ? this.serverController.attachCommands() : this.serverController.launchCommands(); + commands = commands.concat(this.args.postLaunchCommands.map(c => c.startsWith('-') ? c.substring(1) : `interpreter-exec console "${c}"`)); + this.serverController.debuggerLaunchStarted(); this.miDebugger.connect(this.args.cwd, this.args.executable, commands).then(() => { setTimeout(() => {