Merge pull request #87 from Mrmaxmeier/add-gdbargs-config-option

Add config option to pass arguments to GDB
This commit is contained in:
Jan Jurzitza 2016-12-11 23:04:32 +01:00 committed by GitHub
commit d254399840
6 changed files with 48 additions and 9 deletions

View file

@ -1,5 +1,7 @@
sudo: false sudo: false
language: node_js
node_js:
- stable
os: os:
- osx - osx
- linux - linux

View file

@ -91,6 +91,11 @@
"description": "Path to the gdb executable or the command if in PATH", "description": "Path to the gdb executable or the command if in PATH",
"default": "gdb" "default": "gdb"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to GDB",
"default": []
},
"printCalls": { "printCalls": {
"type": "boolean", "type": "boolean",
"description": "Prints all GDB calls to the console", "description": "Prints all GDB calls to the console",
@ -201,6 +206,11 @@
"description": "Path to the gdb executable or the command if in PATH", "description": "Path to the gdb executable or the command if in PATH",
"default": "gdb" "default": "gdb"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to GDB",
"default": []
},
"cwd": { "cwd": {
"type": "string", "type": "string",
"description": "Path of project", "description": "Path of project",
@ -284,6 +294,11 @@
"description": "Path to the lldb-mi executable or the command if in PATH", "description": "Path to the lldb-mi executable or the command if in PATH",
"default": "lldb-mi" "default": "lldb-mi"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to LLDB",
"default": []
},
"printCalls": { "printCalls": {
"type": "boolean", "type": "boolean",
"description": "Prints all lldb calls to the console", "description": "Prints all lldb calls to the console",
@ -389,6 +404,11 @@
"description": "Path to the lldb-mi executable or the command if in PATH", "description": "Path to the lldb-mi executable or the command if in PATH",
"default": "lldb-mi" "default": "lldb-mi"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to LLDB",
"default": []
},
"cwd": { "cwd": {
"type": "string", "type": "string",
"description": "Path of project", "description": "Path of project",
@ -450,6 +470,11 @@
"description": "Path to the mago-mi executable or the command if in PATH", "description": "Path to the mago-mi executable or the command if in PATH",
"default": "mago-mi" "default": "mago-mi"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to mago",
"default": []
},
"printCalls": { "printCalls": {
"type": "boolean", "type": "boolean",
"description": "Prints all mago calls to the console", "description": "Prints all mago calls to the console",
@ -495,6 +520,11 @@
"description": "Path to the mago-mi executable or the command if in PATH", "description": "Path to the mago-mi executable or the command if in PATH",
"default": "mago-mi" "default": "mago-mi"
}, },
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to mago",
"default": []
},
"cwd": { "cwd": {
"type": "string", "type": "string",
"description": "Path of project", "description": "Path of project",

View file

@ -27,7 +27,7 @@ function couldBeOutput(line: string) {
const trace = false; const trace = false;
export class MI2 extends EventEmitter implements IBackend { 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(); super();
} }
@ -36,7 +36,8 @@ export class MI2 extends EventEmitter implements IBackend {
target = nativePath.join(cwd, target); target = nativePath.join(cwd, target);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.isSSH = false; 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.stdout.on("data", this.stdout.bind(this));
this.process.stderr.on("data", this.stderr.bind(this)); this.process.stderr.on("data", this.stderr.bind(this));
this.process.on("exit", (() => { this.emit("quit"); }).bind(this)); this.process.on("exit", (() => { this.emit("quit"); }).bind(this));

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
gdbpath: string; gdbpath: string;
debugger_args: string[];
arguments: string; arguments: string;
terminal: string; terminal: string;
autorun: string[]; autorun: string[];
@ -20,6 +21,7 @@ export interface AttachRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
gdbpath: string; gdbpath: string;
debugger_args: string[];
executable: string; executable: string;
remote: boolean; remote: boolean;
autorun: string[]; autorun: string[];
@ -40,7 +42,7 @@ class GDBDebugSession extends MI2DebugSession {
} }
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = false; this.attached = false;
@ -109,7 +111,7 @@ class GDBDebugSession extends MI2DebugSession {
} }
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = !args.remote; this.attached = !args.remote;

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
lldbmipath: string; lldbmipath: string;
debugger_args: string[];
arguments: string; arguments: string;
autorun: string[]; autorun: string[];
ssh: SSHArguments; ssh: SSHArguments;
@ -19,6 +20,7 @@ export interface AttachRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
lldbmipath: string; lldbmipath: string;
debugger_args: string[];
executable: string; executable: string;
autorun: string[]; autorun: string[];
printCalls: boolean; printCalls: boolean;
@ -36,7 +38,7 @@ class LLDBDebugSession extends MI2DebugSession {
} }
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = false; this.attached = false;
@ -97,7 +99,7 @@ class LLDBDebugSession extends MI2DebugSession {
} }
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = true; this.attached = true;

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
magomipath: string; magomipath: string;
debugger_args: string[];
arguments: string; arguments: string;
autorun: string[]; autorun: string[];
printCalls: boolean; printCalls: boolean;
@ -18,6 +19,7 @@ export interface AttachRequestArguments {
cwd: string; cwd: string;
target: string; target: string;
magomipath: string; magomipath: string;
debugger_args: string[];
executable: string; executable: string;
autorun: string[]; autorun: string[];
printCalls: boolean; printCalls: boolean;
@ -43,7 +45,7 @@ class MagoDebugSession extends MI2DebugSession {
} }
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = false; this.attached = false;
@ -72,7 +74,7 @@ class MagoDebugSession extends MI2DebugSession {
} }
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { 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.initDebugger();
this.quit = false; this.quit = false;
this.attached = true; this.attached = true;