45 "set the context to be inspected" |
45 "set the context to be inspected" |
46 |
46 |
47 |homeContext method homeNames rec sel implementorClass |
47 |homeContext method homeNames rec sel implementorClass |
48 argNames varNames tmpNames m argsOnly| |
48 argNames varNames tmpNames m argsOnly| |
49 |
49 |
50 hasMore := false. |
50 (con == inspectedContext) ifTrue:[ |
|
51 listView selection notNil ifTrue:[ |
|
52 self showSelection:(listView selection). |
|
53 ]. |
|
54 ^ self |
|
55 ]. |
|
56 |
|
57 hasMore := argsOnly := false. |
51 inspectedObject := nil. |
58 inspectedObject := nil. |
52 inspectedContext := con. |
59 inspectedContext := con. |
53 argsOnly := false. |
|
54 |
60 |
55 con isNil ifTrue:[ |
61 con isNil ifTrue:[ |
56 names := nil. |
62 names := nil. |
57 values := nil. |
63 listView list:nil. |
58 listView list:nil. |
64 ^ self |
59 ^ self |
|
60 ]. |
65 ]. |
61 |
66 |
62 "/ realized ifFalse:[^ self]. |
67 "/ realized ifFalse:[^ self]. |
63 |
68 |
64 homeContext := con methodHome. |
69 homeContext := con methodHome. |
65 |
70 |
66 homeContext isNil ifTrue:[ |
71 homeContext isNil ifTrue:[ |
67 "its a cheap blocks context" |
72 "its a cheap blocks context" |
68 rec := con receiver. |
73 rec := con receiver. |
69 sel := con selector. |
74 sel := con selector. |
70 homeNames := OrderedCollection new. |
75 homeNames := OrderedCollection new. |
71 ] ifFalse:[ |
76 ] ifFalse:[ |
72 rec := homeContext receiver. |
77 rec := homeContext receiver. |
73 sel := homeContext selector. |
78 sel := homeContext selector. |
74 |
79 |
75 implementorClass := homeContext methodClass. |
80 implementorClass := homeContext methodClass. |
76 implementorClass notNil ifTrue:[ |
81 implementorClass notNil ifTrue:[ |
77 method := implementorClass compiledMethodAt:sel. |
82 method := implementorClass compiledMethodAt:sel. |
78 method notNil ifTrue:[ |
83 method notNil ifTrue:[ |
79 method isWrapped ifTrue:[ |
84 method isWrapped ifTrue:[ |
80 " |
85 " |
81 in a wrapped context, locals are something different |
86 in a wrapped context, locals are something different |
82 " |
87 " |
83 "/ argsOnly := true. |
88 "/ argsOnly := true. |
84 m := method originalMethod. |
89 m := method originalMethod. |
85 m notNil ifTrue:[ |
90 m notNil ifTrue:[ |
86 method := m. |
91 method := m. |
87 ] ifFalse:[ |
92 ] ifFalse:[ |
88 argsOnly := true. |
93 argsOnly := true. |
89 ]. |
94 ]. |
90 ]. |
95 ]. |
91 ]. |
96 ]. |
92 method notNil ifTrue:[ |
97 method notNil ifTrue:[ |
93 method source notNil ifTrue:[ |
98 method source notNil ifTrue:[ |
94 argsOnly ifTrue:[ |
99 argsOnly ifTrue:[ |
95 homeNames := method methodArgNames |
100 homeNames := method methodArgNames |
96 ] ifFalse:[ |
101 ] ifFalse:[ |
97 homeNames := method methodArgAndVarNames. |
102 homeNames := method methodArgAndVarNames. |
98 ] |
103 ] |
99 ] |
104 ] |
100 ]. |
105 ]. |
101 ]. |
106 ]. |
102 |
107 |
103 " |
108 " |
104 create dummy names for method vars (if there is no source available) |
109 create dummy names for method vars (if there is no source available) |
105 " |
110 " |
106 homeNames isNil ifTrue:[ |
111 homeNames isNil ifTrue:[ |
107 homeNames := OrderedCollection new. |
112 homeNames := OrderedCollection new. |
108 1 to:homeContext numArgs do:[:index | |
113 1 to:homeContext numArgs do:[:index | |
109 homeNames add:('mArg' , index printString) |
114 homeNames add:('mArg' , index printString) |
110 ]. |
115 ]. |
111 argsOnly ifFalse:[ |
116 argsOnly ifFalse:[ |
112 1 to:homeContext nvars do:[:index | |
117 1 to:homeContext nvars do:[:index | |
113 homeNames add:('mVar' , index printString) |
118 homeNames add:('mVar' , index printString) |
114 ]. |
119 ]. |
115 showingTemporaries ifTrue:[ |
120 showingTemporaries ifTrue:[ |
116 1 to:homeContext ntemp do:[:index | |
121 1 to:homeContext ntemp do:[:index | |
117 homeNames add:('mTmp' , index printString) |
122 homeNames add:('mTmp' , index printString) |
118 ] |
123 ] |
119 ] |
124 ] |
120 ] |
125 ] |
121 ]. |
126 ]. |
122 ]. |
127 ]. |
123 |
128 |
124 " |
129 " |
125 stupid: should find the block via the contexts |
130 stupid: should find the block via the contexts |
126 method-home and put real names in here |
131 method-home and put real names in here |
127 " |
132 " |
128 con isBlockContext ifTrue:[ |
133 con isBlockContext ifTrue:[ |
129 names := OrderedCollection new. |
134 names := OrderedCollection new. |
130 |
135 |
131 argNames := (1 to:(con numArgs)) collect:[:i | 'arg' , i printString]. |
136 argNames := (1 to:(con numArgs)) collect:[:i | 'arg' , i printString]. |
132 names addAll:argNames. |
137 names addAll:argNames. |
133 varNames := (1 to:(con nvars)) collect:[:i | 'var' , i printString]. |
138 varNames := (1 to:(con nvars)) collect:[:i | 'var' , i printString]. |
134 names addAll:varNames. |
139 names addAll:varNames. |
135 |
140 |
136 showingTemporaries ifTrue:[ |
141 showingTemporaries ifTrue:[ |
137 tmpNames := (1 to:(con ntemp)) collect:[:i | 'tmp' , i printString]. |
142 tmpNames := (1 to:(con ntemp)) collect:[:i | 'tmp' , i printString]. |
138 names addAll:tmpNames. |
143 names addAll:tmpNames. |
139 ]. |
144 ]. |
140 |
145 |
141 names addAll:homeNames. |
146 names addAll:homeNames. |
142 |
|
143 values := Array withAll:(con argsAndVars). |
|
144 (showingTemporaries and:[con ntemp ~~ 0]) ifTrue:[ |
|
145 values := values , con temporaries |
|
146 ]. |
|
147 homeContext notNil ifTrue:[ |
|
148 values := values , homeContext args. |
|
149 argsOnly ifFalse:[ |
|
150 values := values , homeContext vars. |
|
151 (showingTemporaries and:[homeContext ntemp ~~ 0])ifTrue:[ |
|
152 values := values , homeContext temporaries |
|
153 ] |
|
154 ]. |
|
155 ]. |
|
156 |
|
157 ] ifFalse:[ |
147 ] ifFalse:[ |
158 names := homeNames. |
148 names := homeNames. |
159 argsOnly ifTrue:[ |
|
160 values := homeContext args |
|
161 ] ifFalse:[ |
|
162 values := homeContext argsAndVars |
|
163 ] |
|
164 ]. |
149 ]. |
165 |
150 |
166 listView list:names. |
151 listView list:names. |
167 |
152 |
168 workspace contents:nil. |
153 workspace contents:nil. |
169 self setDoitActionIn:workspace for:con. |
154 self setDoitActionIn:workspace for:con. |
|
155 |
|
156 "Modified: 14.12.1995 / 19:34:35 / cg" |
170 ! |
157 ! |
171 |
158 |
172 release |
159 release |
173 "release inspected object" |
160 "release inspected object" |
174 |
161 |
|
162 'released' printNL. |
175 inspectedContext := nil. |
163 inspectedContext := nil. |
176 names := values := nil. |
164 names := nil. |
177 super release |
165 super release |
|
166 |
|
167 "Modified: 14.12.1995 / 19:34:39 / cg" |
178 ! ! |
168 ! ! |
179 |
169 |
180 !ContextInspectorView methodsFor:'initialization'! |
170 !ContextInspectorView methodsFor:'initialization'! |
181 |
171 |
182 fieldMenu |
172 fieldMenu |