diff --git a/CblGdbExt/CblGdb/package.json b/CblGdbExt/CblGdb/package.json index 5b97ccaa138a79ceda634644506c0204fe94b130..f077c4c7551aa524c04bfc47115c1e46af49a5a4 100644 --- a/CblGdbExt/CblGdb/package.json +++ b/CblGdbExt/CblGdb/package.json @@ -8,7 +8,7 @@ "debug" ], "license": "COBOLworx", - "version": "4.2.2", + "version": "4.2.3", "publisher": "COBOLworx", "icon": "images/COBOLworx.png", "engines": { diff --git a/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts b/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts index d9eeac021cea48f61e73e4d43df6bf563eaceec0..b8dfe9168ff9386b49e965be3626ada656746596 100644 --- a/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts +++ b/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts @@ -504,7 +504,7 @@ export class MI2 extends EventEmitter implements IBackend { // DUBNER SEZ: By replacing "location-reached" with "end-stepping-range", we prevent // the alarming red EXCEPTION OCCURRED warning when we replace "-exec-next" with "cnext" this.buffer += data.toString("utf8").replace("location-reached","end-stepping-range"); - console.log("(B): ", data.toString("utf8")); //DUBNERDEBUG + //console.log("(B): ", data.toString("utf8")); //DUBNERDEBUG } var end = this.buffer.lastIndexOf('\n'); @@ -540,14 +540,14 @@ export class MI2 extends EventEmitter implements IBackend { const leading_stopped:string = '*stopped' ; var lines = <string[]> this.buffer.split('\n'); for( var i=0; i<lines.length; i++) { + // Don't break out of this loop. When stepping it's common for *running and *stopped + // to appear in the response. var line = lines[i]; if( line.substr(0,leading_running.length) == leading_running ) { this.starState = leading_running; - break; } if( line.substr(0,leading_stopped.length) == leading_stopped ) { this.starState = leading_stopped; - break; } } @@ -893,9 +893,6 @@ export class MI2 extends EventEmitter implements IBackend { if (trace) this.log("stderr", "getThreads"); const ret: Thread[] = []; - if( this.starState == "*running" ) { - return ret; - } const command = "thread-info"; const result = await this.sendCommand(command); const threads = result.result("threads"); @@ -1081,7 +1078,7 @@ export class MI2 extends EventEmitter implements IBackend { } sendRaw(raw: string) { - console.log("sendRaw():", raw, '(', this.starState,')'); // DUBNERDEBUG + //console.log("sendRaw():", raw, '(', this.starState,')'); // DUBNERDEBUG if (this.printCalls) this.log("log", raw); if (this.isSSH) @@ -1108,7 +1105,6 @@ export class MI2 extends EventEmitter implements IBackend { } sendCommand(command: string, suppressFailure: boolean = false): Thenable<MINode> { - const sel = this.currentToken++; return new Promise((resolve, reject) => { this.handlers[sel] = (node: MINode) => { @@ -1123,13 +1119,18 @@ export class MI2 extends EventEmitter implements IBackend { }; if( this.starState == "*running" ) { // When in running mode, assume the command is for the inferior - // rather than for gdb. Somebody "up there" has helpfully encased whatever the user typed - // into 'interpreter-exec console "4321"; we need to disinter it: - var n1:number = command.indexOf('"'); - var n2:number = command.lastIndexOf('"'); - command = command.slice(n1+1,n2); - this.sendRaw(command); - this.sendRaw("\n"); + // rather than for gdb. We will pay attention only to an instruction + // encased in 'interpreter-exec', and we will extract the meat of + // that instruction and send it unadorned. + if( command.indexOf('interpreter-exec') == 0) { + var n1:number = command.indexOf('"'); + var n2:number = command.lastIndexOf('"'); + if( n1 != -1 && n2 != -1 ) { + command = command.slice(n1+1,n2); + this.sendRaw(command); + this.sendRaw("\n"); + } + } } else { this.sendRaw(sel + "-" + command);