Added option to print calls from GDB

This commit is contained in:
WebFreak001 2016-02-10 20:54:57 +01:00
commit 544c3a488b
3 changed files with 17 additions and 0 deletions

View file

@ -48,6 +48,11 @@
"type": "string", "type": "string",
"description": "Path of project" "description": "Path of project"
}, },
"printCalls": {
"type": "boolean",
"description": "Prints all GDB calls to console",
"default": false
},
"autorun": { "autorun": {
"type": "array", "type": "array",
"description": "GDB commands to run when starting to debug", "description": "GDB commands to run when starting to debug",
@ -125,6 +130,11 @@
"description": "If true this will connect to a gdbserver instead of attaching to a PID", "description": "If true this will connect to a gdbserver instead of attaching to a PID",
"default": false "default": false
}, },
"printCalls": {
"type": "boolean",
"description": "Prints all GDB calls to console",
"default": false
},
"executable": { "executable": {
"type": "string", "type": "string",
"description": "Path of executable for debugging symbols" "description": "Path of executable for debugging symbols"

View file

@ -476,6 +476,8 @@ export class MI2 extends EventEmitter implements IBackend {
} }
sendRaw(raw: string) { sendRaw(raw: string) {
if (this.printCalls)
this.log("log", raw);
if (this.isSSH) if (this.isSSH)
this.stream.write(raw + "\n"); this.stream.write(raw + "\n");
else else
@ -502,6 +504,7 @@ export class MI2 extends EventEmitter implements IBackend {
return this.isSSH ? this.sshReady : !!this.process; return this.isSSH ? this.sshReady : !!this.process;
} }
printCalls: boolean;
private isSSH: boolean; private isSSH: boolean;
private sshReady: boolean; private sshReady: boolean;
private currentToken: number = 1; private currentToken: number = 1;

View file

@ -15,6 +15,7 @@ export interface LaunchRequestArguments {
target: string; target: string;
autorun: string[]; autorun: string[];
ssh: SSHArguments; ssh: SSHArguments;
printCalls: boolean;
} }
export interface AttachRequestArguments { export interface AttachRequestArguments {
@ -23,6 +24,7 @@ export interface AttachRequestArguments {
executable: string; executable: string;
remote: boolean; remote: boolean;
autorun: string[]; autorun: string[];
printCalls: boolean;
} }
class MI2DebugSession extends DebugSession { class MI2DebugSession extends DebugSession {
@ -92,6 +94,7 @@ class MI2DebugSession extends DebugSession {
this.attached = false; this.attached = false;
this.needContinue = false; this.needContinue = false;
this.isSSH = false; this.isSSH = false;
this.gdbDebugger.printCalls = !!args.printCalls;
if (args.ssh !== undefined) { if (args.ssh !== undefined) {
if (args.ssh.forwardX11 === undefined) if (args.ssh.forwardX11 === undefined)
args.ssh.forwardX11 = true; args.ssh.forwardX11 = true;
@ -134,6 +137,7 @@ class MI2DebugSession extends DebugSession {
this.attached = !args.remote; this.attached = !args.remote;
this.needContinue = true; this.needContinue = true;
this.isSSH = false; this.isSSH = false;
this.gdbDebugger.printCalls = !!args.printCalls;
if (args.remote) { if (args.remote) {
this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => { this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => {
if (args.autorun) if (args.autorun)