Send CLI commands using `-interpreter-exec`
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Jul 2019 10:58:09 +0100
changeset 199 cb411138b295
parent 198 2078a57c6783
child 200 e9250da35d87
Send CLI commands using `-interpreter-exec` ...rather than sendinmg them bare. The problem is with C-escaping, apparently some commands need C-style escaping while others do not. This should fix the problem for good, will see.
GDBMIPrinter.st
--- a/GDBMIPrinter.st	Tue Jun 25 21:21:21 2019 +0100
+++ b/GDBMIPrinter.st	Mon Jul 08 10:58:09 2019 +0100
@@ -164,19 +164,30 @@
 printCommandCLI: aGDBCLICommand
     "
     cli-command → [ token ] cli-command nl, where cli-command is any existing GDB CLI command.
+    "
+    "/ Although MI allows "bare" CLI commands to be issued as well,
+    "/ there's a problem with C-escaping - some commands need C-escaping,
+    "/ some other do not. 
+    "/
+    "/ Try to address this by using -interpreter-exec CLI command to
+    "/ send it to GDB.
+    self printCommandMI: 
+        (GDBMI_interpreter_exec new
+            token: aGDBCLICommand token;
+            arguments: (Array with: 'console' with: aGDBCLICommand value))
 
-    "
-    aGDBCLICommand token notNil ifTrue:[ 
-        aGDBCLICommand token printOn: stream.
-    ].
-    self printCEscapedString: aGDBCLICommand value.
-    aGDBCLICommand runOnBackground ifTrue:[ 
-        stream space; nextPut:$&  
-    ].
+    "/ Original implementation, left for reference:
+"/ aGDBCLICommand token notNil ifTrue:[ 
+"/        aGDBCLICommand token printOn: stream.
+"/    ].
+"/    self printCEscapedString: aGDBCLICommand value.
+"/    aGDBCLICommand runOnBackground ifTrue:[ 
+"/        stream space; nextPut:$&  
+"/    ].
 
     "Created: / 11-07-2017 / 21:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-01-2019 / 21:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 13-03-2019 / 12:15:36 / jv"
+    "Modified (format): / 08-07-2019 / 10:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 printCommandMI: aGDBMICommand