author | Claus Gittinger <cg@exept.de> |
Wed, 22 Jan 1997 02:32:06 +0100 | |
changeset 977 | 0bd3800f9e4a |
parent 976 | 95a817dc94a2 |
child 1026 | b863f3784b3c |
permissions | -rw-r--r-- |
34 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 3 |
All Rights Reserved |
34 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
InspectorView subclass:#ContextInspectorView |
|
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
|
14 |
instanceVariableNames:'inspectedContext names showingTemporaries argsOnly' |
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
|
15 |
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
|
16 |
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
|
17 |
category:'Interface-Inspector' |
34 | 18 |
! |
19 |
||
785 | 20 |
!ContextInspectorView class methodsFor:'documentation'! |
34 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 25 |
All Rights Reserved |
34 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
471 | 38 |
a modified Inspector for Contexts (used in the Debugger) |
39 |
TODO: |
|
40 |
when expressions are evaluated in myself, the inst-var |
|
41 |
names are not known by the expression evaluator. |
|
42 |
This has to be fixed |
|
43 |
(actual work is to be done in the Parser to allow passing of a context ...) |
|
510 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
47 |
||
48 |
[see also:] |
|
49 |
Context DebugView |
|
34 | 50 |
" |
51 |
! ! |
|
52 |
||
53 |
!ContextInspectorView methodsFor:'accessing'! |
|
54 |
||
868 | 55 |
inspect:aContext |
34 | 56 |
"set the context to be inspected" |
57 |
||
107 | 58 |
|homeContext method homeNames rec sel implementorClass |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
59 |
argNames varNames tmpNames m argsOnly blockNode vars |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
60 |
numVarsInSource numVarsInContext isDoIt |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
61 |
numArgs numVars| |
34 | 62 |
|
868 | 63 |
(aContext == inspectedContext) ifTrue:[ |
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
|
64 |
listView selection notNil ifTrue:[ |
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
|
65 |
self showSelection:(listView selection). |
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
|
66 |
]. |
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
|
67 |
^ self |
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
|
68 |
]. |
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
|
69 |
|
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
|
70 |
hasMore := argsOnly := false. |
34 | 71 |
inspectedObject := nil. |
868 | 72 |
inspectedContext := aContext. |
49 | 73 |
|
868 | 74 |
aContext isNil ifTrue:[ |
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
|
75 |
names := 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
|
76 |
listView list: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
|
77 |
^ self |
34 | 78 |
]. |
79 |
||
56 | 80 |
"/ realized ifFalse:[^ self]. |
81 |
||
868 | 82 |
homeContext := aContext methodHome. |
51 | 83 |
|
84 |
homeContext isNil ifTrue:[ |
|
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
|
85 |
"its a cheap blocks context" |
868 | 86 |
rec := aContext receiver. |
87 |
sel := aContext selector. |
|
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
|
88 |
homeNames := OrderedCollection new. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
89 |
isDoIt := false. |
51 | 90 |
] ifFalse:[ |
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
|
91 |
rec := homeContext receiver. |
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
|
92 |
sel := homeContext selector. |
34 | 93 |
|
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
94 |
"/ #doIt needs special handling below |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
95 |
isDoIt := (sel == #doIt) or:[sel == #doIt:]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
96 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
97 |
method := homeContext method. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
98 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
99 |
"/ implementorClass := homeContext methodClass. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
100 |
"/ implementorClass notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
101 |
"/ method := implementorClass compiledMethodAt:sel. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
102 |
"/ ] ifFalse:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
103 |
"/ "/ mhm - an unbound method; |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
104 |
"/ "/ see if it was invoked by a direct call |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
105 |
"/ "/ consider this a kludge |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
106 |
"/ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
107 |
"/ homeContext sender notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
108 |
"/ (homeContext sender selector startsWith:'valueWithReceiver:') ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
109 |
"/ method := homeContext sender receiver |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
110 |
"/ ] |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
111 |
"/ ] |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
112 |
"/ ]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
113 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
114 |
(method notNil |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
115 |
and:[method isWrapped]) ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
116 |
" |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
117 |
in a wrapped context, locals are something different |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
118 |
" |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
119 |
"/ argsOnly := true. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
120 |
m := method originalMethod. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
121 |
m notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
122 |
method := m. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
123 |
] ifFalse:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
124 |
argsOnly := true. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
125 |
]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
126 |
]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
127 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
128 |
method notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
129 |
method source notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
130 |
argsOnly ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
131 |
homeNames := method methodArgNames |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
132 |
] ifFalse:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
133 |
homeNames := method methodArgAndVarNames. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
134 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
135 |
"/ did it already allocate its locals ? |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
136 |
homeNames size - method methodArgNames size == homeContext numVars |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
137 |
ifFalse:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
138 |
homeNames := method methodArgNames. |
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
|
139 |
argsOnly := true. |
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
|
140 |
]. |
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
|
141 |
]. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
142 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
143 |
"/ there is one case, where the above is by purpose: |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
144 |
"/ the #doIt - method, which has been given an invalid |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
145 |
"/ source. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
146 |
"/ care for this here. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
147 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
148 |
isDoIt ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
149 |
homeNames := #(). |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
150 |
] ifFalse:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
151 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
152 |
"/ check |
785 | 153 |
|
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
154 |
numVarsInContext := homeContext argsAndVars size. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
155 |
numVarsInSource := homeNames size. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
156 |
|
977 | 157 |
numVarsInSource > 0 ifTrue:[ |
158 |
numVarsInContext ~~ numVarsInSource ifTrue:[ |
|
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
159 |
|
977 | 160 |
"/ the methods source does not correctly reflect |
161 |
"/ the number of args&vars in the context. |
|
162 |
"/ either outDated, or somehow strange. |
|
163 |
"/ (happens with wrapped methods, which are not |
|
164 |
"/ what they look) |
|
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
165 |
|
977 | 166 |
numVarsInSource > numVarsInContext ifTrue:[ |
167 |
homeNames := homeNames copyTo:numVarsInContext. |
|
976
95a817dc94a2
fixed arg-name display of wrapped methods
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
168 |
] ifFalse:[ |
977 | 169 |
numVarsInContext >= homeContext numArgs ifTrue:[ |
170 |
homeNames := homeNames copyTo:homeContext numArgs |
|
171 |
] ifFalse:[ |
|
172 |
homeNames := nil |
|
173 |
] |
|
174 |
] |
|
785 | 175 |
] |
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
|
176 |
] |
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
|
177 |
] |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
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 |
]. |
73 | 180 |
|
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
|
181 |
" |
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
|
182 |
create dummy names for method vars (if there is no source available) |
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
|
183 |
" |
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
|
184 |
homeNames isNil ifTrue:[ |
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
|
185 |
homeNames := OrderedCollection new. |
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
|
186 |
1 to:homeContext numArgs do:[:index | |
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
|
187 |
homeNames add:('mArg' , index printString) |
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
|
188 |
]. |
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
|
189 |
argsOnly ifFalse:[ |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
190 |
1 to:homeContext numVars do:[:index | |
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
|
191 |
homeNames add:('mVar' , index printString) |
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
|
192 |
]. |
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
|
193 |
showingTemporaries ifTrue:[ |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
194 |
1 to:homeContext numTemps do:[:index | |
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
|
195 |
homeNames add:('mTmp' , index printString) |
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
|
196 |
] |
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
|
197 |
] |
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
|
198 |
] |
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
|
199 |
]. |
34 | 200 |
]. |
51 | 201 |
|
34 | 202 |
" |
203 |
stupid: should find the block via the contexts |
|
204 |
method-home and put real names in here |
|
205 |
" |
|
868 | 206 |
aContext isBlockContext ifTrue:[ |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
207 |
numArgs := aContext numArgs. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
208 |
numVars := aContext numVars. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
209 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
210 |
(numArgs > 0 or:[numVars > 0]) ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
211 |
|
948 | 212 |
method notNil ifTrue:[ |
213 |
isDoIt ifTrue:[ |
|
214 |
"/ special for #doIt |
|
215 |
"/ my source is found in the method. |
|
216 |
blockNode := Compiler |
|
217 |
blockAtLine:(aContext lineNumber) |
|
218 |
in:nil |
|
219 |
orSource:('[' , method source , '\]') withCRs |
|
220 |
numArgs:numArgs |
|
221 |
numVars:numVars. |
|
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
222 |
|
948 | 223 |
] ifFalse:[ |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
224 |
blockNode := Compiler |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
225 |
blockAtLine:(aContext lineNumber) |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
226 |
in:method |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
227 |
orSource:nil |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
228 |
numArgs:numArgs |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
229 |
numVars:numVars. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
230 |
] |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
231 |
]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
232 |
|
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
233 |
blockNode notNil ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
234 |
numArgs > 0 ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
235 |
vars := blockNode arguments. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
236 |
vars size > 0 ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
237 |
argNames := vars collect:[:var | var name] |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
238 |
] |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
239 |
]. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
240 |
numVars > 0 ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
241 |
vars := blockNode variables. |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
242 |
vars size > 0 ifTrue:[ |
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
243 |
varNames := vars collect:[:var | var name]. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
244 |
] |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
245 |
] |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
246 |
]. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
247 |
]. |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
248 |
|
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
|
249 |
names := OrderedCollection new. |
51 | 250 |
|
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
251 |
argNames isNil ifTrue:[ |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
252 |
argNames := (1 to:numArgs) collect:[:i | 'arg' , i printString]. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
253 |
]. |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
254 |
|
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
|
255 |
names addAll:argNames. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
256 |
varNames isNil ifTrue:[ |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
257 |
varNames := (1 to:numVars) collect:[:i | 'var' , i printString]. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
258 |
] ifFalse:[ |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
259 |
varNames size ~~ numVars ifTrue:[ |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
260 |
varNames := varNames asOrderedCollection. |
868 | 261 |
varNames size+1 to:aContext numVars do:[:i | |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
262 |
varNames add:('var' , i printString) |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
263 |
] |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
264 |
] |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
265 |
]. |
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
266 |
|
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
|
267 |
names addAll:varNames. |
51 | 268 |
|
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
|
269 |
showingTemporaries ifTrue:[ |
868 | 270 |
tmpNames := (1 to:(aContext numTemps)) collect:[:i | 'tmp' , i 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
|
271 |
names addAll:tmpNames. |
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
|
272 |
]. |
51 | 273 |
|
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
|
274 |
names addAll:homeNames. |
947
b9625d9b0881
better block-var name detection
Claus Gittinger <cg@exept.de>
parents:
868
diff
changeset
|
275 |
|
34 | 276 |
] ifFalse:[ |
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
|
277 |
names := homeNames. |
34 | 278 |
]. |
73 | 279 |
|
280 |
listView list:names. |
|
34 | 281 |
|
282 |
workspace contents:nil. |
|
868 | 283 |
self setDoitActionIn:workspace for:aContext. |
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
|
284 |
|
977 | 285 |
"Modified: 22.1.1997 / 02:31:42 / cg" |
34 | 286 |
! |
287 |
||
288 |
release |
|
289 |
"release inspected object" |
|
290 |
||
291 |
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
|
292 |
names := nil. |
34 | 293 |
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
|
294 |
|
297
3d34ce6e2b22
oops - leftover printMessage removed
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
295 |
"Modified: 14.12.1995 / 21:49:43 / cg" |
34 | 296 |
! ! |
297 |
||
73 | 298 |
!ContextInspectorView methodsFor:'initialization'! |
51 | 299 |
|
73 | 300 |
fieldMenu |
301 |
|labels selectors| |
|
302 |
||
303 |
showingTemporaries ifFalse:[ |
|
304 |
labels := #( |
|
305 |
'inspect' |
|
306 |
'basicInspect' |
|
307 |
'-' |
|
308 |
'show temporaries' |
|
309 |
). |
|
310 |
selectors := #( |
|
311 |
doInspect |
|
312 |
doBasicInspect |
|
313 |
nil |
|
314 |
showTemporaries |
|
315 |
) |
|
316 |
] ifTrue:[ |
|
317 |
labels := #( |
|
318 |
'inspect' |
|
319 |
'basicInspect' |
|
320 |
'-' |
|
321 |
'hide temporaries' |
|
322 |
). |
|
323 |
selectors := #( |
|
324 |
doInspect |
|
325 |
doBasicInspect |
|
326 |
nil |
|
327 |
hideTemporaries |
|
328 |
) |
|
329 |
]. |
|
330 |
||
331 |
^ PopUpMenu |
|
332 |
labels:(resources array:labels) |
|
333 |
selectors:selectors |
|
200 | 334 |
! |
335 |
||
336 |
initialize |
|
337 |
super initialize. |
|
338 |
showingTemporaries := false. |
|
339 |
||
73 | 340 |
! ! |
200 | 341 |
|
342 |
!ContextInspectorView methodsFor:'private'! |
|
343 |
||
647 | 344 |
defaultLabel |
345 |
^ 'locals' |
|
346 |
||
347 |
" |
|
348 |
ContextInspectorView openOn:thisContext sender |
|
349 |
" |
|
350 |
||
351 |
"Modified: 28.6.1996 / 16:07:49 / cg" |
|
352 |
! |
|
353 |
||
200 | 354 |
fieldList |
355 |
^ names |
|
356 |
! |
|
357 |
||
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
|
358 |
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
|
359 |
^ 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
|
360 |
|
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
|
361 |
"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
|
362 |
! |
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
|
363 |
|
200 | 364 |
setDoitActionIn:aWorkspace for:aContext |
365 |
aWorkspace doItAction:[:theCode | |
|
366 |
Compiler evaluate:theCode |
|
367 |
in:aContext |
|
368 |
receiver:nil |
|
369 |
notifying:aWorkspace |
|
370 |
logged:true |
|
371 |
ifFail:nil |
|
372 |
] |
|
373 |
! |
|
374 |
||
375 |
valueAtLine:lineNr |
|
376 |
"helper - return the value of the selected entry" |
|
377 |
||
868 | 378 |
|homeContext 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
|
379 |
|
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
|
380 |
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
|
381 |
|
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
|
382 |
argsOnly := false. |
868 | 383 |
theContext := inspectedContext. |
384 |
homeContext := 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
|
385 |
|
868 | 386 |
theContext isBlockContext ifTrue:[ |
387 |
values := Array withAll:(theContext argsAndVars). |
|
388 |
(showingTemporaries and:[theContext numTemps ~~ 0]) ifTrue:[ |
|
389 |
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
|
390 |
]. |
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
|
391 |
homeContext notNil ifTrue:[ |
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
|
392 |
values := values , homeContext args. |
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
|
393 |
argsOnly 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
|
394 |
values := values , homeContext vars. |
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
395 |
(showingTemporaries and:[homeContext numTemps ~~ 0])ifTrue:[ |
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
|
396 |
values := values , homeContext 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
|
397 |
] |
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
|
398 |
]. |
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
|
399 |
]. |
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
|
400 |
] 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
|
401 |
argsOnly ifTrue:[ |
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
|
402 |
values := homeContext args |
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
|
403 |
] 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
|
404 |
values := homeContext argsAndVars |
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
|
405 |
] |
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
|
406 |
]. |
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
|
407 |
|
200 | 408 |
^ values at:lineNr. |
409 |
||
800
3abcfccedc0c
finally: show block-arg and var-names.
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
410 |
"Modified: 23.10.1996 / 16:21:05 / cg" |
200 | 411 |
! ! |
412 |
||
413 |
!ContextInspectorView methodsFor:'user actions'! |
|
414 |
||
415 |
doAccept:theText |
|
416 |
|value| |
|
417 |
||
418 |
selectedLine notNil ifTrue:[ |
|
419 |
value := Compiler evaluate:theText |
|
420 |
receiver:inspectedObject |
|
421 |
notifying:workspace. |
|
422 |
||
423 |
"yes, you can do that with a context" |
|
424 |
inspectedContext at:selectedLine put:value. |
|
425 |
]. |
|
426 |
! |
|
427 |
||
428 |
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
|
429 |
"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
|
430 |
|
200 | 431 |
showingTemporaries := false. |
432 |
self inspect:inspectedContext |
|
433 |
||
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
|
434 |
"Modified: 14.12.1995 / 19:24:44 / cg" |
200 | 435 |
! |
436 |
||
437 |
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
|
438 |
"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
|
439 |
|
200 | 440 |
showingTemporaries := true. |
441 |
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
|
442 |
|
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
|
443 |
"Modified: 14.12.1995 / 19:24:49 / cg" |
200 | 444 |
! ! |
445 |
||
785 | 446 |
!ContextInspectorView class methodsFor:'documentation'! |
200 | 447 |
|
448 |
version |
|
977 | 449 |
^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.33 1997-01-22 01:32:06 cg Exp $' |
200 | 450 |
! ! |