Autodetect GDB data directory
As a courtesy to the us who use GDB from build tree, try to detect
and automatically add --data-directory if no arguments are specified
in GDB command (`GDBProcess gdbCommand`).
"
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 }"
GDBObject subclass:#GDBCommandResult
instanceVariableNames:'command status value'
classVariableNames:''
poolDictionaries:'GDBCommandStatus'
category:'GDB-Core-Commands'
!
!GDBCommandResult 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
"
! !
!GDBCommandResult methodsFor:'accessing'!
command
^ command
!
command:aGDBCommand
command := aGDBCommand.
!
status
^ status
!
status:statusValue
status := statusValue.
!
value
"Returns a command result value as GDB object or nil, if
command result is just a set of properties. In that case,
use #propertyAt: to query individual property values."
^ value
"Modified (comment): / 19-03-2015 / 08:19:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBCommandResult methodsFor:'accessing-properties'!
properties
^ GDBObject getPropertiesOf: self.
"Modified: / 20-06-2014 / 09:04:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
propertyAt: name
"/ We shoud ignore `status` or `command` instvars
"/ these are used for other purposes here.
(name ~= #value and:[self class instanceVariableNames includes: name]) ifTrue:[
properties isNil ifTrue:[ ^ nil ].
^ properties at: name ifAbsent: [ nil ].
].
^ GDBObject getProperty: name of: self
"Created: / 31-05-2014 / 00:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-12-2018 / 20:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
propertyAt: name put: val
"/ We shoud not set `status` or `command` instvars even if
"/ command response contains 'property' with that names -
"/ these are used for other purposes here.
(name ~= #value and:[self class instanceVariableNames includes: name]) ifTrue:[
properties isNil ifTrue:[
properties := Dictionary new.
properties at: name put: val.
].
^ self
].
^ GDBObject setProperty: name of: self to: val
"Created: / 31-05-2014 / 00:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-12-2018 / 20:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBCommandResult methodsFor:'printing & storing'!
printOn:aStream
"append a printed representation of the receiver to the argument, aStream"
super printOn:aStream.
aStream
nextPut:$(;
nextPutAll: status;
nextPutAll:': ';
nextPutAll: command asString;
nextPut:$).
"Modified: / 19-01-2019 / 22:58:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBCommandResult methodsFor:'testing'!
isDone
^ status = CommandStatusDone
"Created: / 12-06-2017 / 09:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isError
^ status = CommandStatusError
"Created: / 12-06-2017 / 09:36:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBCommandResult class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !