Temporary commit : initial work on session recorder (to use for simulation later)
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 23 Jun 2014 09:45:16 +0100
changeset 24 98ff50f8a25d
parent 23 a7eb888c81b5
child 25 58e042a191a9
Temporary commit : initial work on session recorder (to use for simulation later)
GDBConnection.st
GDBMI_var_set_update_range.st
GDBParser.st
GDBProcess.st
GDBSessionRecorder.st
GDBSimulatorProcess.st
GDBUnixProcess.st
Make.proto
Make.spec
abbrev.stc
bc.mak
jv_libgdbs.st
libInit.cc
libgdbs.rc
tests/tests.rc
--- a/GDBConnection.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/GDBConnection.st	Mon Jun 23 09:45:16 2014 +0100
@@ -3,7 +3,7 @@
 Object subclass:#GDBConnection
 	instanceVariableNames:'process inferiorPTY eventAnnouncer eventAnnouncerInternal
 		eventQueue eventQueueLock eventQueueNotifier eventDispatchProcess
-		eventPumpProcess outstandingCommands'
+		eventPumpProcess outstandingCommands recorder'
 	classVariableNames:''
 	poolDictionaries:'GDBDebugFlags'
 	category:'GDB-Private'
@@ -43,13 +43,20 @@
 !GDBConnection methodsFor:'commands'!
 
 send: command
+    | commandString |
+
     command token notNil ifTrue:[ 
         process debuggerInput nextPutAll: command token printString.
     ].
     outstandingCommands add: command.
-    process debuggerInput nextPutLine: command asString.
+    commandString := command asString.
+    recorder notNil ifTrue:[ 
+            recorder recordCommand: commandString
+    ].  
+    process debuggerInput nextPutLine: commandString.
 
     "Created: / 20-06-2014 / 22:09:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBConnection methodsFor:'event dispatching'!
@@ -148,6 +155,7 @@
         command notNil ifTrue:[ outstandingCommands remove: command ].
         command
     ].
+    parser recorder: recorder.  
     [ process debuggerOutput atEnd ] whileFalse:[ 
         | eventset |
 
@@ -180,7 +188,7 @@
     ]
 
     "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-06-2014 / 21:39:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:20:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 eventPumpStart
@@ -251,8 +259,12 @@
     eventAnnouncer := Announcer new.
     eventAnnouncerInternal := Announcer new.    
     outstandingCommands := Set new.
+    recorder := GDBSessionRecorder new.
+
+    aGDBProcess connection: self.
 
     "Created: / 20-06-2014 / 21:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:22:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 release
--- a/GDBMI_var_set_update_range.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/GDBMI_var_set_update_range.st	Mon Jun 23 09:45:16 2014 +0100
@@ -7,9 +7,17 @@
 	category:'GDB-Core-Commands-MI'
 !
 
+
 !GDBMI_var_set_update_range methodsFor:'accessing'!
 
 operation
 	^ 'var-set-update-range'
 ! !
 
+!GDBMI_var_set_update_range class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/GDBParser.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/GDBParser.st	Mon Jun 23 09:45:16 2014 +0100
@@ -3,7 +3,7 @@
 "{ Package: 'jv:libgdbs' }"
 
 Object subclass:#GDBParser
-	instanceVariableNames:'source lookahead token token2CommandMappingBlock'
+	instanceVariableNames:'source lookahead token token2CommandMappingBlock recorder'
 	classVariableNames:''
 	poolDictionaries:'GDBCommandStatus'
 	category:'GDB-Private'
@@ -19,6 +19,14 @@
 
 !GDBParser methodsFor:'accessing'!
 
+recorder
+    ^ recorder
+!
+
+recorder:something
+    recorder := something.
+!
+
 token2CommandMappingBlock: aBlock
     token2CommandMappingBlock := aBlock.
 
@@ -216,10 +224,13 @@
     ].
     self expect: '(gdb)'.
     self parseNl.
+    recorder notNil ifTrue:[ 
+        recorder recordResponseEnd.
+    ].
     ^ events
 
     "Created: / 30-05-2014 / 09:52:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 04-06-2014 / 00:38:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseResultClass
@@ -706,31 +717,47 @@
 next
     | next |
     lookahead notNil ifTrue:[
-	next := lookahead.
-	lookahead := nil.
-	^ next.
+        next := lookahead.
+        lookahead := nil.
+        ^ next.
     ].
-    ^ source next.
+    next := source next.
+    recorder notNil ifTrue:[ 
+        recorder recordResponseChar: next.
+    ].
+    ^ next
 
     "Created: / 23-10-2012 / 10:57:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-05-2014 / 00:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-06-2014 / 21:56:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 nextLine
+    | line |
     lookahead := nil.
-    ^source nextLine
+    line := source nextLine.
+    recorder notNil ifTrue:[ 
+        recorder recordResponse: line.  
+    ].
+    ^ line
 
     "Created: / 23-10-2012 / 11:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-05-2014 / 00:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-06-2014 / 21:56:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 peek
     lookahead notNil ifTrue:[
-	^ lookahead
+        ^ lookahead
     ].
-    ^ lookahead := source next.
+    lookahead := source next.
+    recorder notNil ifTrue:[ 
+        lookahead notNil ifTrue:[
+            recorder recordResponseChar: lookahead.
+        ].
+    ].
+    ^ lookahead
 
     "Created: / 28-05-2014 / 00:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:34:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 peekOrNil
--- a/GDBProcess.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/GDBProcess.st	Mon Jun 23 09:45:16 2014 +0100
@@ -7,6 +7,14 @@
 	category:'GDB-Private'
 !
 
+!GDBProcess class methodsFor:'instance creation'!
+
+new
+    "return an initialized instance"
+
+    ^ self basicNew initialize.
+! !
+
 !GDBProcess class methodsFor:'queries'!
 
 isAbstract
@@ -19,6 +27,10 @@
 
 !GDBProcess methodsFor:'accessing'!
 
+connection:aGDBConnection
+    connection := aGDBConnection.
+!
+
 debuggerInput
     ^ debuggerInput
 !
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBSessionRecorder.st	Mon Jun 23 09:45:16 2014 +0100
@@ -0,0 +1,56 @@
+"{ Package: 'jv:libgdbs' }"
+
+Object subclass:#GDBSessionRecorder
+	instanceVariableNames:'record commandBuffer responseBuffer'
+	classVariableNames:''
+	poolDictionaries:'GDBDebugFlags'
+	category:'GDB-Private-Simulator'
+!
+
+!GDBSessionRecorder methodsFor:'recording'!
+
+recordCommand: command
+    commandBuffer := WriteStream new.
+    commandBuffer nextPutAll: command.
+
+    "Created: / 22-06-2014 / 21:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+recordResponse: aString
+    responseBuffer isNil ifTrue:[ 
+        responseBuffer := CharacterWriteStream new.
+    ].
+    responseBuffer nextPutAll: aString
+
+    "Created: / 22-06-2014 / 21:56:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+recordResponseChar: aCharacter
+    responseBuffer isNil ifTrue:[ 
+        responseBuffer := String new writeStream.
+    ].
+    responseBuffer nextPut: aCharacter
+
+    "Created: / 22-06-2014 / 21:42:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:23:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+recordResponseEnd
+    | cmd resp |    
+
+    record isNil ifTrue:[ 
+        record := OrderedCollection new writeStream.
+    ].
+
+    commandBuffer notNil ifTrue:[
+        cmd := commandBuffer contents.
+        commandBuffer := nil.
+    ].
+    resp := responseBuffer contents.
+    responseBuffer := nil.
+    record nextPut: cmd -> resp.
+
+    "Created: / 22-06-2014 / 21:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-06-2014 / 09:24:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBSimulatorProcess.st	Mon Jun 23 09:45:16 2014 +0100
@@ -0,0 +1,19 @@
+"{ Package: 'jv:libgdbs' }"
+
+GDBProcess subclass:#GDBSimulatorProcess
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'GDB-Private'
+!
+
+!GDBSimulatorProcess methodsFor:'initialization'!
+
+initialize
+    pid := -1.
+    debuggerInput := GDBInternalPipeStream new.
+    debuggerOutput := GDBInternalPipeStream new.
+
+    "Modified: / 20-06-2014 / 22:18:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/GDBUnixProcess.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/GDBUnixProcess.st	Mon Jun 23 09:45:16 2014 +0100
@@ -7,14 +7,6 @@
 	category:'GDB-Private'
 !
 
-!GDBUnixProcess class methodsFor:'instance creation'!
-
-new
-    "return an initialized instance"
-
-    ^ self basicNew initialize.
-! !
-
 !GDBUnixProcess methodsFor:'initialization'!
 
 initialize
--- a/Make.proto	Fri Jun 20 22:14:51 2014 +0100
+++ b/Make.proto	Mon Jun 23 09:45:16 2014 +0100
@@ -147,6 +147,8 @@
 $(OUTDIR)GDBMICommand.$(O) GDBMICommand.$(H): GDBMICommand.st $(INCLUDE_TOP)/jv/libgdbs/GDBCommand.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBParser.$(O) GDBParser.$(H): GDBParser.st $(INCLUDE_TOP)/jv/libgdbs/GDBCommandStatus.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBPrimitiveValueDescriptor.$(O) GDBPrimitiveValueDescriptor.$(H): GDBPrimitiveValueDescriptor.st $(INCLUDE_TOP)/jv/libgdbs/GDBValueDescriptor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)GDBSessionRecorder.$(O) GDBSessionRecorder.$(H): GDBSessionRecorder.st $(INCLUDE_TOP)/jv/libgdbs/GDBDebugFlags.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)GDBSimulatorProcess.$(O) GDBSimulatorProcess.$(H): GDBSimulatorProcess.st $(INCLUDE_TOP)/jv/libgdbs/GDBProcess.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBStreamOutputEvent.$(O) GDBStreamOutputEvent.$(H): GDBStreamOutputEvent.st $(INCLUDE_TOP)/jv/libgdbs/GDBEvent.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBUnixProcess.$(O) GDBUnixProcess.$(H): GDBUnixProcess.st $(INCLUDE_TOP)/jv/libgdbs/GDBProcess.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBAddresValueDescriptor.$(O) GDBAddresValueDescriptor.$(H): GDBAddresValueDescriptor.st $(INCLUDE_TOP)/jv/libgdbs/GDBPrimitiveValueDescriptor.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBValueDescriptor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec	Fri Jun 20 22:14:51 2014 +0100
+++ b/Make.spec	Mon Jun 23 09:45:16 2014 +0100
@@ -75,6 +75,8 @@
 	GDBMICommand \
 	GDBParser \
 	GDBPrimitiveValueDescriptor \
+	GDBSessionRecorder \
+	GDBSimulatorProcess \
 	GDBStreamOutputEvent \
 	GDBUnixProcess \
 	GDBAddresValueDescriptor \
@@ -241,6 +243,8 @@
     $(OUTDIR_SLASH)GDBMICommand.$(O) \
     $(OUTDIR_SLASH)GDBParser.$(O) \
     $(OUTDIR_SLASH)GDBPrimitiveValueDescriptor.$(O) \
+    $(OUTDIR_SLASH)GDBSessionRecorder.$(O) \
+    $(OUTDIR_SLASH)GDBSimulatorProcess.$(O) \
     $(OUTDIR_SLASH)GDBStreamOutputEvent.$(O) \
     $(OUTDIR_SLASH)GDBUnixProcess.$(O) \
     $(OUTDIR_SLASH)GDBAddresValueDescriptor.$(O) \
--- a/abbrev.stc	Fri Jun 20 22:14:51 2014 +0100
+++ b/abbrev.stc	Mon Jun 23 09:45:16 2014 +0100
@@ -26,6 +26,8 @@
 GDBMICommand GDBMICommand jv:libgdbs 'GDB-Core-Commands' 0
 GDBParser GDBParser jv:libgdbs 'GDB-Private' 0
 GDBPrimitiveValueDescriptor GDBPrimitiveValueDescriptor jv:libgdbs 'GDB-Private-Descriptors' 0
+GDBSessionRecorder GDBSessionRecorder jv:libgdbs 'GDB-Private-Simulator' 0
+GDBSimulatorProcess GDBSimulatorProcess jv:libgdbs 'GDB-Private' 0
 GDBStreamOutputEvent GDBStreamOutputEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBUnixProcess GDBUnixProcess jv:libgdbs 'GDB-Private' 0
 GDBAddresValueDescriptor GDBAddresValueDescriptor jv:libgdbs 'GDB-Private-Descriptors' 0
--- a/bc.mak	Fri Jun 20 22:14:51 2014 +0100
+++ b/bc.mak	Mon Jun 23 09:45:16 2014 +0100
@@ -93,6 +93,8 @@
 $(OUTDIR)GDBMICommand.$(O) GDBMICommand.$(H): GDBMICommand.st $(INCLUDE_TOP)\jv\libgdbs\GDBCommand.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBParser.$(O) GDBParser.$(H): GDBParser.st $(INCLUDE_TOP)\jv\libgdbs\GDBCommandStatus.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBPrimitiveValueDescriptor.$(O) GDBPrimitiveValueDescriptor.$(H): GDBPrimitiveValueDescriptor.st $(INCLUDE_TOP)\jv\libgdbs\GDBValueDescriptor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GDBSessionRecorder.$(O) GDBSessionRecorder.$(H): GDBSessionRecorder.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebugFlags.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GDBSimulatorProcess.$(O) GDBSimulatorProcess.$(H): GDBSimulatorProcess.st $(INCLUDE_TOP)\jv\libgdbs\GDBProcess.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBStreamOutputEvent.$(O) GDBStreamOutputEvent.$(H): GDBStreamOutputEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBUnixProcess.$(O) GDBUnixProcess.$(H): GDBUnixProcess.st $(INCLUDE_TOP)\jv\libgdbs\GDBProcess.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBAddresValueDescriptor.$(O) GDBAddresValueDescriptor.$(H): GDBAddresValueDescriptor.st $(INCLUDE_TOP)\jv\libgdbs\GDBPrimitiveValueDescriptor.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBValueDescriptor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/jv_libgdbs.st	Fri Jun 20 22:14:51 2014 +0100
+++ b/jv_libgdbs.st	Mon Jun 23 09:45:16 2014 +0100
@@ -89,6 +89,8 @@
         GDBMICommand
         GDBParser
         GDBPrimitiveValueDescriptor
+        GDBSessionRecorder
+        GDBSimulatorProcess
         GDBStreamOutputEvent
         GDBUnixProcess
         GDBAddresValueDescriptor
--- a/libInit.cc	Fri Jun 20 22:14:51 2014 +0100
+++ b/libInit.cc	Mon Jun 23 09:45:16 2014 +0100
@@ -52,6 +52,8 @@
 _GDBMICommand_Init(pass,__pRT__,snd);
 _GDBParser_Init(pass,__pRT__,snd);
 _GDBPrimitiveValueDescriptor_Init(pass,__pRT__,snd);
+_GDBSessionRecorder_Init(pass,__pRT__,snd);
+_GDBSimulatorProcess_Init(pass,__pRT__,snd);
 _GDBStreamOutputEvent_Init(pass,__pRT__,snd);
 _GDBUnixProcess_Init(pass,__pRT__,snd);
 _GDBAddresValueDescriptor_Init(pass,__pRT__,snd);
--- a/libgdbs.rc	Fri Jun 20 22:14:51 2014 +0100
+++ b/libgdbs.rc	Mon Jun 23 09:45:16 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Fri, 20 Jun 2014 21:13:53 GMT\0"
+      VALUE "ProductDate", "Mon, 23 Jun 2014 08:39:53 GMT\0"
     END
 
   END
--- a/tests/tests.rc	Fri Jun 20 22:14:51 2014 +0100
+++ b/tests/tests.rc	Mon Jun 23 09:45:16 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Fri, 20 Jun 2014 21:13:55 GMT\0"
+      VALUE "ProductDate", "Mon, 23 Jun 2014 08:39:56 GMT\0"
     END
 
   END