18 " |
18 " |
19 "{ Package: 'jv:libgdbs' }" |
19 "{ Package: 'jv:libgdbs' }" |
20 |
20 |
21 "{ NameSpace: Smalltalk }" |
21 "{ NameSpace: Smalltalk }" |
22 |
22 |
23 GDBObject subclass:#GDBVariableObject |
23 GDBDebuggerObject subclass:#GDBVariableObject |
24 instanceVariableNames:'name value' |
24 instanceVariableNames:'parent name exp thread_id value type numchild has_more children' |
25 classVariableNames:'' |
25 classVariableNames:'' |
26 poolDictionaries:'' |
26 poolDictionaries:'' |
27 category:'GDB-Private-Model' |
27 category:'GDB-Private-Model' |
28 ! |
28 ! |
29 |
29 |
48 License along with this library; if not, write to the Free Software |
48 License along with this library; if not, write to the Free Software |
49 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
49 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
50 " |
50 " |
51 ! ! |
51 ! ! |
52 |
52 |
53 !GDBVariableObject methodsFor:'accessing'! |
53 !GDBVariableObject class methodsFor:'accessing - GDB value descriptors'! |
54 |
|
55 name |
|
56 ^ name |
|
57 ! |
|
58 |
|
59 value |
|
60 ^ value |
|
61 ! ! |
|
62 |
|
63 !GDBVariableObject methodsFor:'accessing - GDB value descriptors'! |
|
64 |
54 |
65 description |
55 description |
66 ^ (super description) |
56 ^ (super description) |
67 define:#name as:String; |
57 define:#name as:String; |
68 define:#numchild as:Integer; |
58 define:#numchild as:Integer; |
76 |
66 |
77 "Created: / 16-09-2014 / 23:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
67 "Created: / 16-09-2014 / 23:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
78 "Modified: / 27-02-2015 / 17:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
68 "Modified: / 27-02-2015 / 17:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
79 ! ! |
69 ! ! |
80 |
70 |
|
71 !GDBVariableObject methodsFor:'accessing'! |
|
72 |
|
73 children |
|
74 children isNil ifTrue:[ |
|
75 self hasChildren ifTrue:[ |
|
76 | result | |
|
77 |
|
78 result := debugger send: (GDBMI_var_list_children arguments: (Array with: '--all-values' with: name)). |
|
79 children := result propertyAt: #children. |
|
80 children do:[:each | each setDebugger: debugger; setParent: self ]. |
|
81 ] ifFalse:[ |
|
82 children := #(). |
|
83 ]. |
|
84 ]. |
|
85 ^ children |
|
86 |
|
87 "Created: / 27-01-2018 / 22:53:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
88 "Modified: / 28-01-2018 / 21:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 ! |
|
90 |
|
91 expression |
|
92 "Return the expression in target language to access the value (asDtring) |
|
93 The expression is relative to it's direct parent (if any)," |
|
94 |
|
95 ^ exp |
|
96 |
|
97 "Created: / 28-01-2018 / 21:36:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
98 ! |
|
99 |
|
100 id |
|
101 "Returns the GDB ID (name) of the variable object. This is |
|
102 used in commands to identify a variable object instance." |
|
103 |
|
104 ^ name |
|
105 |
|
106 "Created: / 28-01-2018 / 21:35:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
107 ! |
|
108 |
|
109 type |
|
110 ^ type |
|
111 ! |
|
112 |
|
113 value |
|
114 ^ value |
|
115 ! ! |
|
116 |
|
117 !GDBVariableObject methodsFor:'displaying'! |
|
118 |
|
119 displayOn: aStream |
|
120 self displayOn: aStream indent: 0 |
|
121 |
|
122 "Created: / 28-01-2018 / 21:40:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
123 ! |
|
124 |
|
125 displayOn: aStream indent: anInteger |
|
126 aStream next: anInteger * 4 put: Character space. |
|
127 aStream nextPutAll: exp; space; nextPut: $=; space. |
|
128 self hasChildren ifTrue:[ |
|
129 aStream nextPut:${; cr. |
|
130 self children do:[:each | |
|
131 each displayOn: aStream indent: anInteger + 1. |
|
132 aStream cr. |
|
133 ]. |
|
134 aStream next: anInteger * 4 put: Character space; nextPut:$}. |
|
135 ] ifFalse: [ |
|
136 aStream nextPutAll: value |
|
137 ]. |
|
138 |
|
139 "Created: / 28-01-2018 / 21:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
140 ! ! |
|
141 |
|
142 !GDBVariableObject methodsFor:'initialization'! |
|
143 |
|
144 setExpression: aString |
|
145 exp := aString |
|
146 |
|
147 "Created: / 28-01-2018 / 21:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
148 ! |
|
149 |
|
150 setParent: variableObjectOrNil |
|
151 self assert: (variableObjectOrNil isNil or:[ variableObjectOrNil isKindOf: self class ]). |
|
152 parent := variableObjectOrNil |
|
153 |
|
154 "Created: / 27-01-2018 / 22:54:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 ! ! |
81 |
156 |
82 !GDBVariableObject methodsFor:'printing & storing'! |
157 !GDBVariableObject methodsFor:'printing & storing'! |
83 |
158 |
84 printOn:aStream |
159 printOn:aStream |
85 "append a printed representation if the receiver to the argument, aStream" |
160 "append a printed representation if the receiver to the argument, aStream" |
90 aStream nextPutAll:')'. |
165 aStream nextPutAll:')'. |
91 |
166 |
92 "Created: / 13-06-2017 / 17:03:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 "Created: / 13-06-2017 / 17:03:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
93 ! ! |
168 ! ! |
94 |
169 |
|
170 !GDBVariableObject methodsFor:'queries'! |
|
171 |
|
172 hasChildren |
|
173 ^ numchild > 0 |
|
174 |
|
175 "Created: / 27-01-2018 / 22:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 ! ! |
|
177 |
95 !GDBVariableObject class methodsFor:'documentation'! |
178 !GDBVariableObject class methodsFor:'documentation'! |
96 |
179 |
97 version_HG |
180 version_HG |
98 |
181 |
99 ^ '$Changeset: <not expanded> $' |
182 ^ '$Changeset: <not expanded> $' |