author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 18:47:18 +0200 | |
changeset 18902 | c2dea21fb224 |
parent 18790 | 78e603b2de19 |
child 18955 | 04da075fff78 |
permissions | -rw-r--r-- |
18779 | 1 |
"{ Encoding: utf8 }" |
2 |
||
34 | 3 |
" |
4 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 5 |
All Rights Reserved |
34 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2717 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
15591 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
34 | 18 |
InspectorView subclass:#ContextInspectorView |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
19 |
instanceVariableNames:'inspectedContext names showingTemporaries argsOnly contextSize |
18779 | 20 |
workspaceVariableNamesInDoIts allLocalVarsString |
21 |
allWorkspaceVarsString' |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
22 |
classVariableNames:'' |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
23 |
poolDictionaries:'' |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
24 |
category:'Interface-Inspector' |
34 | 25 |
! |
26 |
||
785 | 27 |
!ContextInspectorView class methodsFor:'documentation'! |
34 | 28 |
|
29 |
copyright |
|
30 |
" |
|
31 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 32 |
All Rights Reserved |
34 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
documentation |
|
44 |
" |
|
471 | 45 |
a modified Inspector for Contexts (used in the Debugger) |
46 |
TODO: |
|
47 |
when expressions are evaluated in myself, the inst-var |
|
48 |
names are not known by the expression evaluator. |
|
49 |
This has to be fixed |
|
50 |
(actual work is to be done in the Parser to allow passing of a context ...) |
|
510 | 51 |
|
52 |
[author:] |
|
53 |
Claus Gittinger |
|
54 |
||
55 |
[see also:] |
|
56 |
Context DebugView |
|
34 | 57 |
" |
58 |
! ! |
|
59 |
||
60 |
!ContextInspectorView methodsFor:'accessing'! |
|
61 |
||
868 | 62 |
inspect:aContext |
34 | 63 |
"set the context to be inspected" |
64 |
||
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
65 |
|methodHomeContext method homeNames rec sel |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
66 |
m blockNode |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
67 |
numVarsInSource numVarsInContext isDoIt |
5803 | 68 |
numArgs numVars n tempNames realTempNames |
11549 | 69 |
oldSelection oldSelectedName hCon keepList newList| |
34 | 70 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
71 |
oldSelection := selectionIndex. |
11549 | 72 |
oldSelection notNil ifTrue:[ |
73 |
oldSelectedName := (self listEntryAt:oldSelection). |
|
74 |
oldSelectedName notNil ifTrue:[ |
|
75 |
oldSelectedName := oldSelectedName string |
|
76 |
] |
|
77 |
]. |
|
49 | 78 |
|
11549 | 79 |
keepList := ((aContext == inspectedContext) |
80 |
"/ care for contexts which change size |
|
81 |
"/ (after the locals & stack-setup) |
|
13809 | 82 |
and:[ contextSize == inspectedContext size |
83 |
"/ care for JavaContexts whose set of visible variables |
|
84 |
"/ may change during method execution ( nested block locals... ) |
|
85 |
and:[ aContext isJavaContext not |
|
86 |
]]). |
|
11549 | 87 |
|
88 |
keepList ifTrue:[ |
|
89 |
"/ assume that the list remains unchanged; |
|
90 |
"/ this is no longer true, if some inst-slot has changed (bullet colors) |
|
91 |
UserPreferences current showTypeIndicatorInInspector ifTrue:[ |
|
92 |
newList := self fieldList. |
|
93 |
newList ~= listView list ifTrue:[ |
|
94 |
listView list:newList. |
|
95 |
] |
|
96 |
]. |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
97 |
] ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
98 |
hasMore := argsOnly := false. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
99 |
inspectedObject := object := nil. |
12456
87fdcd23e545
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
11630
diff
changeset
|
100 |
inspectedContext := object := aContext. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
101 |
contextSize := inspectedContext size. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
102 |
|
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
103 |
workspaceVariableNamesInDoIts := nil. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
104 |
aContext isNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
105 |
names := nil. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
106 |
listView list:nil. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
107 |
^ self |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
108 |
]. |
34 | 109 |
|
11549 | 110 |
methodHomeContext := aContext methodHome. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
111 |
(methodHomeContext isNil) ifTrue:[ |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
112 |
"its a cheap block's context" |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
113 |
rec := aContext receiver. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
114 |
sel := aContext selector. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
115 |
homeNames := OrderedCollection new. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
116 |
isDoIt := false. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
117 |
] ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
118 |
rec := methodHomeContext receiver. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
119 |
sel := methodHomeContext selector. |
34 | 120 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
121 |
"/ #doIt needs special handling below |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
122 |
isDoIt := (sel == #doIt) or:[sel == #doIt:]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
123 |
method := methodHomeContext method. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
124 |
|
9588
dc38e81ec660
comment/format in: #inspect:
Claus Gittinger <cg@exept.de>
parents:
9426
diff
changeset
|
125 |
(method notNil and:[method isWrapped]) ifTrue:[ |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
126 |
"/ in a wrapped context, locals are something different |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
127 |
argsOnly := true. |
1026
b863f3784b3c
oops - methods with inlined blockVars did not show its vars
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
128 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
129 |
m := method originalMethod. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
130 |
m notNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
131 |
method := m. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
132 |
] ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
133 |
argsOnly := true. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
134 |
]. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
135 |
]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
136 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
137 |
method notNil ifTrue:[ |
12904
550f2f25a5b4
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
138 |
argsOnly ifFalse:[ |
13809 | 139 |
homeNames := method methodArgAndVarNamesInContext: methodHomeContext. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
140 |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
141 |
"/ did it already allocate its locals ? |
13809 | 142 |
"/ |-----------------------------| care about Java contexts where this is first arg |
143 |
(homeNames size > (methodHomeContext arg1Index - 1 + methodHomeContext numArgs + methodHomeContext numVars)) ifTrue:[ |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
144 |
argsOnly := true. |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
145 |
]. |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
146 |
]. |
12904
550f2f25a5b4
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
147 |
argsOnly ifTrue:[ |
550f2f25a5b4
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
148 |
homeNames := method methodArgNames |
550f2f25a5b4
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
149 |
]. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
150 |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
151 |
"/ there is one case, where the above is by purpose: |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
152 |
"/ the #doIt - method, which has been given an invalid source. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
153 |
"/ Care for this here. |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
154 |
isDoIt ifTrue:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
155 |
homeNames := #(). |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
156 |
] ifFalse:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
157 |
"/ check |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
158 |
numVarsInContext := methodHomeContext argsAndVars size. |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
159 |
numVarsInSource := homeNames size. |
12904
550f2f25a5b4
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
160 |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
161 |
numVarsInSource > 0 ifTrue:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
162 |
numVarsInContext < numVarsInSource ifTrue:[ |
17774 | 163 |
"/ the method's source does not correctly reflect |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
164 |
"/ the number of args&vars in the context. |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
165 |
"/ either outDated, or somehow strange. |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
166 |
"/ (happens with wrapped methods, which are not |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
167 |
"/ what they look) |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
168 |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
169 |
numVarsInSource > numVarsInContext ifTrue:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
170 |
homeNames := homeNames copyTo:numVarsInContext. |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
171 |
] ifFalse:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
172 |
numVarsInContext >= methodHomeContext numArgs ifTrue:[ |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
173 |
homeNames := homeNames copyTo:methodHomeContext numArgs |
977 | 174 |
] ifFalse:[ |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
175 |
homeNames := nil |
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
176 |
] |
977 | 177 |
] |
785 | 178 |
] |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
179 |
] |
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
180 |
] |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
181 |
]. |
73 | 182 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
183 |
" |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
184 |
create dummy names for method vars (if there is no source available) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
185 |
" |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
186 |
homeNames isNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
187 |
homeNames := OrderedCollection new. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
188 |
1 to:methodHomeContext numArgs do:[:index | |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
189 |
homeNames add:('mArg' , index printString) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
190 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
191 |
argsOnly ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
192 |
1 to:methodHomeContext numVars do:[:index | |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
193 |
homeNames add:('mVar' , index printString) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
194 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
195 |
"/ showingTemporaries ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
196 |
"/ 1 to:methodHomeContext numTemps do:[:index | |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
197 |
"/ homeNames add:('mTmp' , index printString) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
198 |
"/ ] |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
199 |
"/ ] |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
200 |
] |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
201 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
202 |
showingTemporaries ifTrue:[ |
8581 | 203 |
homeNames := homeNames asOrderedCollection. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
204 |
1 to:methodHomeContext numTemps do:[:index | |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
205 |
homeNames add:('mTmp' , index printString) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
206 |
] |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
207 |
]. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
208 |
|
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
209 |
n := homeNames size. |
13809 | 210 |
n < (((argsOnly or:[methodHomeContext isJavaContext]) ifTrue:[0] ifFalse:[ methodHomeContext numVars]) + methodHomeContext numArgs) ifTrue:[ |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
211 |
"/ its a context which includes locals from |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
212 |
"/ inlined sub-blocks. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
213 |
"/ First, generate synthetic varNames ... |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
214 |
|
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
215 |
homeNames := homeNames asOrderedCollection. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
216 |
tempNames := OrderedCollection new. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
217 |
n to:(methodHomeContext numVars + methodHomeContext numArgs - 1) do:[:inlinedTempIdx | |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
218 |
tempNames add:('*t' , (inlinedTempIdx - n + 1) printString) |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
219 |
]. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
220 |
|
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
221 |
"/ now, see if we can find out more |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
222 |
"/ (fails, if source is not available) |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
223 |
|
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
224 |
method notNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
225 |
(isDoIt and:[tempNames size > 0]) ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
226 |
"/ special for #doIt |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
227 |
"/ my source is found in the method. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
228 |
blockNode := Compiler |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
229 |
blockAtLine:aContext lineNumber |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
230 |
in:nil |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
231 |
orSource:('[' , method source , '\]') withCRs |
18582 | 232 |
numArgs:numArgs "/ nil here |
233 |
numVars:numVars. "/ nil here |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
234 |
] ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
235 |
blockNode := Compiler |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
236 |
blockAtLine:methodHomeContext lineNumber |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
237 |
in:method |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
238 |
orSource:nil |
18582 | 239 |
numArgs:numArgs "/ nil here |
240 |
numVars:numVars. "/ nil here |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
241 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
242 |
|
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
243 |
realTempNames := OrderedCollection new. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
244 |
[blockNode notNil] whileTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
245 |
blockNode variables notNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
246 |
realTempNames := (blockNode variables collect:[:aVar | aVar name]) , realTempNames. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
247 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
248 |
blockNode arguments notNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
249 |
realTempNames := (blockNode arguments collect:[:aVar | aVar name]) , realTempNames. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
250 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
251 |
"/ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
252 |
"/ hidden temps used for loop. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
253 |
"/ |
9426 | 254 |
blockNode invocationSelector == #timesRepeat ifTrue:[ |
12779
4b9dd97e4033
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12456
diff
changeset
|
255 |
realTempNames := realTempNames asOrderedCollection. |
4b9dd97e4033
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12456
diff
changeset
|
256 |
realTempNames addFirst:'*loopStop*' |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
257 |
] ifFalse:[ |
9426 | 258 |
blockNode invocationSelector == #to:do: ifTrue:[ |
12779
4b9dd97e4033
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12456
diff
changeset
|
259 |
realTempNames := realTempNames asOrderedCollection. |
4b9dd97e4033
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12456
diff
changeset
|
260 |
realTempNames addFirst:'*loopStop*' |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
261 |
] |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
262 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
263 |
blockNode := blockNode home. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
264 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
265 |
tempNames |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
266 |
replaceFrom:1 to:(tempNames size min:realTempNames size) |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
267 |
with:realTempNames. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
268 |
]. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
269 |
homeNames addAll:tempNames. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
270 |
]. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
271 |
isDoIt ifTrue:[ |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
272 |
"/ care for workspace- and doIt vars |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
273 |
method notNil ifTrue:[ |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
274 |
|p names wsNames| |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
275 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
276 |
wsNames := Workspace workspaceVariableNames. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
277 |
wsNames notEmptyOrNil ifTrue:[ |
18582 | 278 |
p := Parser new |
279 |
source:method source; |
|
280 |
parseMethodBody; |
|
281 |
checkForEndOfInput; |
|
282 |
yourself. |
|
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
283 |
names := (Set withAll:p readGlobals) addAll:p modifiedGlobals; yourself. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
284 |
workspaceVariableNamesInDoIts := (names select:[:nm | wsNames includes:nm] ) |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
285 |
asOrderedCollection sort. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
286 |
]. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
287 |
]. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
288 |
]. |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
289 |
]. |
1204
e2f7a2409f7d
inlined vars/args are shown as *t<i>
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
290 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
291 |
" |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
292 |
stupid: should find the block via the contexts |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
293 |
method-home and put real names in here |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
294 |
" |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
295 |
aContext isBlockContext ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
296 |
names := self namesOfBlockContext:aContext. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
297 |
hCon := aContext home. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
298 |
[hCon == methodHomeContext] whileFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
299 |
names addAll:(self namesOfBlockContext:hCon). |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
300 |
hCon := hCon home. |
1370
d322faba88b9
better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents:
1361
diff
changeset
|
301 |
]. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
302 |
names addAll:homeNames. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
303 |
] ifFalse:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
304 |
names := homeNames. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
305 |
]. |
1370
d322faba88b9
better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents:
1361
diff
changeset
|
306 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
307 |
listView list:(self fieldList). |
1370
d322faba88b9
better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents:
1361
diff
changeset
|
308 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
309 |
workspace contents:nil. |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
310 |
self setDoitActionIn:workspace for:aContext. |
34 | 311 |
]. |
51 | 312 |
|
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
313 |
oldSelectedName notNil ifTrue:[ |
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
314 |
|idx| |
73 | 315 |
|
11549 | 316 |
idx := listView list findFirst:[:entry | (entry ? '') string = oldSelectedName]. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
317 |
idx ~~ 0 "(names includes:oldSelectedName)" ifTrue:[ |
1769
6b904f69858f
try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents:
1664
diff
changeset
|
318 |
listView selectElement:oldSelectedName. |
8516
e83b1f8fe73f
reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents:
8437
diff
changeset
|
319 |
self showSelection:idx. |
1769
6b904f69858f
try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents:
1664
diff
changeset
|
320 |
] |
6b904f69858f
try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents:
1664
diff
changeset
|
321 |
]. |
6b904f69858f
try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents:
1664
diff
changeset
|
322 |
|
11549 | 323 |
"Modified: / 03-06-2012 / 11:56:59 / cg" |
13809 | 324 |
"Modified: / 05-11-2013 / 15:44:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17774 | 325 |
"Modified (format): / 21-11-2017 / 13:00:53 / cg" |
18582 | 326 |
"Modified (comment): / 10-02-2019 / 16:39:38 / Claus Gittinger" |
34 | 327 |
! |
328 |
||
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
329 |
namesOfBlockContext:aContext |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
330 |
|numArgs numVars argAndVarNames argNames varNames tmpNames names| |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
331 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
332 |
numArgs := aContext numArgs. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
333 |
numVars := aContext numVars. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
334 |
|
13720
0c9ca76c6f23
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13454
diff
changeset
|
335 |
(numArgs + numVars) > 0 ifTrue:[ |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
336 |
argAndVarNames := aContext argAndVarNames. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
337 |
argAndVarNames notEmptyOrNil ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
338 |
argNames := argAndVarNames copyTo:numArgs. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
339 |
varNames := argAndVarNames copyFrom:numArgs+1. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
340 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
341 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
342 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
343 |
names := OrderedCollection new. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
344 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
345 |
argNames isNil ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
346 |
argNames := (1 to:numArgs) collect:[:i | 'arg' , i printString]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
347 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
348 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
349 |
names addAll:argNames. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
350 |
varNames isNil ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
351 |
varNames := (1 to:numVars) collect:[:i | 'var' , i printString]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
352 |
] ifFalse:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
353 |
varNames size ~~ numVars ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
354 |
varNames := varNames asOrderedCollection. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
355 |
varNames size+1 to:aContext numVars do:[:i | |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
356 |
varNames add:('var' , i printString) |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
357 |
] |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
358 |
] |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
359 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
360 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
361 |
names addAll:varNames. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
362 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
363 |
showingTemporaries ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
364 |
tmpNames := (1 to:(aContext numTemps)) collect:[:i | 'tmp' , i printString]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
365 |
names addAll:tmpNames. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
366 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
367 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
368 |
^ names |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
369 |
! |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
370 |
|
34 | 371 |
release |
372 |
"release inspected object" |
|
373 |
||
374 |
inspectedContext := nil. |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
375 |
names := nil. |
34 | 376 |
super release |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
377 |
|
297
3d34ce6e2b22
oops - leftover printMessage removed
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
378 |
"Modified: 14.12.1995 / 21:49:43 / cg" |
34 | 379 |
! ! |
380 |
||
73 | 381 |
!ContextInspectorView methodsFor:'initialization'! |
51 | 382 |
|
6491 | 383 |
initialize |
384 |
super initialize. |
|
385 |
showingTemporaries := false. |
|
18779 | 386 |
allLocalVarsString := '-',('all local vars' allItalic). |
387 |
allWorkspaceVarsString := '-',('all workspace vars' allItalic). |
|
6491 | 388 |
|
18779 | 389 |
"Modified: / 28-05-2019 / 06:31:18 / Claus Gittinger" |
6491 | 390 |
! ! |
391 |
||
392 |
!ContextInspectorView methodsFor:'menu'! |
|
393 |
||
73 | 394 |
fieldMenu |
1596
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
395 |
"return a popUpMenu for the left (fields) pane" |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
396 |
|
1361 | 397 |
<resource: #programMenu > |
398 |
||
6491 | 399 |
|items m sel| |
400 |
||
401 |
items := #( |
|
402 |
('Copy Name or Key' #doCopyKey) |
|
403 |
('-') |
|
404 |
('Inspect' #doInspect) |
|
405 |
('BasicInspect' #doBasicInspect) |
|
9351
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
406 |
). |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
407 |
NewInspector::NewInspectorView notNil ifTrue:[ |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
408 |
items := items , #( |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
409 |
('Inspect Hierarchical' #doNewInspect ) |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
410 |
). |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
411 |
]. |
99bd94741d5d
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
9033
diff
changeset
|
412 |
items := items , #( |
6491 | 413 |
('-') |
414 |
('Browse' #browse) |
|
415 |
). |
|
416 |
||
417 |
sel := self selection. |
|
12932
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
418 |
|
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
419 |
(sel isSymbol) ifTrue:[ |
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
420 |
items := items , #( |
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
421 |
('Browse Implementors' #browseImplementorsOfSymbolValue) |
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
422 |
). |
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
423 |
]. |
63707ac51242
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12904
diff
changeset
|
424 |
|
6852 | 425 |
Error |
426 |
handle:[:ex| ] |
|
427 |
do:[ |
|
7438 | 428 |
(sel isBlock or:[sel isContext]) ifTrue:[ |
429 |
items := items , #( |
|
10437 | 430 |
('Browse Block''s Home' #browseHome) |
7438 | 431 |
). |
432 |
]. |
|
433 |
(sel isMethod) ifTrue:[ |
|
434 |
items := items , #( |
|
10437 | 435 |
('Browse Method''s Class' #browseMethodsClass) |
7438 | 436 |
). |
437 |
]. |
|
6852 | 438 |
]. |
439 |
||
17208 | 440 |
sel isProtoObject ifFalse:[ |
441 |
items := items , (self optionalStreamSelectionItems). |
|
442 |
items := items , (self optionalFilenameSelectionItems). |
|
443 |
]. |
|
7640 | 444 |
|
6491 | 445 |
items := items , #( |
446 |
('-') |
|
447 |
). |
|
73 | 448 |
|
449 |
showingTemporaries ifFalse:[ |
|
6491 | 450 |
items := items , #( |
451 |
('Show Temporaries' #showTemporaries) |
|
1596
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
452 |
) |
73 | 453 |
] ifTrue:[ |
6491 | 454 |
items := items , #( |
455 |
('Hide temporaries' #hideTemporaries) |
|
1596
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
456 |
) |
73 | 457 |
]. |
458 |
||
7640 | 459 |
items := items , (self numberBaseItems). |
11630 | 460 |
items := items , (self sortOrderItems). |
7640 | 461 |
|
3105
9d80b49560ca
added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents:
2957
diff
changeset
|
462 |
m := PopUpMenu |
1596
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
463 |
itemList:items |
3105
9d80b49560ca
added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents:
2957
diff
changeset
|
464 |
resources:resources. |
9d80b49560ca
added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents:
2957
diff
changeset
|
465 |
|
3425 | 466 |
selectionIndex isNil ifTrue:[ |
12935
2149c6971ded
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12932
diff
changeset
|
467 |
m disableAll:#(doInspect doBasicInspect browse browseHome browseImplementorsOfSymbolValue) |
3425 | 468 |
] ifFalse:[ |
6491 | 469 |
sel isBlock ifFalse:[ |
3425 | 470 |
m disable:#browseHome |
6491 | 471 |
]. |
472 |
sel class hasImmediateInstances ifTrue:[ |
|
473 |
m disableAll:#(showReferences doNewInspect) |
|
474 |
]. |
|
3105
9d80b49560ca
added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents:
2957
diff
changeset
|
475 |
]. |
9d80b49560ca
added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents:
2957
diff
changeset
|
476 |
^ m |
1361 | 477 |
|
11630 | 478 |
"Modified: / 20-07-2012 / 10:51:12 / cg" |
73 | 479 |
! ! |
200 | 480 |
|
18563 | 481 |
!ContextInspectorView methodsFor:'presentation'! |
482 |
||
483 |
listEntryForName:nameString value:value |
|
484 |
"generates the fieldListEntry (icon + valueString). |
|
485 |
Special contexts may mix in text as separators between scopes; |
|
486 |
these are left as is" |
|
487 |
||
488 |
nameString isText ifTrue:[^ nameString]. |
|
489 |
^ super listEntryForName:nameString value:value |
|
490 |
||
491 |
"Created: / 26-01-2019 / 17:00:51 / Claus Gittinger" |
|
492 |
! ! |
|
493 |
||
200 | 494 |
!ContextInspectorView methodsFor:'private'! |
495 |
||
647 | 496 |
defaultLabel |
4095
5bd36b14723d
labels; added suppressPseudoVars & dereferenceValueHolders
Claus Gittinger <cg@exept.de>
parents:
3775
diff
changeset
|
497 |
^ 'Locals' |
647 | 498 |
|
499 |
" |
|
500 |
ContextInspectorView openOn:thisContext sender |
|
501 |
" |
|
502 |
||
503 |
"Modified: 28.6.1996 / 16:07:49 / cg" |
|
504 |
! |
|
505 |
||
3775 | 506 |
displayStringForValue:someValue |
507 |
"return the values displayString" |
|
508 |
||
509 |
|sel| |
|
510 |
||
11513 | 511 |
sel := self listEntryAt:selectionIndex. |
18779 | 512 |
(sel = allLocalVarsString) ifTrue:[ |
3775 | 513 |
^ self stringWithAllLocalValues |
514 |
]. |
|
18779 | 515 |
(sel = allWorkspaceVarsString) ifTrue:[ |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
516 |
^ self stringWithAllWorkspaceValues |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
517 |
]. |
3775 | 518 |
|
519 |
^ super displayStringForValue:someValue |
|
11513 | 520 |
|
521 |
"Modified: / 16-05-2012 / 17:55:33 / cg" |
|
18779 | 522 |
"Modified: / 28-05-2019 / 06:33:52 / Claus Gittinger" |
3775 | 523 |
! |
524 |
||
200 | 525 |
fieldList |
13454
feba94447645
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13453
diff
changeset
|
526 |
"generate a list of names (& pseudo names) to be shown on the left side" |
feba94447645
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13453
diff
changeset
|
527 |
|
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
528 |
|list| |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
529 |
|
14051
607958377e4f
Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13982
diff
changeset
|
530 |
inspectedContext isNil ifTrue:[ ^ #() ]. |
607958377e4f
Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13982
diff
changeset
|
531 |
|
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
532 |
names size == 0 ifTrue:[ |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
533 |
(inspectedContext isBlockContext and:[inspectedContext home isNil]) ifTrue:[ |
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
534 |
"/ hack to guide beginners |
16504 | 535 |
^ { '>> no home in cheap block <<' withColor:Color gray } |
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
536 |
]. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
537 |
list := #() |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
538 |
] ifFalse:[ |
18779 | 539 |
list := { allLocalVarsString } |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
540 |
, (names keysAndValuesCollect: |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
541 |
[:idx :nm | self listEntryForName:nm value:(self valueAtIndex:idx) ] |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
542 |
) |
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
543 |
]. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
544 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
545 |
workspaceVariableNamesInDoIts notEmptyOrNil ifTrue:[ |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
546 |
list := list |
18779 | 547 |
, { allWorkspaceVarsString } |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
548 |
, (workspaceVariableNamesInDoIts keysAndValuesCollect: |
13982
25d8cef3bc77
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13973
diff
changeset
|
549 |
[:idx :nm | self listEntryForName:nm value:(Workspace workspaceVariableAt:nm) ] |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
550 |
) |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
551 |
]. |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
552 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
553 |
^ list |
11515 | 554 |
|
555 |
"Modified: / 16-05-2012 / 18:54:59 / cg" |
|
14051
607958377e4f
Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13982
diff
changeset
|
556 |
"Modified: / 25-02-2014 / 15:10:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18779 | 557 |
"Modified: / 28-05-2019 / 06:31:33 / Claus Gittinger" |
200 | 558 |
! |
559 |
||
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
560 |
hasSelfEntry |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
561 |
^ false |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
562 |
|
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
563 |
"Created: 14.12.1995 / 19:29:47 / cg" |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
564 |
! |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
565 |
|
200 | 566 |
setDoitActionIn:aWorkspace for:aContext |
1596
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
567 |
aWorkspace |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
568 |
doItAction:[:theCode | |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
569 |
Compiler |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
570 |
evaluate:theCode |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
571 |
in:aContext |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
572 |
receiver:nil |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
573 |
notifying:aWorkspace |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
574 |
logged:true |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
575 |
ifFail:nil |
1c937a1d2d37
use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
576 |
] |
200 | 577 |
! |
578 |
||
3775 | 579 |
stringWithAllLocalValues |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
580 |
"when clicked on '-all local vars'" |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
581 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
582 |
^ self stringWithAllNames:names andValues:((1 to:names size) collect:[:i| (self valueAtIndex:i)]) |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
583 |
! |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
584 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
585 |
stringWithAllNames:names andValues:values |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
586 |
"helper for '-all local vars' and '-all workspace vars'" |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
587 |
|
15591 | 588 |
|outStream maxLen varString| |
3775 | 589 |
|
15591 | 590 |
outStream := CharacterWriteStream new. |
3775 | 591 |
maxLen := (names collect:[:eachName | eachName size]) max. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
592 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
593 |
names with:values do:[:eachName :eachValue | |
15591 | 594 |
outStream nextPutAll:((eachName , ' ') paddedTo:maxLen+1 with:$.). |
595 |
outStream nextPutAll:' : '. |
|
3775 | 596 |
|
5922 | 597 |
[ |
8634
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
598 |
|s| |
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
599 |
|
15591 | 600 |
s := CharacterWriteStream new. |
8634
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
601 |
s writeLimit:100000. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
602 |
eachValue displayOn:s. |
8634
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
603 |
varString := s contents. |
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
604 |
] on:Error do:[:ex | |
a37194c645be
limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents:
8581
diff
changeset
|
605 |
varString := ('*** Error in displayString (%1)***' bindWith:ex description) |
5922 | 606 |
]. |
607 |
||
3775 | 608 |
(varString includes:Character cr) ifTrue:[ |
609 |
varString := varString copyTo:(varString indexOf:Character cr)-1. |
|
610 |
varString := varString , '...'. |
|
611 |
]. |
|
15591 | 612 |
outStream nextPutAll:varString. |
613 |
outStream cr. |
|
3775 | 614 |
]. |
15591 | 615 |
^ outStream contents |
18790 | 616 |
|
617 |
"Modified: / 28-05-2019 / 19:35:37 / Claus Gittinger" |
|
3775 | 618 |
! |
619 |
||
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
620 |
stringWithAllWorkspaceValues |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
621 |
"when clicked on '-all workspace vars'" |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
622 |
|
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
623 |
^ self |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
624 |
stringWithAllNames:workspaceVariableNamesInDoIts |
13982
25d8cef3bc77
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13973
diff
changeset
|
625 |
andValues:(workspaceVariableNamesInDoIts collect:[:nm| Workspace workspaceVariableAt:nm]) |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
626 |
! |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
627 |
|
3775 | 628 |
valueAtIndex:varIdx |
200 | 629 |
"helper - return the value of the selected entry" |
630 |
||
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
631 |
|methodHomeContext hCon theContext values| |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
632 |
|
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
633 |
inspectedContext isNil ifTrue:[^ nil]. |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
634 |
|
12898
323452deefd5
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12779
diff
changeset
|
635 |
"/ argsOnly := false. |
868 | 636 |
theContext := inspectedContext. |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
637 |
methodHomeContext := theContext methodHome. |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
638 |
|
868 | 639 |
theContext isBlockContext ifTrue:[ |
640 |
values := Array withAll:(theContext argsAndVars). |
|
641 |
(showingTemporaries and:[theContext numTemps ~~ 0]) ifTrue:[ |
|
642 |
values := values , theContext temporaries |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
643 |
]. |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
644 |
hCon := theContext home. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
645 |
[hCon == methodHomeContext] whileFalse:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
646 |
values := values , hCon argsAndVars. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
647 |
(showingTemporaries and:[theContext numTemps ~~ 0]) ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
648 |
values := values , hCon temporaries |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
649 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
650 |
hCon := hCon home. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
651 |
]. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
652 |
|
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
653 |
methodHomeContext notNil ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
654 |
values := values , methodHomeContext args. |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
655 |
argsOnly ifFalse:[ |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
656 |
values := values , methodHomeContext vars. |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
657 |
(showingTemporaries and:[methodHomeContext numTemps ~~ 0])ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
658 |
values := values , methodHomeContext temporaries |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
659 |
] |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
660 |
]. |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
661 |
]. |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
662 |
] ifFalse:[ |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
663 |
argsOnly ifTrue:[ |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
664 |
values := methodHomeContext args |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
665 |
] ifFalse:[ |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
666 |
values := methodHomeContext argsAndVars |
1395 | 667 |
]. |
5339
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
668 |
(showingTemporaries and:[methodHomeContext numTemps ~~ 0])ifTrue:[ |
a740e2325527
also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents:
5148
diff
changeset
|
669 |
values := values , methodHomeContext temporaries |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
670 |
] |
1395 | 671 |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
672 |
]. |
16479 | 673 |
|
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
674 |
varIdx > values size ifTrue:[ |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
675 |
|wsIndex| |
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
676 |
|
16479 | 677 |
workspaceVariableNamesInDoIts notNil ifTrue:[ |
678 |
wsIndex := varIdx - values size - 1. |
|
679 |
wsIndex <= workspaceVariableNamesInDoIts size ifTrue:[ |
|
680 |
^ Workspace workspaceVariableAt:(workspaceVariableNamesInDoIts at:wsIndex). |
|
681 |
]. |
|
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
682 |
]. |
13972
c503d01b46fc
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13967
diff
changeset
|
683 |
^ '** oops - could not find value **' |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
684 |
]. |
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
685 |
|
3775 | 686 |
^ values at:varIdx. |
200 | 687 |
|
1395 | 688 |
"Modified: / 13.1.1998 / 15:55:16 / cg" |
3775 | 689 |
! |
690 |
||
691 |
valueAtLine:lineNr |
|
692 |
"helper - return the value of the selected entry" |
|
693 |
||
694 |
|varIdx l| |
|
695 |
||
696 |
inspectedContext isNil ifTrue:[^ nil]. |
|
697 |
||
698 |
varIdx := lineNr. |
|
11513 | 699 |
l := self listEntryAt:lineNr. |
8437 | 700 |
l isNil ifTrue:[ ^nil]. |
701 |
||
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
702 |
(l startsWith:'>>') ifTrue:[ |
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
703 |
"/ a comment (hack) |
18562 | 704 |
^ self valueForCommentLine:l |
13451
3ae3b9b9e45e
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
12935
diff
changeset
|
705 |
]. |
8437 | 706 |
(l startsWith:$-) ifTrue:[ |
3775 | 707 |
(l ~= '-') ifTrue:[ |
18562 | 708 |
(l startsWith:'- ') ifTrue:[^ nil]. |
709 |
^ self valueForSpecialLine:l |
|
3775 | 710 |
]. |
711 |
]. |
|
712 |
^ self valueAtIndex:(varIdx - 1). "/ for the special var |
|
11513 | 713 |
|
714 |
"Modified: / 16-05-2012 / 17:55:57 / cg" |
|
18562 | 715 |
"Modified: / 26-01-2019 / 16:56:58 / Claus Gittinger" |
3775 | 716 |
! |
717 |
||
13453
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
718 |
valueForCommentLine:line |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
719 |
"/ a hack to guide beginners |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
720 |
(line startsWith:'>> no home') ifTrue:[ |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
721 |
^ 'Cheapblocks do not refer to any variable in |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
722 |
their defining outer context |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
723 |
(i.e. they only refer to self and arguments). |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
724 |
Therefore, they do not keep a reference to the outer context. |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
725 |
This is a compiler optimization, leading to a slight inconvenience here.' |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
726 |
]. |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
727 |
|
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
728 |
^ nil |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
729 |
! |
ddc48bfab4c7
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13452
diff
changeset
|
730 |
|
3775 | 731 |
valueForSpecialLine:line |
18779 | 732 |
(line = allLocalVarsString) ifTrue:[ |
3775 | 733 |
^ inspectedObject |
734 |
]. |
|
18779 | 735 |
(line = allWorkspaceVarsString) ifTrue:[ |
13982
25d8cef3bc77
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13973
diff
changeset
|
736 |
^ workspaceVariableNamesInDoIts collect:[:nm | Workspace workspaceVariableAt:nm]. |
13967
57e47c38703c
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
13809
diff
changeset
|
737 |
]. |
3775 | 738 |
|
739 |
self error:'unknown special line'. |
|
740 |
||
18562 | 741 |
"Created: / 31-10-2001 / 09:17:45 / cg" |
18779 | 742 |
"Modified: / 28-05-2019 / 06:44:19 / Claus Gittinger" |
200 | 743 |
! ! |
744 |
||
18564 | 745 |
!ContextInspectorView methodsFor:'selection'! |
746 |
||
747 |
showSelection:lineNr |
|
748 |
"user clicked on an instvar - show value in workspace" |
|
749 |
||
18779 | 750 |
"/ (listView at:lineNr) isText ifTrue:[^ self]. |
18564 | 751 |
^ super showSelection:lineNr. |
752 |
||
753 |
"Created: / 26-01-2019 / 17:06:11 / Claus Gittinger" |
|
18779 | 754 |
"Modified: / 28-05-2019 / 06:27:06 / Claus Gittinger" |
18564 | 755 |
! ! |
756 |
||
200 | 757 |
!ContextInspectorView methodsFor:'user actions'! |
758 |
||
759 |
hideTemporaries |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
760 |
"do not show contexts temporaries" |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
761 |
|
200 | 762 |
showingTemporaries := false. |
763 |
self inspect:inspectedContext |
|
764 |
||
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
765 |
"Modified: 14.12.1995 / 19:24:44 / cg" |
200 | 766 |
! |
767 |
||
768 |
showTemporaries |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
769 |
"show contexts temporaries" |
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
770 |
|
200 | 771 |
showingTemporaries := true. |
772 |
self inspect:inspectedContext |
|
296
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
773 |
|
b480a51cfb5f
dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
774 |
"Modified: 14.12.1995 / 19:24:49 / cg" |
13809 | 775 |
! |
776 |
||
777 |
valueAtLine:lineNr put:newValue |
|
778 |
"helper - return the value of the selected entry" |
|
779 |
||
780 |
|indexOfFirstNonSpecial contextIndex| |
|
781 |
||
782 |
inspectedContext isNil ifTrue:[^ self]. |
|
783 |
||
784 |
"/ count the special lines |
|
785 |
indexOfFirstNonSpecial := self fieldList findFirst:[:l | (l string startsWith:'-') not]. |
|
786 |
indexOfFirstNonSpecial == 0 ifTrue:[ |
|
787 |
^ self |
|
788 |
]. |
|
789 |
||
790 |
contextIndex := lineNr - indexOfFirstNonSpecial + 1. |
|
791 |
||
792 |
"yes, you can do that with a context" |
|
793 |
inspectedContext at:contextIndex put:newValue. |
|
200 | 794 |
! ! |
795 |
||
785 | 796 |
!ContextInspectorView class methodsFor:'documentation'! |
200 | 797 |
|
798 |
version |
|
16479 | 799 |
^ '$Header$' |
9033
abeca4d8f0f0
no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents:
8690
diff
changeset
|
800 |
! |
abeca4d8f0f0
no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents:
8690
diff
changeset
|
801 |
|
abeca4d8f0f0
no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents:
8690
diff
changeset
|
802 |
version_CVS |
16479 | 803 |
^ '$Header$' |
200 | 804 |
! ! |
12456
87fdcd23e545
class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents:
11630
diff
changeset
|
805 |