From 544c3a488bf5ece2644a31c8f89e7a0e3e694912 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Wed, 10 Feb 2016 20:54:57 +0100 Subject: [PATCH] Added option to print calls from GDB --- package.json | 10 ++++++++++ src/backend/mi2/mi2.ts | 3 +++ src/gdb.ts | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/package.json b/package.json index cecb08d..d3efc83 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,11 @@ "type": "string", "description": "Path of project" }, + "printCalls": { + "type": "boolean", + "description": "Prints all GDB calls to console", + "default": false + }, "autorun": { "type": "array", "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", "default": false }, + "printCalls": { + "type": "boolean", + "description": "Prints all GDB calls to console", + "default": false + }, "executable": { "type": "string", "description": "Path of executable for debugging symbols" diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 4a56c67..a9ac89b 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -476,6 +476,8 @@ export class MI2 extends EventEmitter implements IBackend { } sendRaw(raw: string) { + if (this.printCalls) + this.log("log", raw); if (this.isSSH) this.stream.write(raw + "\n"); else @@ -502,6 +504,7 @@ export class MI2 extends EventEmitter implements IBackend { return this.isSSH ? this.sshReady : !!this.process; } + printCalls: boolean; private isSSH: boolean; private sshReady: boolean; private currentToken: number = 1; diff --git a/src/gdb.ts b/src/gdb.ts index 8108674..ba5d5c3 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -15,6 +15,7 @@ export interface LaunchRequestArguments { target: string; autorun: string[]; ssh: SSHArguments; + printCalls: boolean; } export interface AttachRequestArguments { @@ -23,6 +24,7 @@ export interface AttachRequestArguments { executable: string; remote: boolean; autorun: string[]; + printCalls: boolean; } class MI2DebugSession extends DebugSession { @@ -92,6 +94,7 @@ class MI2DebugSession extends DebugSession { this.attached = false; this.needContinue = false; this.isSSH = false; + this.gdbDebugger.printCalls = !!args.printCalls; if (args.ssh !== undefined) { if (args.ssh.forwardX11 === undefined) args.ssh.forwardX11 = true; @@ -134,6 +137,7 @@ class MI2DebugSession extends DebugSession { this.attached = !args.remote; this.needContinue = true; this.isSSH = false; + this.gdbDebugger.printCalls = !!args.printCalls; if (args.remote) { this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => { if (args.autorun)