GDBObject.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 07 Sep 2014 14:42:02 +0100
changeset 35 c17ecf90e446
parent 20 76ac209277a7
child 45 deb908479a37
permissions -rw-r--r--
Initial support for thread groups, threads and breakpoints.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'jv:libgdbs' }"
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Object subclass:#GDBObject
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
	instanceVariableNames:'properties'
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
	classVariableNames:''
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	poolDictionaries:''
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	category:'GDB-Core'
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
!
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
17
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    10
!GDBObject class methodsFor:'accessing - GDB value descriptors'!
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    11
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    12
gdbValueDescriptor
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    13
    ^ GDBObjectValueDescriptor forClass: self.
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    14
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    15
    "Created: / 18-06-2014 / 23:12:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    16
! !
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    17
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    18
!GDBObject class methodsFor:'utilities - properties'!
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    19
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    20
getPropertiesOf: object
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    21
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    22
    | names index properties |
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    23
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    24
    names := object class allInstVarNames.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    25
    index := names indexOf: #properties.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    26
    index ~~ 0 ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    27
        properties := object instVarAt: index.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    28
        properties isNil ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    29
            properties := Dictionary new.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    30
            object instVarAt: index put: properties.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    31
            ^ properties
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    32
        ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    33
    ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    34
    ^ nil
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    35
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    36
    "Created: / 20-06-2014 / 09:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    37
!
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    38
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    39
getProperty: nm of: object
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    40
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    41
    | nmXlated names index properties |
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    42
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    43
    nmXlated := (nm includes: $-) ifTrue:[ nm copyReplaceAll: $- with: $_] ifFalse:[ nm ].
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    44
    index := (names := object class allInstVarNames) indexOf: nmXlated.
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    45
    index ~~ 0 ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    46
        ^ object instVarAt: index.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    47
    ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    48
    index := names indexOf: #properties.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    49
    index ~~ 0 ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    50
        properties := object instVarAt: index.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    51
        properties notNil ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    52
            ^ properties at: nm ifAbsent:[ nil ]
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    53
        ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    54
    ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    55
    ^ nil
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    56
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    57
    "Created: / 20-06-2014 / 08:59:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    58
    "Modified: / 06-09-2014 / 02:05:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    59
!
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    60
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    61
setProperty: nm of: object to: value
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    62
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    63
    | nmXlated names index properties |
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    64
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    65
    nmXlated := (nm includes: $-) ifTrue:[ nm copyReplaceAll: $- with: $_] ifFalse:[ nm ].
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    66
    index := (names := object class allInstVarNames) indexOf: nmXlated.
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    67
    index ~~ 0 ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    68
        object instVarAt: index put: value.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    69
    ] ifFalse:[
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    70
        index := names indexOf: #properties.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    71
        index ~~ 0 ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    72
            properties := object instVarAt: index.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    73
            properties isNil ifTrue:[ 
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    74
                properties := Dictionary new.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    75
                object instVarAt: index put: properties.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    76
            ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    77
            properties at: nm put: value.
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    78
        ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    79
    ].
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    80
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    81
    "Created: / 20-06-2014 / 09:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    82
    "Modified (format): / 06-09-2014 / 02:05:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
20
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    83
! !
76ac209277a7 Unified implementation of #propertyAt: & #propertyAt:put:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    84
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
!GDBObject methodsFor:'accessing-properties'!
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
17
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    87
properties
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    88
    ^ self class getPropertiesOf: self.
17
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    89
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    90
    "Modified: / 06-09-2014 / 01:49:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    91
!
10d696c79188 Value descroptors refactored.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    92
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
propertyAt: name
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    94
    ^ self class getProperty: name of: self
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    "Created: / 31-05-2014 / 00:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    97
    "Modified: / 06-09-2014 / 01:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
!
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
propertyAt: name put: value
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
   101
    ^ self class setProperty: name of: self to: value
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    "Created: / 31-05-2014 / 00:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
   104
    "Modified: / 06-09-2014 / 01:49:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
! !
29ea333a1811 More work on events and parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
16
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   107
!GDBObject methodsFor:'attributes access'!
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   108
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   109
objectAttributes
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   110
    ^ properties
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   111
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   112
    "Created: / 18-06-2014 / 07:56:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   113
!
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   114
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   115
objectAttributes: aDictionary
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   116
    properties := aDictionary
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   117
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   118
    "Created: / 18-06-2014 / 07:57:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   119
! !
a5a8c0454395 Work in progress - object descriptors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   120