Skip to content

Commit c831c4d

Browse files
committed
implement debugger_args option
1 parent a32c8b5 commit c831c4d

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/backend/mi2/mi2.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function couldBeOutput(line: string) {
2727
const trace = false;
2828

2929
export class MI2 extends EventEmitter implements IBackend {
30-
constructor(public application: string, public preargs: string[]) {
30+
constructor(public application: string, public preargs: string[], public extraargs: string[]) {
3131
super();
3232
}
3333

@@ -36,7 +36,8 @@ export class MI2 extends EventEmitter implements IBackend {
3636
target = nativePath.join(cwd, target);
3737
return new Promise((resolve, reject) => {
3838
this.isSSH = false;
39-
this.process = ChildProcess.spawn(this.application, this.preargs, { cwd: cwd });
39+
let args = this.preargs.concat(this.extraargs || []);
40+
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd });
4041
this.process.stdout.on("data", this.stdout.bind(this));
4142
this.process.stderr.on("data", this.stderr.bind(this));
4243
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));

src/gdb.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
88
cwd: string;
99
target: string;
1010
gdbpath: string;
11+
debugger_args: string[];
1112
arguments: string;
1213
terminal: string;
1314
autorun: string[];
@@ -20,6 +21,7 @@ export interface AttachRequestArguments {
2021
cwd: string;
2122
target: string;
2223
gdbpath: string;
24+
debugger_args: string[];
2325
executable: string;
2426
remote: boolean;
2527
autorun: string[];
@@ -40,7 +42,7 @@ class GDBDebugSession extends MI2DebugSession {
4042
}
4143

4244
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
43-
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"]);
45+
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args);
4446
this.initDebugger();
4547
this.quit = false;
4648
this.attached = false;
@@ -109,7 +111,7 @@ class GDBDebugSession extends MI2DebugSession {
109111
}
110112

111113
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
112-
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"]);
114+
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args);
113115
this.initDebugger();
114116
this.quit = false;
115117
this.attached = !args.remote;

src/lldb.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
88
cwd: string;
99
target: string;
1010
lldbmipath: string;
11+
debugger_args: string[];
1112
arguments: string;
1213
autorun: string[];
1314
ssh: SSHArguments;
@@ -19,6 +20,7 @@ export interface AttachRequestArguments {
1920
cwd: string;
2021
target: string;
2122
lldbmipath: string;
23+
debugger_args: string[];
2224
executable: string;
2325
autorun: string[];
2426
printCalls: boolean;
@@ -36,7 +38,7 @@ class LLDBDebugSession extends MI2DebugSession {
3638
}
3739

3840
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
39-
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", []);
41+
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args);
4042
this.initDebugger();
4143
this.quit = false;
4244
this.attached = false;
@@ -97,7 +99,7 @@ class LLDBDebugSession extends MI2DebugSession {
9799
}
98100

99101
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
100-
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", []);
102+
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args);
101103
this.initDebugger();
102104
this.quit = false;
103105
this.attached = true;

src/mago.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
88
cwd: string;
99
target: string;
1010
magomipath: string;
11+
debugger_args: string[];
1112
arguments: string;
1213
autorun: string[];
1314
printCalls: boolean;
@@ -18,6 +19,7 @@ export interface AttachRequestArguments {
1819
cwd: string;
1920
target: string;
2021
magomipath: string;
22+
debugger_args: string[];
2123
executable: string;
2224
autorun: string[];
2325
printCalls: boolean;
@@ -43,7 +45,7 @@ class MagoDebugSession extends MI2DebugSession {
4345
}
4446

4547
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
46-
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"]);
48+
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args);
4749
this.initDebugger();
4850
this.quit = false;
4951
this.attached = false;
@@ -72,7 +74,7 @@ class MagoDebugSession extends MI2DebugSession {
7274
}
7375

7476
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
75-
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", []);
77+
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", [], args.debugger_args);
7678
this.initDebugger();
7779
this.quit = false;
7880
this.attached = true;

0 commit comments

Comments
 (0)