Add `GDBMIDebugger` tool to test raw MI / CLI.
Useful prerry much only for `jv:libgdbs` developers.
--- a/GDBLocalProcess.st Tue Jun 18 11:04:46 2019 +0100
+++ b/GDBLocalProcess.st Wed Jun 19 12:02:49 2019 +0100
@@ -178,11 +178,15 @@
exited: status
"Called when spawn GDB process terminates for whatever reason"
pid := nil.
- connection released: status
+
+ "/ connection may be nil if GDBProcess instance is used
+ "/ on it own, without GDBConnection (such as in GDBMIDebugger)
+ connection notNil ifTrue:[
+ connection released: status
+ ].
"Created: / 20-06-2014 / 21:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 12-01-2018 / 21:50:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 17-10-2018 / 22:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-06-2019 / 10:50:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBLocalProcess methodsFor:'testing'!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBMIDebugger.st Wed Jun 19 12:02:49 2019 +0100
@@ -0,0 +1,186 @@
+"
+jv:libgdbs - GNU Debugger Interface Library
+Copyright (C) 2015-now Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+"
+"{ Package: 'jv:libgdbs' }"
+
+"{ NameSpace: Smalltalk }"
+
+ApplicationModel subclass:#GDBMIDebugger
+ instanceVariableNames:'process cliView miView'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'GDB-Private-MI Trace'
+!
+
+!GDBMIDebugger class methodsFor:'documentation'!
+
+copyright
+"
+jv:libgdbs - GNU Debugger Interface Library
+Copyright (C) 2015-now Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+"
+! !
+
+!GDBMIDebugger class methodsFor:'interface specs'!
+
+windowSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:GDBMIDebugger andSelector:#windowSpec
+ GDBMIDebugger new openInterface:#windowSpec
+ GDBMIDebugger open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ uuid: '75dbc6f0-9274-11e9-b1d9-606720e43e2c'
+ window:
+ (WindowSpec
+ label: 'GDB/MI Debugger / Viewer'
+ name: 'GDB/MI Debugger / Viewer'
+ uuid: '75dbc6f1-9274-11e9-b1d9-606720e43e2c'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 852 533)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (VariableVerticalPanelSpec
+ name: 'VariableVerticalPanel1'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ uuid: '75dbc6f2-9274-11e9-b1d9-606720e43e2c'
+ component:
+ (SpecCollection
+ collection: (
+ (ArbitraryComponentSpec
+ name: 'CLI'
+ uuid: '75dbc6f3-9274-11e9-b1d9-606720e43e2c'
+ hasBorder: false
+ component: cliView
+ )
+ (ArbitraryComponentSpec
+ name: 'MI'
+ uuid: '75dbc6f4-9274-11e9-b1d9-606720e43e2c'
+ hasBorder: false
+ component: miView
+ )
+ )
+
+ )
+ handles: (Any 0.5 1.0)
+ )
+ )
+
+ )
+ )
+! !
+
+!GDBMIDebugger methodsFor:'aspects'!
+
+cliView
+ cliView isNil ifTrue:[
+ cliView := VT100TerminalView new.
+ self initializeTerminalView: cliView.
+ ].
+ ^ cliView
+
+ "Created: / 19-06-2019 / 10:33:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+miView
+ miView isNil ifTrue:[
+ miView := VT100TerminalView new.
+ self initializeTerminalView: miView.
+ ].
+ ^ miView
+
+ "Created: / 19-06-2019 / 10:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBMIDebugger methodsFor:'hooks'!
+
+commonPostOpen
+ super commonPostOpen.
+
+ process := GDBProcess new.
+
+ (process isKindOf: GDBStXUnixProcess) ifTrue:[
+ (process instVarNamed: #debuggerPTY)
+ setLocalEcho: true;
+ setOutputCRLF: true.
+ ].
+ miView inStream: process debuggerInput.
+ miView outStream: process debuggerOutput.
+ miView startReaderProcessWhenVisible.
+
+ process consoleInput notNil ifTrue:[
+ cliView inStream: process consoleInput.
+ cliView outStream: process consoleOutput.
+ cliView startReaderProcessWhenVisible.
+ ] ifFalse:[
+ cliView hide.
+ ].
+
+ "Created: / 19-06-2019 / 10:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBMIDebugger methodsFor:'initialization & release'!
+
+initializeTerminalView: aTerminalView
+ aTerminalView cursorType: #block;
+ foregroundColor: Color white
+ backgroundColor: Color black;
+ cursorForegroundColor: Color white
+ backgroundColor: Color white.
+ (Smalltalk at: #VDBAbstractApplication) notNil ifTrue:[
+ aTerminalView font: (Smalltalk at: #VDBAbstractApplication) defaultTextFont
+ ].
+
+ "Created: / 19-06-2019 / 10:33:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+release
+ process notNil ifTrue:[
+ process release.
+ ].
+
+ "Created: / 19-06-2019 / 10:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/abbrev.stc Tue Jun 18 11:04:46 2019 +0100
+++ b/abbrev.stc Wed Jun 19 12:02:49 2019 +0100
@@ -215,3 +215,4 @@
GDBThreadGroupStartedEvent GDBThreadGroupStartedEvent jv:libgdbs 'GDB-Core-Events' 0
GDBMITraceViewer GDBMITraceViewer jv:libgdbs 'GDB-Private-MI Trace' 2
GDBSimulatorResource GDBSimulatorResource jv:libgdbs 'GDB-Resources' 1
+GDBMIDebugger GDBMIDebugger jv:libgdbs 'GDB-Private-MI Trace' 2
--- a/jv_libgdbs.st Tue Jun 18 11:04:46 2019 +0100
+++ b/jv_libgdbs.st Wed Jun 19 12:02:49 2019 +0100
@@ -330,6 +330,7 @@
GDBThreadGroupStartedEvent
(GDBMITraceViewer autoload)
(GDBSimulatorResource autoload)
+ (GDBMIDebugger autoload)
)
!
--- a/tests/libInit.cc Tue Jun 18 11:04:46 2019 +0100
+++ b/tests/libInit.cc Wed Jun 19 12:02:49 2019 +0100
@@ -23,7 +23,7 @@
extern void _GDBMIPrinterTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
extern void _GDBTransientDataHolderTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
extern void _jv_137libgdbs_137tests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
-extern void _GDBDebuggerTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _GDBDebuggerTestsR_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -45,7 +45,7 @@
_GDBMIPrinterTests_Init(pass,__pRT__,snd);
_GDBTransientDataHolderTests_Init(pass,__pRT__,snd);
_jv_137libgdbs_137tests_Init(pass,__pRT__,snd);
- _GDBDebuggerTests_Init(pass,__pRT__,snd);
+ _GDBDebuggerTestsR_Init(pass,__pRT__,snd);
__END_PACKAGE__();