GDBCommand.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 08 Sep 2023 12:40:22 +0100
changeset 317 7f63737e0374
parent 272 cdd1c9ad00de
permissions -rw-r--r--
Fix `GDBMIDebugger` after rename of `GDBStXUnixProcess` to `GDBUnixProcess` ...in commit d1422e1ee.

"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2023 LabWare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
"{ Package: 'jv:libgdbs' }"

"{ NameSpace: Smalltalk }"

Object subclass:#GDBCommand
	instanceVariableNames:'token'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Commands'
!

!GDBCommand class methodsFor:'documentation'!

copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2023 LabWare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
! !

!GDBCommand class methodsFor:'utilities'!

parse: aStringOrStream
    "Return an sub-instance of GDBCommand from textual representation"

    ^ (GDBMIParser on: aStringOrStream readStream) parseCommand.

    "
    GDBCommand parse: 'b new.c : 123'
    "

    "Created: / 08-01-2018 / 19:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBCommand methodsFor:'accessing'!

token
    ^ token
!

token:anInteger
    token := anInteger.
! !

!GDBCommand methodsFor:'accessing-descriptors'!

resultDescription
    ^ GDBMAContainer new

    "Created: / 19-06-2014 / 21:39:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 23-09-2014 / 23:37:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBCommand methodsFor:'converting'!

asString
    ^ String streamContents: [ :s | (GDBMIPrinter on: s) printCommand: self ]

    "Created: / 09-06-2014 / 18:42:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 11-07-2017 / 23:14:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBCommand methodsFor:'hooks'!

postExecuteIn: debugger result: result 
    "This is called when a result for this command is retrieved. Subclasses
     may override this to react on result (usually only when command succeeds).

     In particular this is used to inject artificial events back onto event queue.
     This is needed for some MI commands since the GDB does not emit events
     (such as `=breakpoint-modified` or `=thread-selected` when the change originated
     from MI command. This GDB behavior is very unlikely to change."

    "Nothing by default"

    "Created: / 09-03-2021 / 10:44:45 / Jan Vrany <jan.vrany@labware.com>"
!

preExecuteIn: debugger 
    "This is called just before the command is sent to GDB for processing. Subclasses
     may override this."

    "Nothing by default"

    "Created: / 10-03-2021 / 13:26:20 / Jan Vrany <jan.vrany@labware.com>"
! !

!GDBCommand methodsFor:'printing & storing'!

printOn: aStream
    super printOn: aStream.
    aStream nextPut: $(; nextPutAll: self asString; nextPut:$)

    "Created: / 11-07-2017 / 23:23:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBCommand methodsFor:'testing'!

isCLICommand
    ^ false
!

isMICommand
    ^ false
! !

!GDBCommand class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !