GDB.st
changeset 19 c48d33e27d34
parent 12 568a2971c977
equal deleted inserted replaced
18:6bf3d5c400d1 19:c48d33e27d34
     1 "{ Package: 'jv:libgdbs' }"
     1 "{ Package: 'jv:libgdbs' }"
     2 
     2 
     3 Object subclass:#GDB
     3 Object subclass:#GDB
     4 	instanceVariableNames:'driver commandSequenceNumber snapshotSequenceNumber'
     4 	instanceVariableNames:'driver commandSequenceNumber inferiorStateSequenceNumber'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:'GDBCommandStatus'
     6 	poolDictionaries:'GDBCommandStatus'
     7 	category:'GDB-Core'
     7 	category:'GDB-Core'
     8 !
     8 !
     9 
     9 
    45     "Modified: / 09-06-2014 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    45     "Modified: / 09-06-2014 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    46 ! !
    46 ! !
    47 
    47 
    48 !GDB methodsFor:'accessing-private'!
    48 !GDB methodsFor:'accessing-private'!
    49 
    49 
       
    50 currentInferiorStateSequnceNumber
       
    51     ^ inferiorStateSequenceNumber
       
    52 
       
    53     "Created: / 19-06-2014 / 22:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    54 !
       
    55 
    50 nextCommandSequnceNumber
    56 nextCommandSequnceNumber
    51     commandSequenceNumber := commandSequenceNumber + 1.
    57     commandSequenceNumber := commandSequenceNumber + 1.
    52     commandSequenceNumber == SmallInteger maxVal ifTrue:[ 
    58     commandSequenceNumber == SmallInteger maxVal ifTrue:[ 
    53         commandSequenceNumber := 0.
    59         commandSequenceNumber := 0.
    54     ].
    60     ].
    55     ^ commandSequenceNumber
    61     ^ commandSequenceNumber
    56 
    62 
    57     "Created: / 02-06-2014 / 23:48:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    63     "Created: / 02-06-2014 / 23:48:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    58 !
    64 !
    59 
    65 
    60 nextSnapshotSequnceNumber
    66 nextInferiorStateSequnceNumber
    61     snapshotSequenceNumber := snapshotSequenceNumber + 1.
    67     inferiorStateSequenceNumber := inferiorStateSequenceNumber + 1.
    62     snapshotSequenceNumber == SmallInteger maxVal ifTrue:[ 
    68     inferiorStateSequenceNumber == SmallInteger maxVal ifTrue:[
    63         snapshotSequenceNumber := 0.
    69         inferiorStateSequenceNumber := 0.
    64     ].
    70     ].
    65     ^ snapshotSequenceNumber
    71     ^ inferiorStateSequenceNumber
    66 
    72 
    67     "Created: / 02-06-2014 / 23:48:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    73     "Created: / 02-06-2014 / 23:48:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    68 ! !
    74 ! !
    69 
    75 
    70 !GDB methodsFor:'commands'!
    76 !GDB methodsFor:'commands'!
   110 
   116 
   111     "Created: / 02-06-2014 / 23:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   117     "Created: / 02-06-2014 / 23:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   112     "Modified: / 04-06-2014 / 09:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   118     "Modified: / 04-06-2014 / 09:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   113 !
   119 !
   114 
   120 
       
   121 onExecutionEvent: aGDBExecutionEvent
       
   122     self nextInferiorStateSequnceNumber.
       
   123 
       
   124     "Created: / 19-06-2014 / 22:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   125 !
       
   126 
   115 onExit: aGDBExitEvent
   127 onExit: aGDBExitEvent
   116     self release.
   128     self release.
   117 
   129 
   118     "Created: / 03-06-2014 / 00:36:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   130     "Created: / 03-06-2014 / 00:36:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   119     "Modified: / 04-06-2014 / 09:28:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   131     "Modified: / 04-06-2014 / 09:28:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   132 initialize
   144 initialize
   133     self registerForFinalization.
   145     self registerForFinalization.
   134     driver := GDBLauncher startGDB.
   146     driver := GDBLauncher startGDB.
   135 
   147 
   136     commandSequenceNumber := 0.
   148     commandSequenceNumber := 0.
   137     snapshotSequenceNumber := 0.
   149     inferiorStateSequenceNumber := 0.
   138 
   150 
   139     self announcer
   151     driver eventAnnouncerInternal
   140         when: GDBCommandResultEvent     send: #onCommandResult: to: self;
   152         when: GDBCommandResultEvent     send: #onCommandResult: to: self;
   141         when: GDBExitEvent              send: #onExit: to: self.
   153         when: GDBExitEvent              send: #onExit: to: self;
       
   154         when: GDBExecutionEvent         send: #onExecutionEvent: to: self.
       
   155         
   142 
   156 
   143     driver eventPumpStart.
   157     driver eventPumpStart.
   144     driver eventDispatchStart.
   158     driver eventDispatchStart.
   145 
   159 
   146 "/    self send: (GDBMICommand inferiorTtySet: driver inferiorPTY name).
   160 "/    self send: (GDBMICommand inferiorTtySet: driver inferiorPTY name).
   147     self send: (GDBMI_inferior_tty_set arguments: { driver inferiorPTY name })
   161     self send: (GDBMI_inferior_tty_set arguments: { driver inferiorPTY name })
   148 
   162 
   149     "Created: / 26-05-2014 / 21:23:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163     "Created: / 26-05-2014 / 21:23:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   150     "Modified: / 12-06-2014 / 01:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   164     "Modified: / 19-06-2014 / 22:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   151 !
   165 !
   152 
   166 
   153 release
   167 release
   154     driver notNil ifTrue:[ 
   168     driver notNil ifTrue:[ 
   155         driver release.
   169         driver release.