|
1 " |
|
2 jv:vdb - Visual / VM Debugger |
|
3 Copyright (C) 2015-now Jan Vrany |
|
4 |
|
5 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' |
|
6 |
|
7 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ |
|
8 " |
|
9 "{ Package: 'jv:vdb' }" |
|
10 |
|
11 "{ NameSpace: Smalltalk }" |
|
12 |
|
13 VDBAbstractApplication subclass:#VDBMemoryApplication |
|
14 instanceVariableNames:'addressHolder sizeIndexHolder formatHolder memoryHolder' |
|
15 classVariableNames:'Sizes LastSizeIndex LastFormat' |
|
16 poolDictionaries:'GDBOutputFormats' |
|
17 category:'VDB-UI-Others' |
|
18 ! |
|
19 |
|
20 !VDBMemoryApplication class methodsFor:'documentation'! |
|
21 |
|
22 copyright |
|
23 " |
|
24 jv:vdb - Visual / VM Debugger |
|
25 Copyright (C) 2015-now Jan Vrany |
|
26 |
|
27 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' |
|
28 |
|
29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ |
|
30 " |
|
31 ! ! |
|
32 |
|
33 !VDBMemoryApplication class methodsFor:'initialization'! |
|
34 |
|
35 initialize |
|
36 "Invoked at system start or when the class is dynamically loaded." |
|
37 |
|
38 "/ please change as required (and remove this comment) |
|
39 |
|
40 Sizes := #( |
|
41 'Bytes' |
|
42 'Words (2 bytes)' |
|
43 'Doublewords (4 bytes)' |
|
44 'Quadwords (8 bytes)' |
|
45 'Octawords (16 bytes)' |
|
46 ). |
|
47 LastSizeIndex := ExternalAddress pointerSize == 4 ifTrue:[ 3 ] ifFalse:[ 4 ]. |
|
48 LastFormat := FormatPaddedHexadecimal. |
|
49 |
|
50 "Modified: / 26-01-2018 / 00:48:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
51 ! ! |
|
52 |
|
53 !VDBMemoryApplication class methodsFor:'interface specs'! |
|
54 |
|
55 windowSpec |
|
56 "This resource specification was automatically generated |
|
57 by the UIPainter of ST/X." |
|
58 |
|
59 "Do not manually edit this!! If it is corrupted, |
|
60 the UIPainter may not be able to read the specification." |
|
61 |
|
62 " |
|
63 UIPainter new openOnClass:VDBMemoryApplication andSelector:#windowSpec |
|
64 VDBMemoryApplication new openInterface:#windowSpec |
|
65 VDBMemoryApplication open |
|
66 " |
|
67 |
|
68 <resource: #canvas> |
|
69 |
|
70 ^ |
|
71 #(FullSpec |
|
72 name: windowSpec |
|
73 uuid: '0f71d330-02ee-11e8-a110-606720e43e2c' |
|
74 window: |
|
75 (WindowSpec |
|
76 label: 'NewApplication' |
|
77 name: 'NewApplication' |
|
78 uuid: '9ba699c1-0231-11e8-b0df-606720e43e2c' |
|
79 bounds: (Rectangle 0 0 854 502) |
|
80 ) |
|
81 component: |
|
82 (SpecCollection |
|
83 collection: ( |
|
84 (HorizontalPanelViewSpec |
|
85 name: 'HeaderBar' |
|
86 layout: (LayoutFrame 0 0 0 0 -90 1 30 0) |
|
87 uuid: '9ba6c0d0-0231-11e8-b0df-606720e43e2c' |
|
88 horizontalLayout: rightSpaceFit |
|
89 verticalLayout: center |
|
90 horizontalSpace: 3 |
|
91 verticalSpace: 3 |
|
92 component: |
|
93 (SpecCollection |
|
94 collection: ( |
|
95 (InputFieldSpec |
|
96 name: 'Address' |
|
97 uuid: '9ba6c0d1-0231-11e8-b0df-606720e43e2c' |
|
98 model: addressHolder |
|
99 acceptOnReturn: true |
|
100 acceptOnTab: true |
|
101 acceptOnPointerLeave: true |
|
102 emptyFieldReplacementText: 'Address' |
|
103 extent: (Point 285 22) |
|
104 ) |
|
105 (LabelSpec |
|
106 label: 'Size:' |
|
107 name: 'SizeLabel' |
|
108 uuid: '9ba6c0d2-0231-11e8-b0df-606720e43e2c' |
|
109 translateLabel: true |
|
110 useDefaultExtent: true |
|
111 ) |
|
112 (PopUpListSpec |
|
113 label: 'Size' |
|
114 name: 'Size' |
|
115 uuid: '9ba6c0d3-0231-11e8-b0df-606720e43e2c' |
|
116 translateLabel: true |
|
117 tabable: true |
|
118 model: sizeIndexHolder |
|
119 menu: sizeList |
|
120 useIndex: true |
|
121 extent: (Point 200 27) |
|
122 ) |
|
123 (LabelSpec |
|
124 label: 'Format:' |
|
125 name: 'FormatLabel' |
|
126 uuid: '9ba6c0d4-0231-11e8-b0df-606720e43e2c' |
|
127 translateLabel: true |
|
128 useDefaultExtent: true |
|
129 ) |
|
130 (PopUpListSpec |
|
131 label: 'Format' |
|
132 name: 'Format' |
|
133 uuid: '9ba6c0d5-0231-11e8-b0df-606720e43e2c' |
|
134 translateLabel: true |
|
135 tabable: true |
|
136 model: formatHolder |
|
137 menu: formatList |
|
138 extent: (Point 170 27) |
|
139 ) |
|
140 ) |
|
141 |
|
142 ) |
|
143 ) |
|
144 (MenuPanelSpec |
|
145 name: 'ToolBar' |
|
146 layout: (LayoutFrame -60 1 0 0 0 1 30 0) |
|
147 uuid: '9ba6c0d6-0231-11e8-b0df-606720e43e2c' |
|
148 menu: toolbarMenu |
|
149 textDefault: true |
|
150 ) |
|
151 (TextEditorSpec |
|
152 name: 'MemoryView' |
|
153 layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
154 uuid: '9ba6c0d7-0231-11e8-b0df-606720e43e2c' |
|
155 model: memoryHolder |
|
156 hasHorizontalScrollBar: true |
|
157 hasVerticalScrollBar: true |
|
158 isReadOnly: true |
|
159 hasKeyboardFocusInitially: false |
|
160 ) |
|
161 (TransparentBoxSpec |
|
162 name: 'FooterBar' |
|
163 layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
164 uuid: '9ba6c0d8-0231-11e8-b0df-606720e43e2c' |
|
165 ) |
|
166 ) |
|
167 |
|
168 ) |
|
169 ) |
|
170 ! ! |
|
171 |
|
172 !VDBMemoryApplication class methodsFor:'menu specs'! |
|
173 |
|
174 toolbarMenu |
|
175 "This resource specification was automatically generated |
|
176 by the MenuEditor of ST/X." |
|
177 |
|
178 "Do not manually edit this!! If it is corrupted, |
|
179 the MenuEditor may not be able to read the specification." |
|
180 |
|
181 |
|
182 " |
|
183 MenuEditor new openOnClass:VDBMemoryApplication andSelector:#toolbarMenu |
|
184 (Menu new fromLiteralArrayEncoding:(VDBMemoryApplication toolbarMenu)) startUp |
|
185 " |
|
186 |
|
187 <resource: #menu> |
|
188 |
|
189 ^ |
|
190 #(Menu |
|
191 ( |
|
192 (MenuItem |
|
193 label: 'Refresh' |
|
194 itemValue: doRefresh |
|
195 labelImage: (ResourceRetriever VDBIconLibrary #'refresh_tab') |
|
196 ) |
|
197 ) |
|
198 nil |
|
199 nil |
|
200 ) |
|
201 ! ! |
|
202 |
|
203 !VDBMemoryApplication class methodsFor:'plugIn spec'! |
|
204 |
|
205 aspectSelectors |
|
206 "This resource specification was automatically generated |
|
207 by the UIPainter of ST/X." |
|
208 |
|
209 "Do not manually edit this. If it is corrupted, |
|
210 the UIPainter may not be able to read the specification." |
|
211 |
|
212 "Return a description of exported aspects; |
|
213 these can be connected to aspects of an embedding application |
|
214 (if this app is embedded in a subCanvas)." |
|
215 |
|
216 ^ #( |
|
217 #debuggerHolder |
|
218 ). |
|
219 |
|
220 ! ! |
|
221 |
|
222 !VDBMemoryApplication methodsFor:'accessing'! |
|
223 |
|
224 memory: aGDBMemoryDump |
|
225 self memoryHolder value: aGDBMemoryDump displayString. |
|
226 |
|
227 "Created: / 26-01-2018 / 22:51:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 ! ! |
|
229 |
|
230 !VDBMemoryApplication methodsFor:'aspects'! |
|
231 |
|
232 addressHolder |
|
233 <resource: #uiAspect> |
|
234 addressHolder isNil ifTrue:[ |
|
235 addressHolder := ValueHolder new. |
|
236 addressHolder addDependent:self. |
|
237 ]. |
|
238 ^ addressHolder. |
|
239 |
|
240 "Modified: / 26-01-2018 / 00:47:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
241 ! |
|
242 |
|
243 formatHolder |
|
244 formatHolder isNil ifTrue:[ |
|
245 formatHolder := ValueHolder with: LastFormat. |
|
246 formatHolder addDependent:self. |
|
247 ]. |
|
248 ^ formatHolder. |
|
249 |
|
250 "Modified: / 26-01-2018 / 00:47:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
251 ! |
|
252 |
|
253 formatList |
|
254 ^ GDBOutputFormats all |
|
255 |
|
256 "Created: / 26-01-2018 / 00:49:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
257 ! |
|
258 |
|
259 memoryHolder |
|
260 <resource: #uiAspect> |
|
261 |
|
262 "automatically generated by UIPainter ..." |
|
263 |
|
264 "*** the code below creates a default model when invoked." |
|
265 "*** (which may not be the one you wanted)" |
|
266 "*** Please change as required and accept it in the browser." |
|
267 "*** (and replace this comment by something more useful ;-)" |
|
268 |
|
269 memoryHolder isNil ifTrue:[ |
|
270 memoryHolder := '' asValue. |
|
271 "/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
272 "/ memoryHolder addDependent:self. |
|
273 "/ memoryHolder onChangeSend:#memoryHolderChanged to:self. |
|
274 ]. |
|
275 ^ memoryHolder. |
|
276 ! |
|
277 |
|
278 sizeIndexHolder |
|
279 <resource: #uiAspect> |
|
280 sizeIndexHolder isNil ifTrue:[ |
|
281 sizeIndexHolder := ValueHolder with: LastSizeIndex. |
|
282 sizeIndexHolder addDependent:self. |
|
283 ]. |
|
284 ^ sizeIndexHolder. |
|
285 |
|
286 "Modified: / 26-01-2018 / 00:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
287 ! |
|
288 |
|
289 sizeList |
|
290 ^ Sizes |
|
291 |
|
292 "Created: / 26-01-2018 / 00:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
293 ! ! |
|
294 |
|
295 !VDBMemoryApplication methodsFor:'change & update'! |
|
296 |
|
297 update |
|
298 | address size format ncols nrows ascii | |
|
299 |
|
300 address := self addressHolder value. |
|
301 address isEmptyOrNil ifTrue:[ ^ self memory: nil ]. |
|
302 size := 1 << (self sizeIndexHolder value - 1). |
|
303 format := self formatHolder value format. |
|
304 ncols := 4. |
|
305 nrows := 10. |
|
306 ascii := false. |
|
307 |
|
308 debugger |
|
309 send: (GDBMI_data_read_memory arguments: (Array with: address with: format with: size with: nrows with: ncols)) |
|
310 andWithResultDo:[ :result | self window sensor pushUserEvent: #memory: for: self withArgument: result value ] |
|
311 |
|
312 "Created: / 26-01-2018 / 12:41:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
313 "Modified: / 26-01-2018 / 23:07:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
314 ! |
|
315 |
|
316 update:aspect with:parameter from:sender |
|
317 "Invoked when an object that I depend upon sends a change notification." |
|
318 |
|
319 "stub code automatically generated - please change as required" |
|
320 |
|
321 (sender == addressHolder |
|
322 or:[ sender == sizeIndexHolder |
|
323 or:[ sender == formatHolder]]) |
|
324 ifTrue:[ |
|
325 self update. |
|
326 ^ self. |
|
327 ]. |
|
328 super update:aspect with:parameter from:sender |
|
329 |
|
330 "Modified: / 26-01-2018 / 12:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
331 ! ! |
|
332 |
|
333 !VDBMemoryApplication class methodsFor:'documentation'! |
|
334 |
|
335 version_HG |
|
336 |
|
337 ^ '$Changeset: <not expanded> $' |
|
338 ! ! |
|
339 |
|
340 |
|
341 VDBMemoryApplication initialize! |