author | Claus Gittinger <cg@exept.de> |
Fri, 14 Jun 2013 14:22:25 +0200 | |
changeset 12902 | 724e09dfd9a2 |
parent 12855 | ab87c94ed5ac |
child 12906 | 58e97bbbf5a4 |
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 |
|
11607 | 31 |
instanceVariableNames:'breakpoints currentMethod' |
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 |
|
76 |
|method| |
|
77 |
||
78 |
method := codeView methodHolder value. |
|
79 |
method ~~ currentMethod ifTrue:[ |
|
11607 | 80 |
self updateBreakPointsFor:method. |
10208 | 81 |
]. |
82 |
||
83 |
super update: aspect with: param from: sender |
|
84 |
||
85 |
"Created: / 06-07-2011 / 15:21:08 / cg" |
|
86 |
! |
|
87 |
||
88 |
updateBreakPointsFor:aMethod |
|
89 |
|methodsBreakPoints| |
|
90 |
||
91 |
methodsBreakPoints := OrderedCollection new. |
|
92 |
aMethod notNil ifTrue:[ |
|
11607 | 93 |
aMethod literalsDo:[:eachLiteral | |
94 |
eachLiteral class == Breakpoint ifTrue:[ |
|
95 |
methodsBreakPoints add:eachLiteral copy. |
|
96 |
]. |
|
97 |
]. |
|
10208 | 98 |
]. |
99 |
breakpoints := methodsBreakPoints. |
|
100 |
currentMethod := aMethod. |
|
101 |
||
102 |
"Created: / 06-07-2011 / 15:24:09 / cg" |
|
10226 | 103 |
"Modified: / 06-07-2011 / 17:32:54 / jv" |
10208 | 104 |
! ! |
105 |
||
9982 | 106 |
!BreakpointService methodsFor:'event handling'! |
107 |
||
11607 | 108 |
buttonPress:button x:x y:y in:view |
10714
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
109 |
|lineNr| |
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
110 |
|
10182 | 111 |
codeView methodHolder value isNil ifTrue:[ |
11607 | 112 |
^ false |
10182 | 113 |
]. |
9982 | 114 |
view == gutterView ifTrue:[ |
11607 | 115 |
button == 1 ifTrue:[ |
116 |
lineNr := textView yVisibleToLineNr:y. |
|
117 |
lineNr notNil ifTrue:[ self setOrToggleBreakpointAtLine:lineNr ]. |
|
118 |
^ true. |
|
119 |
]. |
|
120 |
button == 3 ifTrue:[ |
|
121 |
^ true. |
|
122 |
] |
|
9982 | 123 |
]. |
10182 | 124 |
^ false |
9982 | 125 |
|
126 |
"Created: / 17-06-2011 / 13:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 |
"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
|
128 |
"Modified: / 19-09-2011 / 14:41:00 / cg" |
10226 | 129 |
! |
130 |
||
131 |
linesDeletedFrom: start to: end |
|
132 |
||
133 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
134 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) negated |
|
135 |
||
136 |
"Created: / 06-07-2011 / 17:16:27 / jv" |
|
137 |
! |
|
138 |
||
139 |
linesInsertedFrom: start to: end |
|
140 |
||
141 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
142 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) |
|
143 |
||
144 |
"Created: / 06-07-2011 / 17:16:36 / jv" |
|
9982 | 145 |
! ! |
146 |
||
147 |
!BreakpointService methodsFor:'initialization'! |
|
148 |
||
149 |
initialize |
|
150 |
||
151 |
super initialize. |
|
152 |
breakpoints := OrderedCollection new. |
|
153 |
||
154 |
"Created: / 17-06-2011 / 13:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! ! |
|
156 |
||
157 |
!BreakpointService methodsFor:'private'! |
|
158 |
||
11607 | 159 |
breakpointAtLine:line |
10182 | 160 |
|pos| |
9982 | 161 |
|
162 |
pos := textView characterPositionOfLine:line col:1. |
|
163 |
^ breakpoints ? #() detect:[:each | each position = pos ] ifNone:[ nil ] |
|
164 |
||
165 |
"Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 166 |
"Modified (format): / 05-07-2011 / 21:33:23 / cg" |
167 |
! |
|
168 |
||
10226 | 169 |
moveBreakpointsAfterLine:line by: delta |
170 |
|pos | |
|
171 |
||
172 |
breakpoints do:[:bpnt| |
|
11719 | 173 |
bpnt line >= line ifTrue:[ |
174 |
pos := textView characterPositionOfLine:bpnt line + delta col:1. |
|
175 |
bpnt position:pos line:(bpnt line + delta). |
|
176 |
] |
|
10226 | 177 |
]. |
178 |
||
179 |
"/gutterView redrawLinesFrom: line. |
|
180 |
||
181 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
182 |
"Created: / 06-07-2011 / 17:26:30 / jv" |
|
11719 | 183 |
"Modified: / 02-08-2012 / 09:27:10 / cg" |
10226 | 184 |
! |
185 |
||
10182 | 186 |
recompile |
187 |
"recompile the current method for changed breakpoints" |
|
188 |
||
11719 | 189 |
|oldMethod newMethod compiler class selector| |
10182 | 190 |
|
11719 | 191 |
oldMethod := codeView methodHolder value. |
192 |
(oldMethod notNil and:[oldMethod hasPrimitiveCode not]) ifTrue:[ |
|
193 |
"/ be careful: if the text has been edited/modified, do not compile |
|
194 |
textView modified ifTrue:[ |
|
195 |
self breakPoint: #cg. |
|
196 |
self breakPoint: #jv. |
|
197 |
^self. |
|
198 |
] ifFalse:[ |
|
199 |
"/ prepare to get reachable bpts |
|
200 |
breakpoints do:[:bp | bp isReached:false]. |
|
201 |
||
202 |
class := oldMethod mclass. |
|
203 |
class isNil ifTrue:[ |
|
204 |
class := codeView classHolder value. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
205 |
class isNil ifTrue:[ |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
206 |
self breakPoint:#jv. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
207 |
Dialog warn:'oops - lost the methods''s class'. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
208 |
^ self. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
209 |
] |
11719 | 210 |
]. |
211 |
selector := oldMethod selector. |
|
10182 | 212 |
|
11719 | 213 |
Class withoutUpdatingChangesDo:[ |
214 |
compiler := ByteCodeCompilerWithBreakpointSupport new. |
|
215 |
compiler breakpoints:breakpoints. |
|
216 |
compiler methodClass:MethodWithBreakpoints. |
|
217 |
newMethod := compiler |
|
218 |
compile:oldMethod source |
|
219 |
forClass:class |
|
220 |
inCategory:oldMethod category |
|
221 |
notifying:nil |
|
222 |
install:false |
|
223 |
skipIfSame:false |
|
224 |
silent:true |
|
225 |
foldConstants:true |
|
11987 | 226 |
ifFail:[ Transcript showCR:'BreakpointService: failed to recompile for breakpoint' ]. |
10182 | 227 |
|
11719 | 228 |
selector isNil ifTrue:[ |
229 |
"/ May happen as the selector is not stored in the method but |
|
230 |
"/ searches through method's mclass methodDictionary. |
|
231 |
"/ Following should be save as breakpoint is not installed when |
|
232 |
"/ the code is modified... |
|
233 |
selector := compiler selector. |
|
234 |
]. |
|
235 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
236 |
oldMethod isWrapped ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
237 |
"/ update the wrapped method - do not install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
238 |
newMethod originalMethod: oldMethod originalMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
239 |
oldMethod replaceOriginalMethodWith:newMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
240 |
] ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
241 |
"/ install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
242 |
newMethod originalMethod: oldMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
243 |
(class primAddSelector: selector withMethod:newMethod) ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
244 |
oldMethod mclass:class. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
245 |
self breakPoint: #cg. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
246 |
self breakPoint: #jv. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
247 |
^ self |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
248 |
]. |
11719 | 249 |
]. |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
250 |
|
11719 | 251 |
codeView methodHolder value:newMethod. |
252 |
oldMethod mclass isNil ifTrue:[ |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
253 |
"/ although this is not strictly true, not doing this |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
254 |
"/ would confuse a lot of other tools (such as the browser) |
11719 | 255 |
oldMethod mclass:class. |
256 |
]. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
257 |
class changed:#methodTrap with:selector. "/ tell browsers |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
258 |
MethodTrapChangeNotificationParameter notNil ifTrue:[ |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
259 |
Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector). |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
260 |
]. |
11719 | 261 |
]. |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
262 |
|
11719 | 263 |
breakpoints := breakpoints |
264 |
select:[:bp | |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
265 |
"/ bp isReached ifFalse:[ |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
266 |
"/ "/ Transcript show:'remove unreached:'; showCR:bp |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
267 |
"/ ]. |
11719 | 268 |
bp isReached |
269 |
] |
|
270 |
] |
|
10182 | 271 |
] |
272 |
||
273 |
"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
|
274 |
"Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11719 | 275 |
"Modified: / 02-08-2012 / 09:35:41 / cg" |
9982 | 276 |
! |
277 |
||
11607 | 278 |
setOrToggleBreakpointAtLine:line |
9982 | 279 |
|pos bpnt| |
280 |
||
12855
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
281 |
textView reallyModified ifTrue:[ |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
282 |
"/ leads to ugly behavior (method no longer found), if we allow |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
283 |
"/ this... |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
284 |
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
|
285 |
^ self |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
286 |
]. |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
287 |
|
9982 | 288 |
pos := textView characterPositionOfLine:line col:1. |
289 |
bpnt := self breakpointAtLine:line. |
|
10182 | 290 |
bpnt isNil ifTrue:[ |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
291 |
(self canCreateOrToggleBreakpointAtLine:line) ifTrue:[ |
11719 | 292 |
breakpoints add:((bpnt := Breakpoint new) position:pos line:line). |
293 |
Display shiftDown ifTrue:[ |
|
294 |
"/ trace |
|
295 |
bpnt beTracepoint |
|
296 |
]. |
|
297 |
self recompile. |
|
298 |
]. |
|
10182 | 299 |
] ifFalse:[ |
11719 | 300 |
Display shiftDown ifTrue:[ |
301 |
bpnt toggleTracing |
|
302 |
] ifFalse:[ |
|
303 |
bpnt toggle. |
|
304 |
] |
|
10182 | 305 |
]. |
11987 | 306 |
|
9982 | 307 |
gutterView redrawLine:line. |
308 |
||
309 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10411 | 310 |
"Modified: / 27-07-2011 / 13:27:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11719 | 311 |
"Modified: / 02-08-2012 / 09:26:38 / cg" |
9982 | 312 |
! ! |
313 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
314 |
!BreakpointService methodsFor:'queries'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
315 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
316 |
canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
317 |
|pos bpnt topView| |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
318 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
319 |
textView reallyModified ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
320 |
^ false |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
321 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
322 |
"/ can always toggle existing breakpoints... |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
323 |
lineOrNilForAnywhere notNil ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
324 |
pos := textView characterPositionOfLine:lineOrNilForAnywhere col:1. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
325 |
bpnt := self breakpointAtLine:lineOrNilForAnywhere. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
326 |
bpnt notNil ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
327 |
^ true. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
328 |
] |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
329 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
330 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
331 |
((topView := codeView topView) class == DebugView) ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
332 |
"/ can only create new breakpoints in the debugger, |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
333 |
"/ iff we are in a wrapped method's prolog |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
334 |
topView selectedContextIsWrapped ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
335 |
topView selectedContext lineNumber == 1 ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
336 |
^ true |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
337 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
338 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
339 |
^ false. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
340 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
341 |
^ true. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
342 |
! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
343 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
344 |
hasBreakpoints |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
345 |
^ breakpoints notEmptyOrNil |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
346 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
347 |
|
9982 | 348 |
!BreakpointService methodsFor:'redrawing'! |
349 |
||
11607 | 350 |
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg |
9982 | 351 |
"Called by both gutterView and textView (well, not yet) to |
352 |
allow services to draw custom things on text view. |
|
353 |
Ask JV what the args means if unsure (I'm lazy to document |
|
354 |
them, now it is just an experiment...)" |
|
11607 | 355 |
|
10182 | 356 |
|bpnt icon dx dy| |
9982 | 357 |
|
10182 | 358 |
codeView methodHolder value isNil ifTrue:[ |
11607 | 359 |
^ self |
10182 | 360 |
]. |
361 |
view == gutterView ifTrue:[ |
|
11607 | 362 |
bpnt := self breakpointAtLine:lineNo. |
363 |
bpnt isNil ifTrue:[ |
|
364 |
^ self |
|
365 |
]. |
|
366 |
icon := bpnt icon. |
|
367 |
icon isNil ifTrue:[ |
|
368 |
^ self |
|
369 |
]. |
|
370 |
dx := ((w - icon width) / 2) rounded. |
|
371 |
dy := ((h - icon height) / 2) rounded. |
|
372 |
icon |
|
373 |
displayOn:view |
|
374 |
x:x + dx |
|
375 |
y:y - h + dy + 4. "TODO: Magic constant" |
|
9982 | 376 |
]. |
377 |
||
378 |
"Created: / 17-06-2011 / 13:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 379 |
"Modified (format): / 05-07-2011 / 22:14:33 / cg" |
9982 | 380 |
! ! |
381 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
382 |
!BreakpointService methodsFor:'testing'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
383 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
384 |
isBreakpointService |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
385 |
^ true |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
386 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
387 |
|
9982 | 388 |
!BreakpointService class methodsFor:'documentation'! |
389 |
||
390 |
version_CVS |
|
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
391 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.20 2013-06-14 12:22:25 cg Exp $' |
11601
6500e91de9e8
changed: #recompile (fixes to allow multiple breakpoints in a method)
vrany
parents:
11569
diff
changeset
|
392 |
|
9982 | 393 |
! |
394 |
||
395 |
version_SVN |
|
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
396 |
^ '$Id: Tools__BreakpointService.st,v 1.20 2013-06-14 12:22:25 cg Exp $' |
9982 | 397 |
! ! |
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
398 |