From 005ed38806440176156877769f1cea5648846b8d Mon Sep 17 00:00:00 2001
From: Bob Dubner <rdubner@symas.com>
Date: Fri, 12 Mar 2021 23:00:49 -0500
Subject: [PATCH] Package 4.2.2  Eliminate '=' lines in the multi-line
 'cprint/m' response

---
 CblGdbExt/CblGdb/package.json           |  2 +-
 CblGdbExt/CblGdb/src/backend/mi2/mi2.ts | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/CblGdbExt/CblGdb/package.json b/CblGdbExt/CblGdb/package.json
index 0655f88..5b97cca 100644
--- a/CblGdbExt/CblGdb/package.json
+++ b/CblGdbExt/CblGdb/package.json
@@ -8,7 +8,7 @@
 		"debug"
 	],
 	"license": "COBOLworx",
-	"version": "4.2.1",
+	"version": "4.2.2",
 	"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 bc7d5e8..bb557c1 100644
--- a/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts
+++ b/CblGdbExt/CblGdb/src/backend/mi2/mi2.ts
@@ -376,6 +376,26 @@ export class MI2 extends EventEmitter implements IBackend {
 			// I decided to minimize the impact and just transmogrify it back
 			// here.
 
+			// With the advent of using cob_get_field_string() to get the contents
+			// of variables, I started seeing GDB messages starting with '=' embedded
+			// along with the information we need, which starts with ~" and which
+			// has to end with something like 14^done.
+
+			// So, I simply throw away any lines in the multi-line response that
+			// start with '='
+
+			//console.log("###1###:" + buf);
+			var lines = buf.split('\n');
+			var lineno:number;
+			var buf="";
+			for(lineno=0; lineno<lines.length; lineno++) {
+				if( lines[lineno].length > 0 && lines[lineno][0] != '=' ){
+					buf += lines[lineno];
+					buf += '\n';
+				}
+			}
+			//console.log("###2###:" + buf);
+
 			const leading_variables:string = '~"variables=' ;
 			const leading_value:string = '~"value=' ;
 
-- 
GitLab