Fix #98
This commit is contained in:
parent
edfac8eb1a
commit
a21e2e65af
6 changed files with 47 additions and 11 deletions
30
package.json
30
package.json
|
|
@ -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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the gdb (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to GDB",
|
"description": "Additional arguments to pass to GDB",
|
||||||
|
|
@ -206,6 +211,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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the gdb (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to GDB",
|
"description": "Additional arguments to pass to GDB",
|
||||||
|
|
@ -446,6 +456,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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the lldb-mi (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to LLDB",
|
"description": "Additional arguments to pass to LLDB",
|
||||||
|
|
@ -556,6 +571,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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the lldb-mi (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to LLDB",
|
"description": "Additional arguments to pass to LLDB",
|
||||||
|
|
@ -683,6 +703,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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the mago-mi (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to mago",
|
"description": "Additional arguments to pass to mago",
|
||||||
|
|
@ -733,6 +758,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"
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Environment overriding the mago-mi (and in turn also the process) environment",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"debugger_args": {
|
"debugger_args": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Additional arguments to pass to mago",
|
"description": "Additional arguments to pass to mago",
|
||||||
|
|
|
||||||
|
|
@ -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[], public extraargs: string[]) {
|
constructor(public application: string, public preargs: string[], public extraargs: string[], public procEnv: any) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.isSSH = false;
|
this.isSSH = false;
|
||||||
let args = this.preargs.concat(this.extraargs || []);
|
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.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));
|
||||||
|
|
@ -193,7 +193,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
args = this.preargs;
|
args = this.preargs;
|
||||||
} else
|
} else
|
||||||
args = args.concat([executable, target], this.preargs);
|
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.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));
|
||||||
|
|
@ -222,7 +222,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
args = args.concat([executable], this.preargs);
|
args = args.concat([executable], this.preargs);
|
||||||
else
|
else
|
||||||
args = this.preargs;
|
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.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));
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export class MI2_LLDB extends MI2 {
|
||||||
|
|
||||||
attach(cwd: string, executable: string, target: string): Thenable<any> {
|
attach(cwd: string, executable: string, target: string): Thenable<any> {
|
||||||
return new Promise((resolve, reject) => {
|
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.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));
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
gdbpath: string;
|
gdbpath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
arguments: string;
|
arguments: string;
|
||||||
terminal: string;
|
terminal: string;
|
||||||
|
|
@ -21,6 +22,7 @@ export interface AttachRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
gdbpath: string;
|
gdbpath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
executable: string;
|
executable: string;
|
||||||
remote: boolean;
|
remote: boolean;
|
||||||
|
|
@ -43,7 +45,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"], args.debugger_args);
|
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = false;
|
this.attached = false;
|
||||||
|
|
@ -112,7 +114,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"], args.debugger_args);
|
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = !args.remote;
|
this.attached = !args.remote;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
lldbmipath: string;
|
lldbmipath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
arguments: string;
|
arguments: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
|
@ -20,6 +21,7 @@ export interface AttachRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
lldbmipath: string;
|
lldbmipath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
executable: string;
|
executable: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
|
@ -38,7 +40,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", [], args.debugger_args);
|
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = false;
|
this.attached = false;
|
||||||
|
|
@ -99,7 +101,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", [], args.debugger_args);
|
this.miDebugger = new MI2_LLDB(args.lldbmipath || "lldb-mi", [], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = true;
|
this.attached = true;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
magomipath: string;
|
magomipath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
arguments: string;
|
arguments: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
|
@ -19,6 +20,7 @@ export interface AttachRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
target: string;
|
target: string;
|
||||||
magomipath: string;
|
magomipath: string;
|
||||||
|
env: any;
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
executable: string;
|
executable: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
|
@ -45,7 +47,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"], args.debugger_args);
|
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = false;
|
this.attached = false;
|
||||||
|
|
@ -74,7 +76,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", [], args.debugger_args);
|
this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", [], args.debugger_args, args.env);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
this.quit = false;
|
this.quit = false;
|
||||||
this.attached = true;
|
this.attached = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue