From c831c4d4e4411d666dd068768627198f9ab6c6fd Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Sun, 11 Dec 2016 21:24:55 +0100 Subject: [PATCH] implement debugger_args option --- src/backend/mi2/mi2.ts | 5 +++-- src/gdb.ts | 6 ++++-- src/lldb.ts | 6 ++++-- src/mago.ts | 6 ++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 8785a4f..7840355 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -27,7 +27,7 @@ function couldBeOutput(line: string) { const trace = false; export class MI2 extends EventEmitter implements IBackend { - constructor(public application: string, public preargs: string[]) { + constructor(public application: string, public preargs: string[], public extraargs: string[]) { super(); } @@ -36,7 +36,8 @@ export class MI2 extends EventEmitter implements IBackend { target = nativePath.join(cwd, target); return new Promise((resolve, reject) => { this.isSSH = false; - this.process = ChildProcess.spawn(this.application, this.preargs, { cwd: cwd }); + let args = this.preargs.concat(this.extraargs || []); + this.process = ChildProcess.spawn(this.application, args, { cwd: cwd }); this.process.stdout.on("data", this.stdout.bind(this)); this.process.stderr.on("data", this.stderr.bind(this)); this.process.on("exit", (() => { this.emit("quit"); }).bind(this)); diff --git a/src/gdb.ts b/src/gdb.ts index c4005bc..767c549 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -8,6 +8,7 @@ export interface LaunchRequestArguments { cwd: string; target: string; gdbpath: string; + debugger_args: string[]; arguments: string; terminal: string; autorun: string[]; @@ -20,6 +21,7 @@ export interface AttachRequestArguments { cwd: string; target: string; gdbpath: string; + debugger_args: string[]; executable: string; remote: boolean; autorun: string[]; @@ -40,7 +42,7 @@ class GDBDebugSession extends MI2DebugSession { } protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { - this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"]); + this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = false; @@ -109,7 +111,7 @@ class GDBDebugSession extends MI2DebugSession { } protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { - this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"]); + this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = !args.remote; diff --git a/src/lldb.ts b/src/lldb.ts index 2b3d4dd..14910b4 100644 --- a/src/lldb.ts +++ b/src/lldb.ts @@ -8,6 +8,7 @@ export interface LaunchRequestArguments { cwd: string; target: string; lldbmipath: string; + debugger_args: string[]; arguments: string; autorun: string[]; ssh: SSHArguments; @@ -19,6 +20,7 @@ export interface AttachRequestArguments { cwd: string; target: string; lldbmipath: string; + debugger_args: string[]; executable: string; autorun: string[]; printCalls: boolean; @@ -36,7 +38,7 @@ class LLDBDebugSession extends MI2DebugSession { } protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { - this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", []); + this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = false; @@ -97,7 +99,7 @@ class LLDBDebugSession extends MI2DebugSession { } protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { - this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", []); + this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = true; diff --git a/src/mago.ts b/src/mago.ts index f108b83..dfe44cf 100644 --- a/src/mago.ts +++ b/src/mago.ts @@ -8,6 +8,7 @@ export interface LaunchRequestArguments { cwd: string; target: string; magomipath: string; + debugger_args: string[]; arguments: string; autorun: string[]; printCalls: boolean; @@ -18,6 +19,7 @@ export interface AttachRequestArguments { cwd: string; target: string; magomipath: string; + debugger_args: string[]; executable: string; autorun: string[]; printCalls: boolean; @@ -43,7 +45,7 @@ class MagoDebugSession extends MI2DebugSession { } protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { - this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"]); + this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = false; @@ -72,7 +74,7 @@ class MagoDebugSession extends MI2DebugSession { } protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { - this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", []); + this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", [], args.debugger_args); this.initDebugger(); this.quit = false; this.attached = true;