author | Claus Gittinger <cg@exept.de> |
Tue, 05 Jul 2011 23:24:58 +0200 | |
changeset 2537 | 72fde5f496de |
parent 2498 | 43bfd25f2552 |
child 2758 | 6e774a75b71d |
permissions | -rw-r--r-- |
2498 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
||
14 |
ByteCodeCompiler subclass:#ByteCodeCompilerWithBreakpointSupport |
|
15 |
instanceVariableNames:'breakpoints' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'System-Compiler-Debugging' |
|
19 |
! |
|
20 |
||
21 |
!ByteCodeCompilerWithBreakpointSupport class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
I'm an experimental compiler class that supports |
|
40 |
breakpoints. Once tested, the code will be merged |
|
41 |
to ByteCodeCompiler. |
|
42 |
||
43 |
[author:] |
|
44 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
45 |
||
46 |
[instance variables:] |
|
47 |
||
48 |
[class variables:] |
|
49 |
||
50 |
[see also:] |
|
51 |
||
52 |
" |
|
53 |
! ! |
|
54 |
||
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
55 |
!ByteCodeCompilerWithBreakpointSupport methodsFor:'adding breakpoint'! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
56 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
57 |
possiblyWrapABreakPointAround:aBlock |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
58 |
"refactored Jan's original code; changed to not wrap an already wrapped expression" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
59 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
60 |
| expr bpnt pos | |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
61 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
62 |
pos := tokenPosition ? source position. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
63 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
64 |
[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
65 |
breakpoints notEmpty |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
66 |
and:[breakpoints first position < pos] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
67 |
] whileTrue:[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
68 |
bpnt := breakpoints removeFirst |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
69 |
]. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
70 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
71 |
expr := aBlock value. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
72 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
73 |
bpnt isNil ifTrue:[^expr]. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
74 |
expr isBreakPointNode ifTrue:[^expr]. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
75 |
bpnt isReached:true. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
76 |
Transcript show:'adding breakpoint before: '; showCR:expr. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
77 |
^ BreakpointNode new |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
78 |
breakpoint: bpnt; |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
79 |
expression: expr; |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
80 |
lineNumber:(bpnt line ? tokenLineNr); |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
81 |
yourself |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
82 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
83 |
"Created: / 05-07-2011 / 21:11:19 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
84 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
85 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
86 |
removeMissedBreakpointsBefore:aPosition |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
87 |
[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
88 |
breakpoints notEmpty |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
89 |
and:[breakpoints first position < aPosition] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
90 |
] whileTrue:[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
91 |
breakpoints removeFirst |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
92 |
]. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
93 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
94 |
"Created: / 05-07-2011 / 23:13:25 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
95 |
! ! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
96 |
|
2498 | 97 |
!ByteCodeCompilerWithBreakpointSupport methodsFor:'parsing-expressions'! |
98 |
||
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
99 |
binaryExpression |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
100 |
^ self possiblyWrapABreakPointAround:[super binaryExpression] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
101 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
102 |
"Created: / 05-07-2011 / 23:08:43 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
103 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
104 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
105 |
binaryExpressionFor:aReceiver |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
106 |
^ self possiblyWrapABreakPointAround:[super binaryExpressionFor:aReceiver] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
107 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
108 |
"Created: / 05-07-2011 / 21:10:53 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
109 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
110 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
111 |
block |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
112 |
|blockNode| |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
113 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
114 |
self removeMissedBreakpointsBefore:source position. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
115 |
blockNode := super block. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
116 |
self removeMissedBreakpointsBefore:blockNode endPosition+2. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
117 |
^ blockNode |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
118 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
119 |
"Created: / 05-07-2011 / 22:56:19 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
120 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
121 |
|
2498 | 122 |
expression |
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
123 |
^ self possiblyWrapABreakPointAround:[super expression] |
2498 | 124 |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
125 |
"Created: / 16-06-2011 / 14:58:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
126 |
"Modified: / 05-07-2011 / 21:11:38 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
127 |
! |
2498 | 128 |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
129 |
primary |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
130 |
^ self possiblyWrapABreakPointAround:[super primary] |
2498 | 131 |
|
132 |
"Created: / 16-06-2011 / 14:58:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
133 |
"Modified: / 05-07-2011 / 21:11:38 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
134 |
"Created: / 05-07-2011 / 23:05:23 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
135 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
136 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
137 |
unaryExpression |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
138 |
^ self possiblyWrapABreakPointAround:[super unaryExpression] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
139 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
140 |
"Created: / 05-07-2011 / 23:08:54 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
141 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
142 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
143 |
unaryExpressionFor:aReceiver |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
144 |
^ self possiblyWrapABreakPointAround:[super unaryExpressionFor:aReceiver] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
145 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
146 |
"Created: / 05-07-2011 / 21:15:30 / cg" |
2498 | 147 |
! ! |
148 |
||
149 |
!ByteCodeCompilerWithBreakpointSupport methodsFor:'private'! |
|
150 |
||
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
151 |
breakpoints:aCollection |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
152 |
breakpoints := aCollection copy sort:[:a :b|a position < b position]. |
2498 | 153 |
|
154 |
"Created: / 16-06-2011 / 14:35:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
155 |
"Created: / 05-07-2011 / 21:37:28 / cg" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
156 |
! |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
157 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
158 |
notifying: anObject |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
159 |
super notifying: anObject. |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
160 |
anObject notNil ifTrue:[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
161 |
breakpoints isNil ifTrue:[ |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
162 |
self breakpoints:(anObject perform: #breakpoints ifNotUnderstood:#()). |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
163 |
] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
164 |
] |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
165 |
|
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
166 |
"Created: / 16-06-2011 / 14:35:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
167 |
"Modified: / 05-07-2011 / 21:48:37 / cg" |
2498 | 168 |
! ! |
169 |
||
170 |
!ByteCodeCompilerWithBreakpointSupport class methodsFor:'documentation'! |
|
171 |
||
172 |
version_CVS |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
173 |
^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompilerWithBreakpointSupport.st,v 1.2 2011-07-05 21:24:58 cg Exp $' |
2498 | 174 |
! |
175 |
||
176 |
version_SVN |
|
2537
72fde5f496de
fixes to make testSuite pass
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
177 |
^ '§ Id §' |
2498 | 178 |
! ! |