author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 08 May 2014 13:26:48 +0200 | |
changeset 14326 | 8b59bf2da03e |
parent 13977 | 318b1b0d6b66 |
child 14328 | 9510671ea784 |
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 |
|
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
31 |
instanceVariableNames:'breakpoints currentMethod currentMethodClass methodHolder' |
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 |
||
13101 | 67 |
!BreakpointService class methodsFor:'accessing'! |
68 |
||
69 |
label |
|
70 |
"Answers a short label - for UI" |
|
71 |
||
72 |
^ 'Breakpoints' |
|
73 |
! ! |
|
74 |
||
13206 | 75 |
!BreakpointService class methodsFor:'testing'! |
76 |
||
77 |
isUsefulFor:aCodeView |
|
78 |
"this filters useful services. |
|
79 |
Redefined to return true for myself - not for subclasses" |
|
80 |
||
81 |
^ self == Tools::BreakpointService |
|
82 |
||
83 |
"Created: / 22-07-2013 / 14:01:17 / cg" |
|
84 |
! ! |
|
85 |
||
10226 | 86 |
!BreakpointService methodsFor:'accessing'! |
87 |
||
88 |
breakpoints |
|
89 |
^ breakpoints |
|
90 |
! ! |
|
91 |
||
10208 | 92 |
!BreakpointService methodsFor:'change & update'! |
93 |
||
94 |
update: aspect with: param from: sender |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
95 |
aspect == #visibility ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
96 |
aspect == #sizeOfView ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
97 |
aspect == #classHolder ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
98 |
aspect == #languageHolder ifTrue:[^ self]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
99 |
sender == codeView modifiedChannel ifTrue:[^ self]. |
10208 | 100 |
|
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
101 |
"/ ATTENTION: I thought that fetching the methodHolder once in initialize would |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
102 |
"/ be ok. However, it seems not (codeView gives me something which it does not use/change later). |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
103 |
"/ so this fetch is called in update as well. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
104 |
"/ maybe s.o. (ie. Jan) fixes CodeView2 |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
105 |
(aspect == #methodHolder or:[sender == self fetchMethodHolder]) ifTrue:[ |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
106 |
self updateCurrentMethod. |
10208 | 107 |
]. |
108 |
super update: aspect with: param from: sender |
|
109 |
||
110 |
"Created: / 06-07-2011 / 15:21:08 / cg" |
|
111 |
! |
|
112 |
||
113 |
updateBreakPointsFor:aMethod |
|
114 |
|methodsBreakPoints| |
|
115 |
||
13216
d1db940d42fb
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13209
diff
changeset
|
116 |
"/ Transcript show:'update breakpoints for method: '; showCR:aMethod. |
10208 | 117 |
aMethod notNil ifTrue:[ |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
118 |
aMethod literalsDo:[:eachLiteral | |
13216
d1db940d42fb
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13209
diff
changeset
|
119 |
(eachLiteral isKindOf:Breakpoint) ifTrue:[ |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
120 |
methodsBreakPoints isNil ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
121 |
methodsBreakPoints := OrderedCollection new. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
122 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
123 |
methodsBreakPoints add:eachLiteral copy. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
124 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
125 |
]. |
13106 | 126 |
currentMethodClass := aMethod mclass. |
127 |
] ifFalse:[ |
|
128 |
currentMethodClass := nil |
|
10208 | 129 |
]. |
130 |
breakpoints := methodsBreakPoints. |
|
131 |
currentMethod := aMethod. |
|
132 |
||
133 |
"Created: / 06-07-2011 / 15:24:09 / cg" |
|
10226 | 134 |
"Modified: / 06-07-2011 / 17:32:54 / jv" |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
135 |
! |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
136 |
|
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
137 |
updateCurrentMethod |
13101 | 138 |
|method realMethod oldBreakPoints| |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
139 |
|
13106 | 140 |
"/ codeView methodHolder class == BlockValue ifTrue:[self breakPoint:#cg]. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
141 |
|
13201
3b6f308a7280
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13191
diff
changeset
|
142 |
method := realMethod := codeView method. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
143 |
(method notNil and:[method mclass isNil]) ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
144 |
"/ hack: ouch - was wrapped in the meantime; |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
145 |
"/ hurry up and update. Should be done elsewhere (in codeView) |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
146 |
realMethod := MethodWithBreakpoints allInstances detect:[:m | m originalMethod == method and:[m mclass notNil]] ifNone:nil. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
147 |
realMethod isNil ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
148 |
realMethod := WrappedMethod allInstances detect:[:m | m originalMethod == method and:[m mclass notNil]] ifNone:nil. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
149 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
150 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
151 |
realMethod ~~ currentMethod ifTrue:[ |
13573
70135af4ddeb
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13572
diff
changeset
|
152 |
"/ self fetchMethodHolder setValue:realMethod. |
13101 | 153 |
oldBreakPoints := breakpoints. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
154 |
self updateBreakPointsFor:realMethod. |
13101 | 155 |
oldBreakPoints ~= breakpoints ifTrue:[ |
156 |
gutterView invalidate. |
|
157 |
] |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
158 |
]. |
13201
3b6f308a7280
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13191
diff
changeset
|
159 |
|
3b6f308a7280
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13191
diff
changeset
|
160 |
"Modified: / 22-07-2013 / 13:33:28 / cg" |
10208 | 161 |
! ! |
162 |
||
9982 | 163 |
!BreakpointService methodsFor:'event handling'! |
164 |
||
11607 | 165 |
buttonPress:button x:x y:y in:view |
10714
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
166 |
|lineNr| |
3399fb50f42e
changed: #buttonPress:x:y:in:
Claus Gittinger <cg@exept.de>
parents:
10411
diff
changeset
|
167 |
|
9982 | 168 |
view == gutterView ifTrue:[ |
13152
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
169 |
button == 1 ifTrue:[ |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
170 |
lineNr := textView yVisibleToLineNr:y. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
171 |
lineNr notNil ifTrue:[ self setOrToggleBreakpointAtLine:lineNr ]. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
172 |
^ true. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
173 |
]. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
174 |
button == 3 ifTrue:[ |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
175 |
^ true. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
176 |
] |
9982 | 177 |
]. |
10182 | 178 |
^ false |
9982 | 179 |
|
180 |
"Created: / 17-06-2011 / 13:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
181 |
"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
|
182 |
"Modified: / 19-09-2011 / 14:41:00 / cg" |
10226 | 183 |
! |
184 |
||
14326
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
185 |
keyPress:key x:x y:y in: view |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
186 |
"Handles an event in given view (a subview of codeView). |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
187 |
If the method returns true, it has eaten the event and it will not be processed |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
188 |
by the view." |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
189 |
|
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
190 |
key == #Accept ifTrue:[ |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
191 |
textView undoableDo:[ |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
192 |
BreakpointQuery answer: breakpoints do:[ |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
193 |
textView accept. |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
194 |
]. |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
195 |
]. |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
196 |
^ true |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
197 |
]. |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
198 |
^ false |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
199 |
|
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
200 |
"Created: / 08-05-2014 / 10:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
201 |
! |
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
202 |
|
10226 | 203 |
linesDeletedFrom: start to: end |
204 |
||
205 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
206 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) negated |
|
207 |
||
208 |
"Created: / 06-07-2011 / 17:16:27 / jv" |
|
209 |
! |
|
210 |
||
211 |
linesInsertedFrom: start to: end |
|
212 |
||
213 |
breakpoints isEmptyOrNil ifTrue:[^self]. |
|
214 |
self moveBreakpointsAfterLine: start - 1 by: (end - start + 1) |
|
215 |
||
216 |
"Created: / 06-07-2011 / 17:16:36 / jv" |
|
9982 | 217 |
! ! |
218 |
||
13126
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
219 |
!BreakpointService methodsFor:'help'! |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
220 |
|
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
221 |
flyByHelpText |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
222 |
|topView| |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
223 |
|
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
224 |
(self canCreateOrToggleBreakpointAtLine:nil) ifFalse:[ |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
225 |
((topView := codeView topView) class == DebugView) ifTrue:[ |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
226 |
self hasBreakpoints ifFalse:[ |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
227 |
^ 'Sorry - cannot add breakpoint in the debugger (would need recompilation)\(can only add breakpoints if stopped at a method breakpoint)' withCRs |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
228 |
]. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
229 |
^ 'Sorry - cannot add new breakpoint if method is already entered\(i.e. if not stopped at a breakpoint).' withCRs |
13126
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
230 |
]. |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
231 |
^ 'Cannot add breakpoint when modified. Please accept first.' |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
232 |
]. |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
233 |
|
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
234 |
^ 'Click to toggle breakpoint. Shift-Click to toggle tracepoint.' |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
235 |
|
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
236 |
"Created: / 27-01-2012 / 14:04:52 / cg" |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
237 |
! ! |
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
238 |
|
9982 | 239 |
!BreakpointService methodsFor:'initialization'! |
240 |
||
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
241 |
fetchMethodHolder |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
242 |
"redefinable in subclasses, which do not have a codeView2/methodHolder" |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
243 |
|
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
244 |
"/ ATTENTION: I thought that fetching the methodHolder once in initialize would |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
245 |
"/ be ok. However, it seems not (codeView gives me something which it does not use/change later). |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
246 |
"/ so this fetch is called in update as well. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
247 |
"/ maybe s.o. (ie. Jan) fixes CodeView2 |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
248 |
methodHolder := codeView methodHolder. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
249 |
^ methodHolder |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
250 |
! |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
251 |
|
9982 | 252 |
initialize |
253 |
||
254 |
super initialize. |
|
255 |
breakpoints := OrderedCollection new. |
|
256 |
||
257 |
"Created: / 17-06-2011 / 13:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
258 |
! ! |
|
259 |
||
260 |
!BreakpointService methodsFor:'private'! |
|
261 |
||
11607 | 262 |
breakpointAtLine:line |
10182 | 263 |
|pos| |
9982 | 264 |
|
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
265 |
breakpoints isNil ifTrue:[^ nil]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
266 |
|
9982 | 267 |
pos := textView characterPositionOfLine:line col:1. |
13191
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
268 |
^ breakpoints |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
269 |
detect:[:each | each position = pos ] |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
270 |
ifNone:[ |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
271 |
breakpoints |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
272 |
detect:[:each | each line == line and:[each position isNil ]] |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
273 |
ifNone:[ nil ] |
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
274 |
] |
9982 | 275 |
|
276 |
"Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 277 |
"Modified (format): / 05-07-2011 / 21:33:23 / cg" |
278 |
! |
|
279 |
||
10226 | 280 |
moveBreakpointsAfterLine:line by: delta |
281 |
|pos | |
|
282 |
||
283 |
breakpoints do:[:bpnt| |
|
11719 | 284 |
bpnt line >= line ifTrue:[ |
285 |
pos := textView characterPositionOfLine:bpnt line + delta col:1. |
|
286 |
bpnt position:pos line:(bpnt line + delta). |
|
287 |
] |
|
10226 | 288 |
]. |
289 |
||
290 |
"/gutterView redrawLinesFrom: line. |
|
291 |
||
292 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
293 |
"Created: / 06-07-2011 / 17:26:30 / jv" |
|
11719 | 294 |
"Modified: / 02-08-2012 / 09:27:10 / cg" |
10226 | 295 |
! |
296 |
||
10182 | 297 |
recompile |
298 |
"recompile the current method for changed breakpoints" |
|
299 |
||
13209
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
300 |
|oldMethod newMethod compilerClass compiler class selector| |
10182 | 301 |
|
13201
3b6f308a7280
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13191
diff
changeset
|
302 |
oldMethod := codeView method. |
11719 | 303 |
(oldMethod notNil and:[oldMethod hasPrimitiveCode not]) ifTrue:[ |
304 |
"/ be careful: if the text has been edited/modified, do not compile |
|
305 |
textView modified ifTrue:[ |
|
306 |
self breakPoint: #cg. |
|
307 |
self breakPoint: #jv. |
|
308 |
^self. |
|
309 |
] ifFalse:[ |
|
310 |
"/ prepare to get reachable bpts |
|
311 |
breakpoints do:[:bp | bp isReached:false]. |
|
312 |
||
313 |
class := oldMethod mclass. |
|
314 |
class isNil ifTrue:[ |
|
315 |
class := codeView classHolder value. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
316 |
class isNil ifTrue:[ |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
317 |
self breakPoint:#jv. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
318 |
Dialog warn:'oops - lost the methods''s class'. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
319 |
^ self. |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
320 |
] |
11719 | 321 |
]. |
322 |
selector := oldMethod selector. |
|
10182 | 323 |
|
11719 | 324 |
Class withoutUpdatingChangesDo:[ |
13209
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
325 |
"/ compilerClass := ByteCodeCompilerWithBreakpointSupport. |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
326 |
compilerClass := oldMethod programmingLanguage compilerWithBreakpointSupportClass. |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
327 |
compilerClass isNil ifTrue:[ |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
328 |
Dialog warn:'No breakpoint support for this programming language'. |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
329 |
^ self. |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
330 |
]. |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
331 |
compiler := compilerClass new. |
11719 | 332 |
compiler breakpoints:breakpoints. |
13209
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
333 |
"/ not needed - new compilers already know it |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
334 |
"/ compiler methodClass:(oldMethod programmingLanguage isSTXJavaScript |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
335 |
"/ ifTrue:[JavaScriptFunctionWithBreakpoints] |
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
336 |
"/ ifFalse:[MethodWithBreakpoints]). |
11719 | 337 |
newMethod := compiler |
338 |
compile:oldMethod source |
|
339 |
forClass:class |
|
340 |
inCategory:oldMethod category |
|
341 |
notifying:nil |
|
342 |
install:false |
|
343 |
skipIfSame:false |
|
344 |
silent:true |
|
345 |
foldConstants:true |
|
11987 | 346 |
ifFail:[ Transcript showCR:'BreakpointService: failed to recompile for breakpoint' ]. |
10182 | 347 |
|
11719 | 348 |
selector isNil ifTrue:[ |
349 |
"/ May happen as the selector is not stored in the method but |
|
350 |
"/ searches through method's mclass methodDictionary. |
|
351 |
"/ Following should be save as breakpoint is not installed when |
|
352 |
"/ the code is modified... |
|
353 |
selector := compiler selector. |
|
354 |
]. |
|
355 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
356 |
oldMethod isWrapped ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
357 |
"/ update the wrapped method - do not install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
358 |
newMethod originalMethod: oldMethod originalMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
359 |
oldMethod replaceOriginalMethodWith:newMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
360 |
] ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
361 |
"/ install |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
362 |
newMethod originalMethod: oldMethod. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
363 |
(class primAddSelector: selector withMethod:newMethod) ifFalse:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
364 |
oldMethod mclass:class. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
365 |
self breakPoint: #cg. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
366 |
self breakPoint: #jv. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
367 |
^ self |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
368 |
]. |
11719 | 369 |
]. |
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
370 |
|
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
371 |
breakpoints := breakpoints |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
372 |
select:[:bp | |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
373 |
"/ bp isReached ifFalse:[ |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
374 |
"/ "/ Transcript show:'remove unreached:'; showCR:bp |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
375 |
"/ ]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
376 |
bp isReached |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
377 |
]. |
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
378 |
|
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
379 |
"/ 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
|
380 |
"/ notification, which may clear the breakpoints collection!! |
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
381 |
self fetchMethodHolder value:newMethod. |
11719 | 382 |
oldMethod mclass isNil ifTrue:[ |
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
383 |
"/ although this is not strictly true, not doing this |
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
384 |
"/ would confuse a lot of other tools (such as the browser) |
11719 | 385 |
oldMethod mclass:class. |
386 |
]. |
|
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
387 |
class changed:#methodTrap with:selector. "/ tell browsers |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
388 |
Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector). |
11719 | 389 |
]. |
390 |
] |
|
10182 | 391 |
] |
392 |
||
393 |
"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
|
394 |
"Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13209
887b3ce3c6e2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13206
diff
changeset
|
395 |
"Modified: / 22-07-2013 / 16:00:13 / cg" |
9982 | 396 |
! |
397 |
||
11607 | 398 |
setOrToggleBreakpointAtLine:line |
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
399 |
|pos bpnt prepareFullBreakSupport mClass ok| |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
400 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
401 |
"/ if true, setting a single breakpoint in a method will create |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
402 |
"/ a whole set of invisible (and disabled) breakpoints in that method, |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
403 |
"/ one for each line. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
404 |
"/ These can later be enabled in the debugger |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
405 |
"/ (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
|
406 |
"/ to set additional breakpoints). |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
407 |
"/ 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
|
408 |
"/ prepareFullBreakSupport := false. |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
409 |
prepareFullBreakSupport := true. |
9982 | 410 |
|
13201
3b6f308a7280
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13191
diff
changeset
|
411 |
codeView method isNil ifTrue:[ |
13152
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
412 |
^ self |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
413 |
]. |
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
414 |
|
12855
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
415 |
textView reallyModified ifTrue:[ |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
416 |
"/ leads to ugly behavior (method no longer found), if we allow |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
417 |
"/ this... |
13152
778f0a1b39c2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13126
diff
changeset
|
418 |
Dialog warn:'Please accept first (cannot set breakpoint while text is modified)'. |
12855
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
419 |
^ self |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
420 |
]. |
ab87c94ed5ac
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12507
diff
changeset
|
421 |
|
9982 | 422 |
bpnt := self breakpointAtLine:line. |
10182 | 423 |
bpnt isNil ifTrue:[ |
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
424 |
"/ no breakpoint there - create a new one as required (i.e. recompile) |
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
425 |
ok := (self canCreateOrToggleBreakpointAtLine:line). |
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
426 |
ok ifFalse:[ |
13626
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
427 |
(currentMethod isMethodWithBreakpoints and:[ prepareFullBreakSupport ]) ifFalse:[ |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
428 |
codeView topView class == DebugView ifTrue:[ |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
429 |
(Dialog |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
430 |
confirm:'Sorry, in an active method, I can only add new breakpoints in an already breakpointed method. |
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
431 |
(i.e. a method stopped at a method breakpoint or one which already has statement breakpoints) |
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
432 |
The reason is that the method needs to be recompiled for the breakpoint, which would not affect the method being currently executed. |
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
433 |
|
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
434 |
You can proceed to set the breakpoint, but it will only affect the next call into this method, not the current invocation.' |
13626
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
435 |
yesLabel:'Set Breakpoint for Next Call' noLabel:'Ok') ifTrue:[ |
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
436 |
self halt. |
13626
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
437 |
ok := true. |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
438 |
] |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
439 |
] ifFalse:[ |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
440 |
Dialog warn:'Sorry, cannot add a new breakpoint here.'. |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
441 |
]. |
be8007cd7f4e
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13573
diff
changeset
|
442 |
] |
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
443 |
]. |
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
444 |
ok ifTrue:[ |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
445 |
prepareFullBreakSupport ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
446 |
"/ add a (disabled) breakpoint for every source line. This |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
447 |
"/ allows for breakpoints to be enabled/disabled in the debugger... |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
448 |
1 to:textView numberOfLines do:[:eachLine | |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
449 |
|oldBPnt eachPos otherBpnt| |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
450 |
|
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
451 |
oldBPnt := self breakpointAtLine:eachLine. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
452 |
oldBPnt isNil ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
453 |
eachPos := textView characterPositionOfLine:eachLine col:1. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
454 |
breakpoints isNil ifTrue:[ breakpoints := OrderedCollection new]. |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
455 |
breakpoints add:((otherBpnt := Breakpoint new) position:eachPos line:eachLine). |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
456 |
eachLine == line ifTrue:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
457 |
bpnt := otherBpnt. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
458 |
] ifFalse:[ |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
459 |
otherBpnt beInvisible. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
460 |
] |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
461 |
]. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
462 |
]. |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
463 |
] ifFalse:[ |
13080
5ad43ae672b1
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12976
diff
changeset
|
464 |
pos := textView characterPositionOfLine:line col:1. |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
465 |
breakpoints add:((bpnt := Breakpoint new) position:pos line:line). |
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
466 |
]. |
13763
3e48baee0941
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13626
diff
changeset
|
467 |
Screen current shiftDown ifTrue:[ |
11719 | 468 |
"/ trace |
469 |
bpnt beTracepoint |
|
470 |
]. |
|
12969
3642a54942f0
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12949
diff
changeset
|
471 |
self assert: breakpoints notEmptyOrNil. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
472 |
|
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
473 |
"/ recompile the method with breakpoints |
11719 | 474 |
self recompile. |
12906
58e97bbbf5a4
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12902
diff
changeset
|
475 |
] |
10182 | 476 |
] ifFalse:[ |
12940
7ef425531618
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12906
diff
changeset
|
477 |
"/ breakpoint already there - just enable/disable |
13763
3e48baee0941
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13626
diff
changeset
|
478 |
Screen current shiftDown ifTrue:[ |
11719 | 479 |
bpnt toggleTracing |
480 |
] ifFalse:[ |
|
481 |
bpnt toggle. |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
482 |
]. |
13359
969a96c3a4b6
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13216
diff
changeset
|
483 |
(mClass := currentMethod mclass) isNil ifTrue:[ |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
484 |
"/ hack: ouch - was wrapped in the meantime; |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
485 |
"/ hurry up and update. Should be done elsewhere (in codeView) |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
486 |
self updateCurrentMethod. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
487 |
currentMethod notNil ifTrue:[ mClass := currentMethod mclass ]. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
488 |
]. |
13359
969a96c3a4b6
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13216
diff
changeset
|
489 |
mClass notNil ifTrue:[ |
969a96c3a4b6
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13216
diff
changeset
|
490 |
Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:mClass changeSelector:currentMethod selector). |
969a96c3a4b6
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13216
diff
changeset
|
491 |
]. |
10182 | 492 |
]. |
11987 | 493 |
|
13977
318b1b0d6b66
Oops, fixed problem introduced by previous fix.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13976
diff
changeset
|
494 |
(bpnt notNil and:[bpnt isReached not]) ifTrue:[ |
13976
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
495 |
| app | |
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
496 |
|
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
497 |
app := codeView application. |
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
498 |
(app respondsTo: #showInfo:) ifTrue:[ |
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
499 |
app showInfo: 'Cannot set breakpoint here, try another line...'. |
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
500 |
]. |
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
501 |
codeView flash. |
13977
318b1b0d6b66
Oops, fixed problem introduced by previous fix.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13976
diff
changeset
|
502 |
] ifFalse:[ |
318b1b0d6b66
Oops, fixed problem introduced by previous fix.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13976
diff
changeset
|
503 |
gutterView redrawLine:line. |
13976
b8a79a63de5c
When breakpoint cannot be inserted at given light, flash and put little notice to browser's statusbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13763
diff
changeset
|
504 |
]. |
9982 | 505 |
|
506 |
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13395
64b70dc92a1c
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13359
diff
changeset
|
507 |
"Modified: / 28-08-2013 / 14:45:36 / cg" |
13977
318b1b0d6b66
Oops, fixed problem introduced by previous fix.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13976
diff
changeset
|
508 |
"Modified: / 21-02-2014 / 17:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9982 | 509 |
! ! |
510 |
||
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
511 |
!BreakpointService methodsFor:'queries'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
512 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
513 |
canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
514 |
"is it possible to place a breakpoint here and now?" |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
515 |
|
13126
6c0fc3e2986a
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13106
diff
changeset
|
516 |
|bpnt topView| |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
517 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
518 |
textView reallyModified ifTrue:[ |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
519 |
"/ this is not really true - we could keep track of where the breakpoints |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
520 |
"/ are while editing and shift them as required. |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
521 |
"/ (another idea worth a try would be |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
522 |
"/ to match the original parsetree (enumerating nodes with the breakpoints) |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
523 |
"/ against the new parsetree (walking in sync?) when finally compiling, |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
524 |
"/ and placing new breakpoints on matching tree nodes. |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
525 |
"/ (too much work, for a quick solution, I guess) |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
526 |
^ false |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
527 |
]. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
528 |
|
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
529 |
"/ can always toggle existing breakpoints... |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
530 |
lineOrNilForAnywhere notNil ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
531 |
bpnt := self breakpointAtLine:lineOrNilForAnywhere. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
532 |
bpnt notNil ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
533 |
^ true. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
534 |
] |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
535 |
] ifFalse:[ |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
536 |
(currentMethod notNil and:[currentMethod isMethodWithBreakpoints]) ifTrue:[ |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
537 |
^ true. |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
538 |
] |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
539 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
540 |
|
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
541 |
"/ ok, the method has no breakpoints yet. |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
542 |
|
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
543 |
"/ this is a bad hack - looking into the debugger's state here. |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
544 |
"/ I guess, we have to move code around a bit... |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
545 |
((topView := codeView topView) class == DebugView) ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
546 |
"/ can only create new breakpoints in the debugger, |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
547 |
"/ iff we are in a wrapped method's prolog |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
548 |
topView selectedContextIsWrapped ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
549 |
topView selectedContext lineNumber == 1 ifTrue:[ |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
550 |
^ true |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
551 |
]. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
552 |
]. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
553 |
|
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
554 |
"/ well, if the debugger's code has already been modified, |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
555 |
"/ we will accept the new code anyway. So there's no problem in adding |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
556 |
"/ a breakpoint on the fly... |
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
557 |
topView showingAlreadyModifiedCode ifTrue:[^ true]. |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
558 |
^ false. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
559 |
]. |
13420
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
560 |
|
3f8f012f121b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13395
diff
changeset
|
561 |
"/ in a non-debugger, we can do it. |
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
562 |
^ true. |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
563 |
! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
564 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
565 |
hasBreakpoints |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
566 |
^ breakpoints notEmptyOrNil |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
567 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
568 |
|
9982 | 569 |
!BreakpointService methodsFor:'redrawing'! |
570 |
||
11607 | 571 |
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg |
9982 | 572 |
"Called by both gutterView and textView (well, not yet) to |
573 |
allow services to draw custom things on text view. |
|
574 |
Ask JV what the args means if unsure (I'm lazy to document |
|
575 |
them, now it is just an experiment...)" |
|
11607 | 576 |
|
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
577 |
|mthd bpnt icon dx dy| |
9982 | 578 |
|
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
579 |
"/ these tests make the breakpointService unusable for other applications (which are not |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
580 |
"/ based on smalltalk methods). They are not really needed: if there is a breakpoint, |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
581 |
"/ I can show it. Period. |
13191
9745eed50f03
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13157
diff
changeset
|
582 |
|
13573
70135af4ddeb
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13572
diff
changeset
|
583 |
"/ (mthd := self fetchMethodHolder value) isNil ifTrue:[ |
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
584 |
"/ ^ self |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
585 |
"/ ]. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
586 |
"/ currentMethodClass isNil ifTrue:[ |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
587 |
"/ "/ hack: ouch - was wrapped in the meantime; |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
588 |
"/ ^ self. "/ wait for the real update |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
589 |
"/ "/ hurry up and update. Should be done elsewhere (in codeView) |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
590 |
"/ "/ self updateCurrentMethod. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
591 |
"/ ]. |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
592 |
|
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
593 |
view == gutterView ifTrue:[ |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
594 |
bpnt := self breakpointAtLine:lineNo. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
595 |
bpnt isNil ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
596 |
^ self |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
597 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
598 |
icon := bpnt icon. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
599 |
icon isNil ifTrue:[ |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
600 |
^ self |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
601 |
]. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
602 |
dx := ((w - icon width) / 2) rounded. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
603 |
dy := ((h - icon height) / 2) rounded. |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
604 |
icon |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
605 |
displayOn:view |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
606 |
x:x + dx |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
607 |
y:y - h + dy + 4. "TODO: Magic constant" |
9982 | 608 |
]. |
609 |
||
610 |
"Created: / 17-06-2011 / 13:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10182 | 611 |
"Modified (format): / 05-07-2011 / 22:14:33 / cg" |
9982 | 612 |
! ! |
613 |
||
13572
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
614 |
!BreakpointService methodsFor:'registering'! |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
615 |
|
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
616 |
registerIn:aCodeView |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
617 |
super registerIn:aCodeView. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
618 |
self fetchMethodHolder. |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
619 |
! ! |
7b7d06d0d564
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
13420
diff
changeset
|
620 |
|
12902
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
621 |
!BreakpointService methodsFor:'testing'! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
622 |
|
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
623 |
isBreakpointService |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
624 |
^ true |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
625 |
! ! |
724e09dfd9a2
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
626 |
|
9982 | 627 |
!BreakpointService class methodsFor:'documentation'! |
628 |
||
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
629 |
version |
14326
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
630 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $' |
12949
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
631 |
! |
320a22d3c70b
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
632 |
|
9982 | 633 |
version_CVS |
14326
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
634 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $' |
9982 | 635 |
! |
636 |
||
637 |
version_SVN |
|
14326
8b59bf2da03e
When accepting a modified code, tell the compiler to reinsert breakpoints if any.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13977
diff
changeset
|
638 |
^ '$Id: Tools__BreakpointService.st,v 1.46 2014-05-08 11:26:48 vrany Exp $' |
9982 | 639 |
! ! |
12507
3fa9ae668d96
class: Tools::BreakpointService
Claus Gittinger <cg@exept.de>
parents:
11987
diff
changeset
|
640 |