This commit is contained in:
WebFreak001 2017-04-14 18:26:40 +02:00
commit a21e2e65af
6 changed files with 47 additions and 11 deletions

View file

@ -91,6 +91,11 @@
"description": "Path to the gdb executable or the command if in PATH",
"default": "gdb"
},
"env": {
"type": "object",
"description": "Environment overriding the gdb (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to GDB",
@ -206,6 +211,11 @@
"description": "Path to the gdb executable or the command if in PATH",
"default": "gdb"
},
"env": {
"type": "object",
"description": "Environment overriding the gdb (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to GDB",
@ -446,6 +456,11 @@
"description": "Path to the lldb-mi executable or the command if in PATH",
"default": "lldb-mi"
},
"env": {
"type": "object",
"description": "Environment overriding the lldb-mi (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to LLDB",
@ -556,6 +571,11 @@
"description": "Path to the lldb-mi executable or the command if in PATH",
"default": "lldb-mi"
},
"env": {
"type": "object",
"description": "Environment overriding the lldb-mi (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to LLDB",
@ -683,6 +703,11 @@
"description": "Path to the mago-mi executable or the command if in PATH",
"default": "mago-mi"
},
"env": {
"type": "object",
"description": "Environment overriding the mago-mi (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to mago",
@ -733,6 +758,11 @@
"description": "Path to the mago-mi executable or the command if in PATH",
"default": "mago-mi"
},
"env": {
"type": "object",
"description": "Environment overriding the mago-mi (and in turn also the process) environment",
"default": null
},
"debugger_args": {
"type": "array",
"description": "Additional arguments to pass to mago",

View file

@ -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[], public extraargs: string[]) {
constructor(public application: string, public preargs: string[], public extraargs: string[], public procEnv: any) {
super();
}
@ -37,7 +37,7 @@ export class MI2 extends EventEmitter implements IBackend {
return new Promise((resolve, reject) => {
this.isSSH = false;
let args = this.preargs.concat(this.extraargs || []);
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd });
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv });
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));
@ -193,7 +193,7 @@ export class MI2 extends EventEmitter implements IBackend {
args = this.preargs;
} else
args = args.concat([executable, target], this.preargs);
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd });
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv });
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));
@ -222,7 +222,7 @@ export class MI2 extends EventEmitter implements IBackend {
args = args.concat([executable], this.preargs);
else
args = this.preargs;
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd });
this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv });
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));

View file

@ -25,7 +25,7 @@ export class MI2_LLDB extends MI2 {
attach(cwd: string, executable: string, target: string): Thenable<any> {
return new Promise((resolve, reject) => {
this.process = ChildProcess.spawn(this.application, this.preargs, { cwd: cwd });
this.process = ChildProcess.spawn(this.application, this.preargs, { cwd: cwd, env: this.procEnv });
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));

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string;
target: string;
gdbpath: string;
env: any;
debugger_args: string[];
arguments: string;
terminal: string;
@ -21,6 +22,7 @@ export interface AttachRequestArguments {
cwd: string;
target: string;
gdbpath: string;
env: any;
debugger_args: string[];
executable: string;
remote: boolean;
@ -43,7 +45,7 @@ class GDBDebugSession extends MI2DebugSession {
}
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args);
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = false;
@ -112,7 +114,7 @@ class GDBDebugSession extends MI2DebugSession {
}
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args);
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = !args.remote;

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string;
target: string;
lldbmipath: string;
env: any;
debugger_args: string[];
arguments: string;
autorun: string[];
@ -20,6 +21,7 @@ export interface AttachRequestArguments {
cwd: string;
target: string;
lldbmipath: string;
env: any;
debugger_args: string[];
executable: string;
autorun: string[];
@ -38,7 +40,7 @@ class LLDBDebugSession extends MI2DebugSession {
}
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args);
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = false;
@ -99,7 +101,7 @@ class LLDBDebugSession extends MI2DebugSession {
}
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args);
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = true;

View file

@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
cwd: string;
target: string;
magomipath: string;
env: any;
debugger_args: string[];
arguments: string;
autorun: string[];
@ -19,6 +20,7 @@ export interface AttachRequestArguments {
cwd: string;
target: string;
magomipath: string;
env: any;
debugger_args: string[];
executable: string;
autorun: string[];
@ -45,7 +47,7 @@ class MagoDebugSession extends MI2DebugSession {
}
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args);
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = false;
@ -74,7 +76,7 @@ class MagoDebugSession extends MI2DebugSession {
}
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", [], args.debugger_args);
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", [], args.debugger_args, args.env);
this.initDebugger();
this.quit = false;
this.attached = true;