GDBVariableObject.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 05 Feb 2018 21:45:22 +0000
changeset 107 7a315f1c9260
parent 106 12c96f17fc53
child 108 f34505ec6a7f
permissions -rw-r--r--
Variable objects: added `#path` returning an absolute expression to access the value in source langiage ...as opositte to `#expression` with return a parent-relative expression.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     1
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     4
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     5
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     7
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     8
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
     9
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    10
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    13
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    14
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    16
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    18
"
74
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs' }"
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: Smalltalk }"
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    23
GDBDebuggerObject subclass:#GDBVariableObject
107
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
    24
	instanceVariableNames:'parent name exp path thread frame value type numchild has_more
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    25
		children changed inScope'
74
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	classVariableNames:''
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	poolDictionaries:''
102
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
    28
	category:'GDB-Core'
74
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    31
!GDBVariableObject class methodsFor:'documentation'!
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    32
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    33
copyright
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    34
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    35
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    36
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    37
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    38
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    39
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    40
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    41
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    42
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    43
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    44
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    45
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    46
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    47
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    48
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    49
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    50
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    51
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 83
diff changeset
    52
! !
83
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
    53
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    54
!GDBVariableObject class methodsFor:'instance creation'!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    55
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    56
new
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    57
    "return an initialized instance"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    58
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    59
    ^ self basicNew initialize.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    60
! !
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    61
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    62
!GDBVariableObject class methodsFor:'accessing - GDB value descriptors'!
74
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
description
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    ^ (super description)
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
        define:#name as:String;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
        define:#numchild as:Integer;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
        define:#value as:String;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
        define:#type as:String;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
        define:#'thread-id' as:Integer;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
        define:#has_more as:Boolean;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
        define:#dynamic as:Boolean;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
        define:#displayhint as:String;
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
        yourself
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    "Created: / 16-09-2014 / 23:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    "Modified: / 27-02-2015 / 17:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
! !
d53d325c2930 Initial work on varobjs. Tests locks up an image, should be polished and folded.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    80
!GDBVariableObject methodsFor:'accessing'!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    81
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    82
children
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    83
    self isValid ifFalse:[ ^ #() ].
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    84
    children isNil ifTrue:[ 
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    85
        self hasChildren ifTrue:[
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    86
            | result |
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    87
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    88
            result := debugger send: (GDBMI_var_list_children arguments: (Array with: '--all-values' with: name)).
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    89
            children := result propertyAt: #children.   
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    90
            children do:[:each | each setDebugger: debugger; setParent: self ].
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    91
        ] ifFalse:[ 
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    92
            children := #().
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    93
        ].
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    94
    ].
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    95
    ^ children
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    96
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    97
    "Created: / 27-01-2018 / 22:53:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
    98
    "Modified: / 13-02-2018 / 10:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
    99
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   100
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   101
expression
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   102
    "Return the expression in target language to access the value (asDtring)
107
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   103
     The expression is relative to it's direct parent (if any),
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   104
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   105
     For example, consider
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   106
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   107
         typedef struct _point {
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   108
            int x;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   109
            int y;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   110
         } point;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   111
         ...
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   112
         point p1 = { 10, 20 };
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   113
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   114
     and consider a variable object `o` that represents `y` member of point 
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   115
     `p1`. Then:
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   116
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   117
        o path '/ -> 'p1.y'
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   118
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   119
    while
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   120
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   121
        p expression '/ -> 'y'
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   122
    "
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   123
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   124
    ^ exp
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   125
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   126
    "Created: / 28-01-2018 / 21:36:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
107
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   127
    "Modified (comment): / 05-02-2018 / 21:16:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   128
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   129
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   130
id
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   131
    "Returns the GDB ID (name) of the variable object. This is
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   132
    used in commands to identify a variable object instance."
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   133
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   134
    ^ name
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   135
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   136
    "Created: / 28-01-2018 / 21:35:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   137
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   138
107
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   139
parent
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   140
    ^ parent
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   141
!
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   142
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   143
path
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   144
    "Return (absolute) expression in target language to access the value 
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   145
     (asDtring).
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   146
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   147
     For example, consider
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   148
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   149
         typedef struct _point {
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   150
            int x;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   151
            int y;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   152
         } point;
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   153
         ...
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   154
         point p1 = { 10, 20 };
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   155
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   156
     and consider a variable object `o` that represents `y` member of point 
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   157
     `p1`. Then:
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   158
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   159
        o path '/ -> 'p1.y'
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   160
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   161
    while
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   162
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   163
        p expression '/ -> 'y'
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   164
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   165
    "
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   166
    path isNil ifTrue:[ 
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   167
        | result |
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   168
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   169
        result := debugger send: (GDBMI_var_info_path_expression arguments: (Array with: name)).
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   170
        path := result propertyAt: #'path_expr'.
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   171
    ].
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   172
    ^ path
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   173
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   174
    "Created: / 05-02-2018 / 21:16:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   175
!
7a315f1c9260 Variable objects: added `#path` returning an absolute expression to access the value in source langiage
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   176
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   177
thread
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   178
    "
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   179
    If a variable object is bound to a specific thread, returns
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   180
    that thread (as GDBThread). Otherwise, `nil` is returned.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   181
    "
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   182
    | threadId |
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   183
    thread isInteger ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   184
        threadId := thread.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   185
        thread := debugger threadForId: threadId.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   186
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   187
    ^ thread
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   188
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   189
    "Created: / 04-02-2018 / 21:35:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   190
    "Modified: / 12-02-2018 / 18:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   191
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   192
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   193
type
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   194
    ^ type
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   195
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   196
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   197
value
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   198
    changed value. "/ to force update if necessary
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   199
    self isValid ifFalse:[ ^ self class classResources string: '<invalid>' ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   200
    self inScope ifFalse:[ ^ self class classResources string: '<out-of-scope>' ].
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   201
    ^ value
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   202
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   203
    "Modified: / 12-02-2018 / 22:00:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   204
! !
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   205
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   206
!GDBVariableObject methodsFor:'displaying'!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   207
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   208
displayOn: aStream
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   209
    self displayOn: aStream indent: 0
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   210
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   211
    "Created: / 28-01-2018 / 21:40:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   212
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   213
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   214
displayOn: aStream indent: anInteger
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   215
    aStream next: anInteger * 4 put: Character space.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   216
    aStream nextPutAll: exp; space; nextPut: $=; space.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   217
    self hasChildren ifTrue:[ 
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   218
        aStream nextPut:${; cr.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   219
        self children do:[:each | 
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   220
            each displayOn: aStream indent: anInteger + 1.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   221
            aStream cr.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   222
        ].
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   223
        aStream next: anInteger * 4 put: Character space; nextPut:$}.
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   224
    ] ifFalse: [ 
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   225
        aStream nextPutAll: value
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   226
    ].
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   227
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   228
    "Created: / 28-01-2018 / 21:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   229
! !
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   230
102
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   231
!GDBVariableObject methodsFor:'finalization'!
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   232
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   233
executor
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   234
    ^ GDBVariableObjectExecutor new 
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   235
            setDebugger: debugger;
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   236
            setId: name;
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   237
            yourself
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   238
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   239
    "Created: / 28-01-2018 / 23:27:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   240
!
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   241
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   242
finalizationLobby
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   243
    self assert: debugger notNil.
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   244
    ^ debugger finalizationRegistry.
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   245
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   246
    "Created: / 28-01-2018 / 23:21:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   247
! !
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 101
diff changeset
   248
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   249
!GDBVariableObject methodsFor:'initialization & release'!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   250
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   251
initialize
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   252
    "Invoked when a new instance is created."
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   253
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   254
    super initialize.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   255
    inScope := true.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   256
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   257
    "Modified: / 12-02-2018 / 22:07:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   258
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   259
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   260
release
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   261
    "Releases the variable object and all its children. Once released, 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   262
     the variable object is invalid (i.e., `#isValid` would return `false`) 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   263
     and should not be used anymore."
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   264
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   265
    self release: true
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   266
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   267
    "Created: / 04-02-2018 / 23:21:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   268
    "Modified: / 13-02-2018 / 09:37:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   269
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   270
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   271
release: delete
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   272
    "Releases the variable object and all its children. If 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   273
     `delete` is `true`, send `-var-delete -c`."
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   274
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   275
    self assert: debugger notNil.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   276
    self assert: (delete not or:[ parent isNil ]) description: 'Only top-level objects can be deleted (for now)'.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   277
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   278
    "/ Release all children first, but not not 'delete' them 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   279
    "/ in GDB (will be done later)
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   280
    children notEmptyOrNil ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   281
        children do: [ :child | child release:false ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   282
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   283
    children := nil.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   284
    changed := [ changed := false. true ]. 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   285
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   286
    "/ Now 'delete' the variable and all its children
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   287
    "/ in GDB
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   288
    delete ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   289
        self unregisterForFinalization.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   290
        debugger isConnected ifTrue:[
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   291
            debugger send: (GDBMI_var_delete arguments: (Array with: '-c' with: name))
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   292
        ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   293
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   294
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   295
    "/ Finally, clear the debugger instvar (it's tested in
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   296
    "/ `#isValid`
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   297
    debugger := nil.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   298
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   299
    "Created: / 13-02-2018 / 09:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   300
!
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   301
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   302
setDebugger: aGDBDebugger
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   303
    super setDebugger: aGDBDebugger.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   304
    aGDBDebugger notNil ifTrue:[
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   305
        changed := GDBTransientDataHolder debugger: debugger factory: [ self updateChanged ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   306
    ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   307
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   308
    "Created: / 01-02-2018 / 09:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   309
!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   310
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   311
setExpression: aString
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   312
    exp := aString
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   313
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   314
    "Created: / 28-01-2018 / 21:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   315
!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   316
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   317
setParent: variableObjectOrNil
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   318
    self assert: (variableObjectOrNil isNil or:[ variableObjectOrNil isKindOf: self class ]).
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   319
    self assert: debugger notNil.
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   320
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   321
    "Created: / 27-01-2018 / 22:54:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   322
    "Modified: / 01-02-2018 / 09:29:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   323
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   324
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   325
thread_id: anInteger
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   326
    thread := anInteger
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   327
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   328
    "Created: / 04-02-2018 / 21:25:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   329
! !
100
aab8dd376f29 Fixed SubscriptionCollection >> value:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   330
103
56bf65352505 Variable objects: preserve the identity of `GDBFrame` and `GDBVariable` objects
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   331
83
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   332
!GDBVariableObject methodsFor:'printing & storing'!
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   333
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   334
printOn:aStream
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   335
    "append a printed representation if the receiver to the argument, aStream"
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   336
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   337
    super printOn:aStream.
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   338
    aStream nextPutAll:'('.
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   339
    value printOn: aStream.
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   340
    aStream nextPutAll:')'.
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   341
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   342
    "Created: / 13-06-2017 / 17:03:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   343
! !
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   344
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   345
!GDBVariableObject methodsFor:'queries'!
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   346
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   347
hasChanged
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   348
    ^ changed value
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   349
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   350
    "Created: / 30-01-2018 / 00:27:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   351
    "Modified: / 04-02-2018 / 22:16:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   352
!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   353
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   354
hasChildren
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   355
    ^ self isValid and:[numchild > 0 ]
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   356
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   357
    "Created: / 27-01-2018 / 22:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   358
    "Modified: / 04-02-2018 / 22:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   359
! !
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   360
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   361
!GDBVariableObject methodsFor:'testing'!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   362
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   363
inScope
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   364
   changed value. "/ to force update if necessary
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   365
    ^ inScope
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   366
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   367
    "Created: / 12-02-2018 / 21:56:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   368
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   369
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   370
isValid
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   371
    changed value. "/ to force update if necessary
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   372
    ^ debugger notNil
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   373
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   374
    "Created: / 04-02-2018 / 21:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   375
    "Modified: / 12-02-2018 / 22:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
101
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   376
! !
d8fee2af20b2 Variable objects: added support for composite types
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 100
diff changeset
   377
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   378
!GDBVariableObject methodsFor:'updating'!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   379
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   380
updateChanged
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   381
    "Check for updates and update all changed variables accordingly."
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   382
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   383
    debugger isNil ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   384
        changed := false.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   385
        ^ false.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   386
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   387
    (self thread notNil and:[ self thread isValid not]) ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   388
        self release.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   389
        ^ true
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   390
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   391
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   392
    parent notNil ifTrue:[ 
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   393
        parent updateChanged
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   394
    ] ifFalse:[
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   395
        | result changelist |
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   396
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   397
        result := debugger send: (GDBMI_var_update arguments: (Array with: '--all-values' with: name)).
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   398
        changelist := result propertyAt: #changelist.
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   399
        self updateChanged: changelist.        
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   400
    ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   401
    ^ false
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   402
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   403
    "Created: / 30-01-2018 / 01:08:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   404
    "Modified: / 12-02-2018 / 23:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   405
!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   406
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   407
updateChanged: changelist
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   408
    | change |
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   409
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   410
    changelist isEmptyOrNil ifTrue:[ ^ self ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   411
    change := changelist detect: [ :each | each id = self id ] ifNone:[nil].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   412
    change notNil ifTrue:[ 
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   413
        value := change value.
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   414
        inScope := change inScope.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   415
        inScope = 'invalid' ifTrue:[ 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   416
            self release.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   417
            ^ self.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   418
        ].
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   419
        changed value: true.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   420
        changelist remove: change.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   421
        changelist isEmptyOrNil ifTrue:[ ^ self ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   422
    ] ifFalse:[ 
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   423
        changed value: false.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   424
    ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   425
    children notEmptyOrNil ifTrue:[ 
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   426
        children do: [ :each | each updateChanged: changelist ]
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   427
    ].
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   428
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   429
    "Created: / 30-01-2018 / 01:09:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   430
    "Modified: / 12-02-2018 / 22:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   431
! !
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   432
83
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   433
!GDBVariableObject class methodsFor:'documentation'!
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   434
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   435
version_HG
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   436
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   437
    ^ '$Changeset: <not expanded> $'
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   438
! !
b2fb8968f1f4 Improved some #printOn: and #inspectorExtraAttributes to ease debugging
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 74
diff changeset
   439