author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 24 Jun 2013 13:11:03 +0100 | |
branch | jv |
changeset 13175 | 64da878033cc |
parent 13173 | e9da2324940d |
parent 12976 | d8aec7edf3d5 |
child 13180 | 64a4186ddfce |
permissions | -rw-r--r-- |
9982 | 1 |
" |
10071 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
11607 | 3 |
All Rights Reserved |
9982 | 4 |
|
10071 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9982 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
CodeViewService subclass:#BreakpointService |
|
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
31 |
instanceVariableNames:'breakpoints currentMethod mode' |
11607 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-CodeView' |
|
9982 | 35 |
! |
36 |
||
37 |
!BreakpointService class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
10071 | 41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
11607 | 42 |
All Rights Reserved |
9982 | 43 |
|
10071 | 44 |
Permission is hereby granted, free of charge, to any person |
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9982 | 64 |
" |
65 |
! ! |
|
66 |
||
10226 | 67 |
!BreakpointService methodsFor:'accessing'! |
68 |
||
69 |
breakpoints |
|
70 |
^ breakpoints |
|
71 |
! ! |
|
72 |
||
10208 | 73 |
!BreakpointService methodsFor:'change & update'! |
74 |
||
75 |
update: aspect with: param from: sender |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
76 |
aspect == #visibility ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
77 |
aspect == #sizeOfView ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
78 |
aspect == #classHolder ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
79 |
aspect == #languageHolder ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
80 |
sender == codeView modifiedChannel ifTrue:[^ self]. |
10208 | 81 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
82 |
(aspect == #methodHolder or:[sender == codeView methodHolder]) ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
83 |
self updateCurrentMethod. |
10208 | 84 |
]. |
85 |
super update: aspect with: param from: sender |
|
86 |
||
87 |
"Created: / 06-07-2011 / 15:21:08 / cg" |
|
88 |
! |
|
89 |
||
90 |
updateBreakPointsFor:aMethod |
|
91 |
|methodsBreakPoints| |
|
92 |
||
93 |
aMethod notNil ifTrue:[ |
|
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
94 |
mode == #vm ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
95 |
(aMethod breakpointTable ? #()) do:[:each| |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
96 |
each class == Breakpoint ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
97 |
methodsBreakPoints add: each. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
98 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
99 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
100 |
] ifFalse:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
101 |
aMethod literalsDo:[:eachLiteral | |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
102 |
eachLiteral class == Breakpoint ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
103 |
methodsBreakPoints isNil ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
104 |
methodsBreakPoints := OrderedCollection new. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
105 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
106 |
methodsBreakPoints add:eachLiteral copy. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
107 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
108 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
109 |
]. |
10208 | 110 |
]. |
111 |
breakpoints := methodsBreakPoints. |
|
112 |
currentMethod := aMethod. |
|
113 |
||
114 |
"Created: / 06-07-2011 / 15:24:09 / cg" |
|
10226 | 115 |
"Modified: / 06-07-2011 / 17:32:54 / jv" |
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
116 |
"Modified: / 15-04-2013 / 12:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
117 |
! |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
118 |
|
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
119 |
updateCurrentMethod |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
120 |
|method realMethod| |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
121 |
|
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
122 |
method := realMethod := codeView methodHolder value. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
123 |
(method notNil and:[method mclass isNil]) ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
124 |
"/ hack: ouch - was wrapped in the meantime; |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
125 |
"/ hurry up and update. Should be done elsewhere (in codeView) |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
126 |
realMethod := MethodWithBreakpoints allInstances detect:[:m | m originalMethod == method and:[m mclass notNil]] ifNone:nil. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
127 |
realMethod isNil ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
128 |
realMethod := WrappedMethod allInstances detect:[:m | m originalMethod == method and:[m mclass notNil]] ifNone:nil. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
129 |
]. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
130 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
131 |
realMethod ~~ currentMethod ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
132 |
"/ codeView methodHolder setValue:realMethod. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
133 |
self updateBreakPointsFor:realMethod. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
134 |
gutterView invalidate. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
135 |
]. |
10208 | 136 |
! ! |
137 |
||
9982 | 138 |
!BreakpointService methodsFor:'event handling'! |
139 |
||
11607 | 140 |
buttonPress:button x:x y:y in:view |
10714
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
141 |
|lineNr| |
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
142 |
|
10182 | 143 |
codeView methodHolder value isNil ifTrue:[ |
11607 | 144 |
^ false |
10182 | 145 |
]. |
9982 | 146 |
view == gutterView ifTrue:[ |
11607 | 147 |
button == 1 ifTrue:[ |
148 |
lineNr := textView yVisibleToLineNr:y. |
|
149 |
lineNr notNil ifTrue:[ self setOrToggleBreakpointAtLine:lineNr ]. |
|
150 |
^ true. |
|
151 |
]. |
|
152 |
button == 3 ifTrue:[ |
|
153 |
^ true. |
|
154 |
] |
|
9982 | 155 |
]. |
10182 | 156 |
^ false |
9982 | 157 |
|
158 |
"Created: / 17-06-2011 / 13:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
159 |
"Modified: / 28-06-2011 / 08:31:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10714
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
160 |
"Modified: / 19-09-2011 / 14:41:00 / cg" |
10226 | 161 |
! |
162 |
||
163 |
linesDeletedFrom: start to: end |
|
164 |
||
165 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
166 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) negated |
|
167 |
||
168 |
"Created: / 06-07-2011 / 17:16:27 / jv" |
|
169 |
! |
|
170 |
||
171 |
linesInsertedFrom: start to: end |
|
172 |
||
173 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
174 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) |
|
175 |
||
176 |
"Created: / 06-07-2011 / 17:16:36 / jv" |
|
9982 | 177 |
! ! |
178 |
||
179 |
!BreakpointService methodsFor:'initialization'! |
|
180 |
||
181 |
initialize |
|
182 |
||
183 |
super initialize. |
|
184 |
breakpoints := OrderedCollection new. |
|
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
185 |
mode := (ConfigurableFeatures includesFeature:#VMBreakpointSupport) |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
186 |
ifTrue:[#vm] |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
187 |
ifFalse:[#compiled]. |
9982 | 188 |
|
189 |
"Created: / 17-06-2011 / 13:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
190 |
"Modified: / 15-04-2013 / 12:28:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9982 | 191 |
! ! |
192 |
||
193 |
!BreakpointService methodsFor:'private'! |
|
194 |
||
11607 | 195 |
breakpointAtLine:line |
10182 | 196 |
|pos| |
9982 | 197 |
|
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
198 |
breakpoints isNil ifTrue:[^ nil]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
199 |
|
9982 | 200 |
pos := textView characterPositionOfLine:line col:1. |
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
201 |
^ breakpoints detect:[:each | each position = pos ] ifNone:[ nil ] |
9982 | 202 |
|
203 |
"Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 204 |
"Modified (format): / 05-07-2011 / 21:33:23 / cg" |
205 |
! |
|
206 |
||
10226 | 207 |
moveBreakpointsAfterLine:line by: delta |
208 |
|pos | |
|
209 |
||
210 |
breakpoints do:[:bpnt| |
|
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
211 |
bpnt line >= line ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
212 |
pos := textView characterPositionOfLine:bpnt line + delta col:1. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
213 |
bpnt position:pos line:(bpnt line + delta). |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
214 |
] |
10226 | 215 |
]. |
216 |
||
217 |
"/gutterView redrawLinesFrom: line. |
|
218 |
||
219 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
220 |
"Created: / 06-07-2011 / 17:26:30 / jv" |
|
11719 | 221 |
"Modified: / 02-08-2012 / 09:27:10 / cg" |
10226 | 222 |
! |
223 |
||
10182 | 224 |
recompile |
225 |
"recompile the current method for changed breakpoints" |
|
226 |
||
11719 | 227 |
|oldMethod newMethod compiler class selector| |
10182 | 228 |
|
11719 | 229 |
oldMethod := codeView methodHolder value. |
230 |
(oldMethod notNil and:[oldMethod hasPrimitiveCode not]) ifTrue:[ |
|
231 |
"/ be careful: if the text has been edited/modified, do not compile |
|
232 |
textView modified ifTrue:[ |
|
233 |
self breakPoint: #cg. |
|
234 |
self breakPoint: #jv. |
|
235 |
^self. |
|
236 |
] ifFalse:[ |
|
237 |
"/ prepare to get reachable bpts |
|
238 |
breakpoints do:[:bp | bp isReached:false]. |
|
239 |
||
240 |
class := oldMethod mclass. |
|
241 |
class isNil ifTrue:[ |
|
242 |
class := codeView classHolder value. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
243 |
class isNil ifTrue:[ |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
244 |
self breakPoint:#jv. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
245 |
Dialog warn:'oops - lost the methods''s class'. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
246 |
^ self. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
247 |
] |
11719 | 248 |
]. |
249 |
selector := oldMethod selector. |
|
10182 | 250 |
|
11719 | 251 |
Class withoutUpdatingChangesDo:[ |
252 |
compiler := ByteCodeCompilerWithBreakpointSupport new. |
|
253 |
compiler breakpoints:breakpoints. |
|
254 |
compiler methodClass:MethodWithBreakpoints. |
|
255 |
newMethod := compiler |
|
256 |
compile:oldMethod source |
|
257 |
forClass:class |
|
258 |
inCategory:oldMethod category |
|
259 |
notifying:nil |
|
260 |
install:false |
|
261 |
skipIfSame:false |
|
262 |
silent:true |
|
263 |
foldConstants:true |
|
11987 | 264 |
ifFail:[ Transcript showCR:'BreakpointService: failed to recompile for breakpoint' ]. |
10182 | 265 |
|
11719 | 266 |
selector isNil ifTrue:[ |
267 |
"/ May happen as the selector is not stored in the method but |
|
268 |
"/ searches through method's mclass methodDictionary. |
|
269 |
"/ Following should be save as breakpoint is not installed when |
|
270 |
"/ the code is modified... |
|
271 |
selector := compiler selector. |
|
272 |
]. |
|
273 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
274 |
oldMethod isWrapped ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
275 |
"/ update the wrapped method - do not install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
276 |
newMethod originalMethod: oldMethod originalMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
277 |
oldMethod replaceOriginalMethodWith:newMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
278 |
] ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
279 |
"/ install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
280 |
newMethod originalMethod: oldMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
281 |
(class primAddSelector: selector withMethod:newMethod) ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
282 |
oldMethod mclass:class. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
283 |
self breakPoint: #cg. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
284 |
self breakPoint: #jv. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
285 |
^ self |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
286 |
]. |
11719 | 287 |
]. |
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
288 |
|
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
289 |
breakpoints := breakpoints |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
290 |
select:[:bp | |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
291 |
"/ bp isReached ifFalse:[ |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
292 |
"/ "/ Transcript show:'remove unreached:'; showCR:bp |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
293 |
"/ ]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
294 |
bp isReached |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
295 |
]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
296 |
|
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
297 |
"/ must update breakpoints BEFORE the following, because it leads to a change |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
298 |
"/ notification, which may clear the breakpoints collection!! |
11719 | 299 |
codeView methodHolder value:newMethod. |
300 |
oldMethod mclass isNil ifTrue:[ |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
301 |
"/ although this is not strictly true, not doing this |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
302 |
"/ would confuse a lot of other tools (such as the browser) |
11719 | 303 |
oldMethod mclass:class. |
304 |
]. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
305 |
class changed:#methodTrap with:selector. "/ tell browsers |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
306 |
Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector). |
11719 | 307 |
]. |
308 |
] |
|
10182 | 309 |
] |
310 |
||
311 |
"Created: / 05-07-2011 / 21:33:13 / cg" |
|
11601
6500e91de9e8
changed: #recompile (fixes to allow multiple breakpoints in a method)
vrany
parents:
11569
diff
changeset
|
312 |
"Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11719 | 313 |
"Modified: / 02-08-2012 / 09:35:41 / cg" |
9982 | 314 |
! |
315 |
||
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
316 |
reinstall |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
317 |
| vmbreakpoints i | |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
318 |
|
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
319 |
vmbreakpoints := Array new: breakpoints size * 2. |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
320 |
i := 1. |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
321 |
breakpoints do:[:breakpoint| |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
322 |
vmbreakpoints at: i put: breakpoint line. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
323 |
vmbreakpoints at: i + 1 put: breakpoint. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
324 |
i := i + 2. |
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
325 |
]. |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
326 |
currentMethod breakpointTable: vmbreakpoints |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
327 |
|
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
328 |
"Created: / 15-04-2013 / 12:32:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
329 |
! |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
330 |
|
11607 | 331 |
setOrToggleBreakpointAtLine:line |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
332 |
|pos bpnt prepareFullBreakSupport| |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
333 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
334 |
"/ if true, setting a single breakpoint in a method will create |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
335 |
"/ a whole set of invisible (and disabled) breakpoints in that method, |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
336 |
"/ one for each line. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
337 |
"/ These can later be enabled in the debugger |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
338 |
"/ (otherwise, the debugger's behavior is stupid, as it cannot recompile a method |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
339 |
"/ to set additional breakpoints). |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
340 |
"/ We accept the additional overhead, as we are in debug mode anyway. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
341 |
"/ prepareFullBreakSupport := false. |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
342 |
prepareFullBreakSupport := true. |
9982 | 343 |
|
12855
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
344 |
textView reallyModified ifTrue:[ |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
345 |
"/ leads to ugly behavior (method no longer found), if we allow |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
346 |
"/ this... |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
347 |
Dialog warn:'Please accept first (cannot set breakpoint while text is modified)'. |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
348 |
^ self |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
349 |
]. |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
350 |
|
9982 | 351 |
pos := textView characterPositionOfLine:line col:1. |
352 |
bpnt := self breakpointAtLine:line. |
|
10182 | 353 |
bpnt isNil ifTrue:[ |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
354 |
"/ no breakpoint there - add as required |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
355 |
(self canCreateOrToggleBreakpointAtLine:line) ifTrue:[ |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
356 |
prepareFullBreakSupport ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
357 |
"/ add a (disabled) breakpoint for every source line. This |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
358 |
"/ allows for breakpoints to be enabled/disabled in the debugger... |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
359 |
1 to:textView numberOfLines do:[:eachLine | |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
360 |
|oldBPnt eachPos otherBpnt| |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
361 |
|
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
362 |
oldBPnt := self breakpointAtLine:eachLine. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
363 |
oldBPnt isNil ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
364 |
eachPos := textView characterPositionOfLine:eachLine col:1. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
365 |
breakpoints isNil ifTrue:[ breakpoints := OrderedCollection new]. |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
366 |
breakpoints add:((otherBpnt := Breakpoint new) position:eachPos line:eachLine). |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
367 |
eachLine == line ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
368 |
bpnt := otherBpnt. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
369 |
] ifFalse:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
370 |
otherBpnt beInvisible. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
371 |
] |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
372 |
]. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
373 |
]. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
374 |
] ifFalse:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
375 |
breakpoints add:((bpnt := Breakpoint new) position:pos line:line). |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
376 |
]. |
11719 | 377 |
Display shiftDown ifTrue:[ |
378 |
"/ trace |
|
379 |
bpnt beTracepoint |
|
380 |
]. |
|
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
381 |
self assert: breakpoints notEmptyOrNil. |
11719 | 382 |
self recompile. |
12906
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
383 |
] ifFalse:[ |
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
384 |
codeView topView class == DebugView ifTrue:[ |
12976
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
385 |
Dialog warn:'Sorry, in an active method, I can only add new breakpoints in an already breakpointed method. |
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
386 |
(i.e. a method stopped at a method breakpoint or one which already has statement breakpoints) |
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
387 |
The reason is that the method needs to be recompiled for the breakpoint, which would not affect the currently executed method.'. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
388 |
"/ Dialog warn:'Sorry, can only add a new breakpoint in a wrapped method which has not yet started.'. |
12906
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
389 |
] ifFalse:[ |
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
390 |
Dialog warn:'Sorry, cannot add a new breakpoint here.'. |
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
391 |
]. |
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
392 |
] |
10182 | 393 |
] ifFalse:[ |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
394 |
"/ breakpoint already there - just enable/disable |
11719 | 395 |
Display shiftDown ifTrue:[ |
396 |
bpnt toggleTracing |
|
397 |
] ifFalse:[ |
|
398 |
bpnt toggle. |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
399 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
400 |
currentMethod mclass isNil ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
401 |
"/ hack: ouch - was wrapped in the meantime; |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
402 |
"/ hurry up and update. Should be done elsewhere (in codeView) |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
403 |
self updateCurrentMethod. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
404 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
405 |
Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:currentMethod mclass changeSelector:currentMethod selector). |
10182 | 406 |
]. |
11987 | 407 |
|
9982 | 408 |
gutterView redrawLine:line. |
409 |
||
410 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10411 | 411 |
"Modified: / 27-07-2011 / 13:27:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11719 | 412 |
"Modified: / 02-08-2012 / 09:26:38 / cg" |
9982 | 413 |
! ! |
414 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
415 |
!BreakpointService methodsFor:'queries'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
416 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
417 |
canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
418 |
|pos bpnt topView| |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
419 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
420 |
textView reallyModified ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
421 |
^ false |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
422 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
423 |
"/ can always toggle existing breakpoints... |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
424 |
lineOrNilForAnywhere notNil ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
425 |
pos := textView characterPositionOfLine:lineOrNilForAnywhere col:1. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
426 |
bpnt := self breakpointAtLine:lineOrNilForAnywhere. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
427 |
bpnt notNil ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
428 |
^ true. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
429 |
] |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
430 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
431 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
432 |
((topView := codeView topView) class == DebugView) ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
433 |
"/ can only create new breakpoints in the debugger, |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
434 |
"/ iff we are in a wrapped method's prolog |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
435 |
topView selectedContextIsWrapped ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
436 |
topView selectedContext lineNumber == 1 ifTrue:[ |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
437 |
^ true |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
438 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
439 |
]. |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
440 |
^ false. |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
441 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
442 |
^ true. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
443 |
! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
444 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
445 |
hasBreakpoints |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
446 |
^ breakpoints notEmptyOrNil |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
447 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
448 |
|
9982 | 449 |
!BreakpointService methodsFor:'redrawing'! |
450 |
||
11607 | 451 |
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg |
9982 | 452 |
"Called by both gutterView and textView (well, not yet) to |
453 |
allow services to draw custom things on text view. |
|
454 |
Ask JV what the args means if unsure (I'm lazy to document |
|
455 |
them, now it is just an experiment...)" |
|
11607 | 456 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
457 |
|mthd bpnt icon dx dy| |
9982 | 458 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
459 |
(mthd := codeView methodHolder value) isNil ifTrue:[ |
11607 | 460 |
^ self |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
461 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
462 |
mthd mclass isNil ifTrue:[ |
13173
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
463 |
"/ hack: ouch - was wrapped in the meantime; |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
464 |
^ self. "/ wait for the real update |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
465 |
"/ hurry up and update. Should be done elsewhere (in codeView) |
e9da2324940d
Merged 06656434532b and 71cb8ce508f0 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
466 |
self updateCurrentMethod. |
10182 | 467 |
]. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
468 |
|
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
469 |
view == gutterView ifTrue:[ |
11607 | 470 |
bpnt := self breakpointAtLine:lineNo. |
471 |
bpnt isNil ifTrue:[ |
|
472 |
^ self |
|
473 |
]. |
|
474 |
icon := bpnt icon. |
|
475 |
icon isNil ifTrue:[ |
|
476 |
^ self |
|
477 |
]. |
|
478 |
dx := ((w - icon width) / 2) rounded. |
|
479 |
dy := ((h - icon height) / 2) rounded. |
|
480 |
icon |
|
481 |
displayOn:view |
|
482 |
x:x + dx |
|
483 |
y:y - h + dy + 4. "TODO: Magic constant" |
|
9982 | 484 |
]. |
485 |
||
486 |
"Created: / 17-06-2011 / 13:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 487 |
"Modified (format): / 05-07-2011 / 22:14:33 / cg" |
9982 | 488 |
! ! |
489 |
||
12676
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
490 |
!BreakpointService methodsFor:'registering'! |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
491 |
|
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
492 |
registerIn: aCodeView |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
493 |
"Installs myself in aCodeView" |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
494 |
|
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
495 |
super registerIn: aCodeView. |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
496 |
self updateBreakPointsFor: aCodeView methodHolder value. |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
497 |
|
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
498 |
"Created: / 15-04-2013 / 14:03:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
499 |
! ! |
07321e157fe9
Breakpoint service improved to support VM-level breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12571
diff
changeset
|
500 |
|
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
501 |
!BreakpointService methodsFor:'testing'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
502 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
503 |
isBreakpointService |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
504 |
^ true |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
505 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
506 |
|
9982 | 507 |
!BreakpointService class methodsFor:'documentation'! |
508 |
||
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
509 |
version |
12976
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
510 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.25 2013-06-23 08:26:25 cg Exp $' |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
511 |
! |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
512 |
|
9982 | 513 |
version_CVS |
12976
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
514 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.25 2013-06-23 08:26:25 cg Exp $' |
9982 | 515 |
! |
516 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
517 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
518 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
519 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
520 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
521 |
|
9982 | 522 |
version_SVN |
12976
d8aec7edf3d5
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12969
diff
changeset
|
523 |
^ '$Id: Tools__BreakpointService.st,v 1.25 2013-06-23 08:26:25 cg Exp $' |
9982 | 524 |
! ! |
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
525 |