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