author | Claus Gittinger <cg@exept.de> |
Thu, 16 Mar 2017 18:54:52 +0100 | |
changeset 4139 | 1eaaab745ca8 |
parent 4136 | 926d1bd50818 |
child 4201 | 858fe63ce55e |
permissions | -rw-r--r-- |
2510 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3129
7b4542cc9a9e
Added support for new breakpoint implementation. Backward compatible.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3128
diff
changeset
|
3 |
All Rights Reserved |
2510 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libcomp' }" |
|
13 |
||
3588 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2510 | 16 |
Object subclass:#Breakpoint |
3509
96499f5b060d
Removed code for not-yet-finished new breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3491
diff
changeset
|
17 |
instanceVariableNames:'position description line isReached method' |
3149 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler-Debugging' |
|
2510 | 21 |
! |
22 |
||
23 |
!Breakpoint class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3129
7b4542cc9a9e
Added support for new breakpoint implementation. Backward compatible.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3128
diff
changeset
|
28 |
All Rights Reserved |
2510 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
3347 | 37 |
! |
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
statement breakpoint support. |
|
42 |
Instances of me are placed into a (bytecode-) compiled method's |
|
43 |
literal array and are sent messages dynamically when a statement |
|
44 |
with a breakpoint is about to be executed. |
|
45 |
" |
|
2510 | 46 |
! ! |
47 |
||
48 |
!Breakpoint class methodsFor:'instance creation'! |
|
49 |
||
50 |
new |
|
51 |
"return an initialized instance" |
|
52 |
||
53 |
^ self basicNew initialize. |
|
54 |
! ! |
|
55 |
||
3973 | 56 |
!Breakpoint class methodsFor:'queries'! |
57 |
||
58 |
breakpointDescriptionClass |
|
59 |
"redefinable in subclasses" |
|
60 |
||
61 |
^ BreakpointDescription |
|
62 |
! ! |
|
63 |
||
3354 | 64 |
!Breakpoint class methodsFor:'utilities'! |
65 |
||
66 |
disableAllBreakpoints |
|
3491 | 67 |
MethodWithBreakpoints allBreakpointedMethods do:[:m | |
68 |
m disableAllBreakpoints |
|
3354 | 69 |
] |
70 |
||
71 |
"Created: / 03-02-2014 / 10:35:55 / cg" |
|
72 |
! ! |
|
73 |
||
2510 | 74 |
!Breakpoint methodsFor:'accessing'! |
75 |
||
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
76 |
description |
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
77 |
^ description |
2510 | 78 |
! |
79 |
||
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
80 |
description:aBreakpointDescription |
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
81 |
description := aBreakpointDescription. |
2510 | 82 |
! |
83 |
||
2541 | 84 |
isReached |
85 |
^ isReached |
|
86 |
! |
|
87 |
||
88 |
isReached:aBoolean |
|
89 |
isReached := aBoolean. |
|
90 |
! |
|
91 |
||
2510 | 92 |
line |
3884 | 93 |
"the lineNr" |
94 |
||
2510 | 95 |
^ line |
96 |
! |
|
97 |
||
3465 | 98 |
line:lineArg |
99 |
self assert:lineArg >= 0. |
|
100 |
line := lineArg. |
|
2510 | 101 |
! |
102 |
||
3588 | 103 |
method:something |
104 |
method := something. |
|
105 |
! |
|
106 |
||
2510 | 107 |
position |
108 |
^ position |
|
109 |
! |
|
110 |
||
2894 | 111 |
position:anInteger |
112 |
position := anInteger. |
|
113 |
||
114 |
"Modified (format): / 02-08-2012 / 09:26:03 / cg" |
|
115 |
! |
|
116 |
||
117 |
position:positionArg line:lineArg |
|
118 |
position := positionArg. |
|
119 |
line := lineArg. |
|
3465 | 120 |
self assert:lineArg >= 0. |
2894 | 121 |
|
122 |
"Created: / 02-08-2012 / 09:26:27 / cg" |
|
2510 | 123 |
! ! |
124 |
||
125 |
!Breakpoint methodsFor:'initialization'! |
|
126 |
||
127 |
initialize |
|
128 |
"Invoked when a new instance is created." |
|
129 |
||
130 |
"/ please change as required (and remove this comment) |
|
131 |
"/ method := nil. |
|
132 |
"/ position := nil. |
|
3973 | 133 |
description := self class breakpointDescriptionClass new. |
2510 | 134 |
"/ line := nil. |
135 |
||
136 |
"/ super initialize. -- commented since inherited method does nothing |
|
137 |
||
3509
96499f5b060d
Removed code for not-yet-finished new breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3491
diff
changeset
|
138 |
"Modified: / 21-08-2014 / 09:35:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2510 | 139 |
! ! |
140 |
||
141 |
!Breakpoint methodsFor:'printing & storing'! |
|
142 |
||
3982 | 143 |
printBreakpointNrInDebuggerOn:aStream |
144 |
"to be redefined for concrete debuggers" |
|
145 |
! |
|
146 |
||
2510 | 147 |
printOn:aStream |
3930 | 148 |
"append a printed representation of the receiver to the argument, aStream" |
2510 | 149 |
|
3982 | 150 |
aStream nextPutAll: 'BPNT '. |
151 |
self printBreakpointNrInDebuggerOn:aStream. |
|
152 |
aStream nextPutAll: ' at'. |
|
3149 | 153 |
position notNil ifTrue:[ |
154 |
aStream |
|
3202 | 155 |
nextPutAll: ' source position:'; |
3149 | 156 |
nextPutAll: position printString. |
3202 | 157 |
]. |
158 |
line notNil ifTrue:[ |
|
159 |
aStream |
|
160 |
nextPutAll: ' line:'; |
|
161 |
nextPutAll: line printString. |
|
162 |
]. |
|
163 |
(position isNil and:[line isNil]) ifTrue:[ |
|
164 |
aStream nextPutAll: ' ???' |
|
3149 | 165 |
] |
166 |
||
167 |
"Modified: / 24-04-2013 / 20:42:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2510 | 168 |
! ! |
169 |
||
170 |
!Breakpoint methodsFor:'support'! |
|
171 |
||
3196 | 172 |
beInvisible |
173 |
"make this breakpoint hidden (in gutter)" |
|
174 |
||
175 |
description beInvisible |
|
176 |
! |
|
177 |
||
2795 | 178 |
beTracepoint |
179 |
"make this breakpoint a tracepoint" |
|
180 |
||
181 |
description beTracepoint |
|
182 |
||
183 |
"Created: / 27-01-2012 / 13:56:11 / cg" |
|
184 |
! |
|
185 |
||
2510 | 186 |
break |
2545 | 187 |
"invoked by the breakPoint's code (see BreakPointNode)" |
2510 | 188 |
|
189 |
<resource: #skipInDebuggersWalkBack> |
|
190 |
||
4082 | 191 |
|sender mthd where lineNr message source sourceLine| |
2795 | 192 |
|
3223 | 193 |
description isEnabled ifFalse:[^ self]. |
2795 | 194 |
sender := thisContext sender. |
195 |
(description shouldBreakIn: sender) ifTrue:[ |
|
4136 | 196 |
message := 'Breakpoint encountered at line %1 in %2'. |
197 |
where := '?'. |
|
198 |
||
3631 | 199 |
mthd := method. |
3683 | 200 |
mthd notNil ifTrue:[ |
201 |
mthd mclass isNil ifTrue:[ |
|
202 |
mthd := sender method. |
|
203 |
]. |
|
4136 | 204 |
where := mthd whoString. |
4082 | 205 |
|
4136 | 206 |
(lineNr := self line) notNil ifTrue:[ |
207 |
(source := mthd source) notNil ifTrue:[ |
|
208 |
sourceLine := source asStringCollection at:lineNr ifAbsent:[nil]. |
|
209 |
sourceLine notNil ifTrue:[ |
|
210 |
message := 'Breakpoint encountered at\\%3\\line %1 in %2' withCRs. |
|
211 |
sourceLine := (sourceLine withoutLeadingSeparators contractAtEndTo:60) allItalic. |
|
212 |
]. |
|
4082 | 213 |
]. |
214 |
]. |
|
4136 | 215 |
]. |
2792 | 216 |
BreakPointInterrupt |
2510 | 217 |
raiseRequestWith: self |
4082 | 218 |
errorString:(message bindWith:self line with:where with:sourceLine) |
3490 | 219 |
"/ in:sender. |
2795 | 220 |
]. |
221 |
(description shouldTraceIn: sender) ifTrue:[ |
|
2797 | 222 |
Transcript |
223 |
show:Timestamp now; |
|
224 |
showCR:(' Trace %1 [%2]' bindWith:sender methodPrintString with:self line) |
|
2795 | 225 |
]. |
2510 | 226 |
|
227 |
"Created: / 15-06-2011 / 12:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
228 |
"Modified: / 11-07-2011 / 18:17:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4136 | 229 |
"Modified: / 07-03-2017 / 06:29:18 / cg" |
2510 | 230 |
! |
231 |
||
2968 | 232 |
disable |
233 |
"disable this breakpoint" |
|
234 |
||
3588 | 235 |
"/ if there is currently an ignore on this breakpoint in the debugger, remove it |
236 |
DebugView stopIgnoringHaltsFor:method atLineNr:line. |
|
2968 | 237 |
description disable |
238 |
! |
|
239 |
||
2510 | 240 |
toggle |
2792 | 241 |
"toggle this breakpoint" |
2510 | 242 |
|
3588 | 243 |
"/ if there is currently an ignore on this breakpoint in the debugger, remove it |
244 |
DebugView stopIgnoringHaltsFor:method atLineNr:line. |
|
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
245 |
description toggle |
2510 | 246 |
|
247 |
"Created: / 17-06-2011 / 13:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
248 |
"Modified: / 11-07-2011 / 18:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2792 | 249 |
"Modified (comment): / 27-01-2012 / 10:41:03 / cg" |
2795 | 250 |
! |
251 |
||
252 |
toggleTracing |
|
253 |
"toggle this breakpoint" |
|
254 |
||
255 |
description toggleTracing |
|
256 |
||
257 |
"Created: / 27-01-2012 / 13:56:05 / cg" |
|
2510 | 258 |
! ! |
259 |
||
260 |
!Breakpoint methodsFor:'testing'! |
|
261 |
||
262 |
isEnabled |
|
263 |
||
264 |
"Bad coding here, state should be full object" |
|
265 |
||
2551
4470029ad63a
Breakpoint state extracted to BreakpointDescription object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2545
diff
changeset
|
266 |
^description isEnabled |
2510 | 267 |
|
268 |
"Created: / 28-06-2011 / 08:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3202 | 269 |
! |
270 |
||
4000 | 271 |
isTracepoint |
272 |
^description isTracepoint |
|
273 |
! |
|
274 |
||
3202 | 275 |
isVisible |
276 |
^description isVisible |
|
2510 | 277 |
! ! |
278 |
||
279 |
!Breakpoint class methodsFor:'documentation'! |
|
280 |
||
2554
31516fc84824
#icon moved to stx:libtool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2551
diff
changeset
|
281 |
version |
3683 | 282 |
^ '$Header$' |
2554
31516fc84824
#icon moved to stx:libtool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2551
diff
changeset
|
283 |
! |
31516fc84824
#icon moved to stx:libtool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2551
diff
changeset
|
284 |
|
2510 | 285 |
version_CVS |
3683 | 286 |
^ '$Header$' |
2510 | 287 |
! |
288 |
||
289 |
version_SVN |
|
3196 | 290 |
^ '$ Id $' |
2510 | 291 |
! ! |
3115
3208c8b4661c
Some more support for new breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2968
diff
changeset
|
292 |