/[eiffelstudio]/branches/eth/eve/Src/Eiffel/debugger/breakpoints/breakpoint_location.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/debugger/breakpoints/breakpoint_location.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94983 - (show annotations)
Fri May 2 11:05:28 2014 UTC (5 years, 5 months ago) by jasonw
File size: 9340 byte(s)
<<Merged from trunk#94978.>>
1 note
2 description : "[
3 Describes a breakpoint's location. It is by its `body_index'
4 and its `breakable_line_number' (line number in stop points view).
5 ]"
6 legal: "See notice at end of class."
7 status: "See notice at end of class."
8 author : "$Author$"
9 date : "$Date$"
10 revision : "$Revision$"
11
12 frozen class
13 BREAKPOINT_LOCATION
14
15 inherit
16 BREAKPOINT_KEY_I
17 redefine
18 is_equal
19 end
20
21 E_FEATURE_COMPARER
22 redefine
23 is_equal
24 end
25
26 DEBUG_OUTPUT
27 redefine
28 is_equal
29 end
30
31 SHARED_WORKBENCH
32 redefine
33 is_equal
34 end
35
36 create {BREAKPOINTS_MANAGER}
37 make
38
39 create {BREAKPOINT, BREAKPOINT_LOCATION}
40 make_copy_for_saving
41
42 feature {NONE} -- Creation
43
44 make (a_feature: E_FEATURE; a_breakable_index: INTEGER)
45 -- Create a breakpoint in the feature `a_feature'
46 -- at the line `a_breakable_index'.
47 require
48 valid_location: a_feature /= Void and then
49 a_breakable_index > 0 and then
50 a_feature.body_index /= 0
51 do
52 application_status := Application_breakpoint_not_set
53 if not is_corrupted then
54 breakable_line_number := a_breakable_index
55 routine := a_feature
56 body_index := routine.body_index
57 end
58 rescue
59 is_corrupted := True
60 retry
61 end
62
63 make_copy_for_saving (a_bp_loc: like Current)
64 do
65 application_status := a_bp_loc.application_status
66 body_index := a_bp_loc.body_index
67 breakable_line_number := a_bp_loc.breakable_line_number
68 if attached a_bp_loc.routine as r then
69 routine_written_in := r.written_in
70 end
71 ensure
72 routine_ids_valid: attached routine_from_ids as l_routine implies l_routine ~ a_bp_loc.routine
73 end
74
75 feature {BREAK_LIST, BREAKPOINT} -- Copy for saving
76
77 copy_for_saving: like Current
78 -- Create Current as a copy of `bp'
79 do
80 create Result.make_copy_for_saving (Current)
81 end
82
83 restore
84 -- Restore Current when loaded from storage.
85 do
86 set_application_not_set
87 if routine = Void then
88 if attached routine_from_ids as l_routine then
89 routine := l_routine
90 else
91 is_corrupted := True
92 end
93 end
94 end
95
96 routine_from_ids: detachable E_FEATURE
97 -- Routine computed from saved ids
98 do
99 if
100 routine_written_in > 0 and then system.has_class_of_id (routine_written_in) and then
101 attached system.class_of_id (routine_written_in) as cl
102 then
103 Result := cl.feature_with_body_index (body_index)
104 end
105 end
106
107 feature -- Comparison
108
109 is_equal (other: like Current): BOOLEAN
110 -- Is `other' equal to `Current'?
111 -- `other' equals to `Current' if they represent
112 -- the same physical breakpoint, in other words they
113 -- have the same `body_index' and `offset'.
114 -- We use 'body_index' because it does not change after
115 -- a recompilation
116 do
117 Result := (other.breakable_line_number = breakable_line_number) and (other.body_index = body_index)
118 end
119
120 is_lesser_than (other: like Current): BOOLEAN
121 -- Is current object less than `other'?
122 local
123 acl,ocl: CLASS_C
124 do
125 if routine /= Void then
126 acl := routine.associated_class
127 end
128 if other.routine /= Void then
129 ocl := other.routine.associated_class
130 end
131 if acl = Void and ocl = Void then
132 Result := True
133 elseif acl = Void then
134 Result := True
135 else --| none are Void
136 if acl.name_in_upper.is_equal (ocl.name_in_upper) then
137 --| routine not Void neither
138 if routine.is_equal (other.routine) then
139 Result := breakable_line_number < other.breakable_line_number
140 else
141 Result := routine.name_32 < other.routine.name_32
142 end
143 else
144 Result := acl.name_in_upper < ocl.name_in_upper
145 end
146 end
147 end
148
149 feature -- Properties
150
151 routine: E_FEATURE
152 -- Feature where this breakpoint is situated.
153 note
154 option: transient
155 attribute
156 end
157
158 breakable_line_number: INTEGER
159 -- Line number of the breakpoint in the stoppoint view under EiffelStudio.
160
161 body_index: INTEGER
162 -- `body_index' of the feature where this breakpoint is situated
163
164 is_corrupted: BOOLEAN
165 -- False unless there was a problem at initialization (no feature).
166
167 application_status: INTEGER
168 -- Last status sent to the application, this is the current
169 -- status of this breakpoint location from the application point of view
170 --
171 -- See the private constants at the end of the class to see the
172 -- different possible values taken.
173
174 feature {NONE} -- Storage
175
176 routine_written_in: INTEGER
177 -- Class id where this breakpoint is situated
178
179 feature -- Access
180
181 is_valid: BOOLEAN
182 -- Is using `Current' safe?
183 local
184 l_feat: E_FEATURE
185 cl: CLASS_C
186 first_rout_id: INTEGER
187 do
188 if
189 not is_corrupted and
190 attached routine as r and then
191 r.is_valid
192 then
193 cl := r.associated_class
194 if cl /= Void and then r.is_debuggable then
195 first_rout_id := r.rout_id_set.first
196 if r.is_inline_agent then
197 if attached cl.eiffel_class_c.inline_agent_of_rout_id (first_rout_id) as l_feat_i then
198 l_feat := l_feat_i.api_feature (r.written_in)
199 end
200 else
201 l_feat := cl.feature_with_rout_id (first_rout_id)
202 end
203 Result := l_feat /= Void and then same_feature (routine, l_feat)
204 end
205 end
206 end
207
208 is_set_for_application: BOOLEAN
209 -- Is the breakpoint location set for the application?
210 do
211 Result := application_status = Application_breakpoint_set
212 end
213
214 feature -- Query
215
216 real_body_ids_list: LIST [INTEGER]
217 -- List of real body ids related to Current location
218 -- i.e: `routine'
219 local
220 lcurs: CURSOR
221 do
222 if
223 attached routine as l_routine and then
224 attached l_routine.associated_class as l_associated_class and then
225 attached l_routine.associated_feature_i as fi and then
226 attached l_routine.written_class as l_wc and then
227 attached l_wc.types as l_class_type_list
228 then
229 create {ARRAYED_LIST [INTEGER]} Result.make (l_class_type_list.count)
230 lcurs := l_class_type_list.cursor
231 from
232 l_class_type_list.start
233 until
234 l_class_type_list.after
235 loop
236 Result.extend (fi.real_body_id (l_class_type_list.item))
237 l_class_type_list.forth
238 end
239 if l_class_type_list.valid_cursor (lcurs) then
240 l_class_type_list.go_to (lcurs)
241 end
242 end
243 end
244
245 feature {BREAKPOINTS_MANAGER, BREAKPOINT_KEY} -- Change
246
247 set_is_corrupted (b: like is_corrupted)
248 -- Set `is_corrupted' to `b'
249 do
250 is_corrupted := b
251 end
252
253 update_routine_version
254 -- Set `routine' to the updated_version of `routine'
255 do
256 if attached routine as r then
257 routine := r.updated_version
258 end
259 is_corrupted := is_corrupted or routine = Void
260 end
261
262 feature -- Change status
263
264 set_application_set
265 -- Tell that this breakpoint has been added in the application.
266 do
267 application_status := Application_breakpoint_set
268 ensure
269 location_is_set_for_application: application_status = Application_breakpoint_set
270 end
271
272 set_application_not_set
273 -- Tell that this breakpoint has been removed in the application.
274 do
275 application_status := Application_breakpoint_not_set
276 ensure
277 location_is_not_set_for_application: application_status = Application_breakpoint_not_set
278 end
279
280 feature -- String representation
281
282 to_string: STRING_32
283 -- String representation of Current location.
284 local
285 lcl: CLASS_C
286 do
287 create Result.make_empty
288 Result.append_character ('{')
289 if routine /= Void then
290 lcl := routine.associated_class
291 end
292 if lcl /= Void then
293 Result.append_string (lcl.name_in_upper)
294 else
295 Result.append_string ("???")
296 end
297 Result.append_string ("}.")
298 if routine /= Void then
299 Result.append_string (routine.name_32)
300 else
301 Result.append_string ("???")
302 end
303 Result.append_string (" [" + breakable_line_number.out + "] ")
304 ensure
305 Result_not_void: Result /= Void
306 end
307
308 feature -- debug output
309
310 debug_output: STRING
311 -- Debug output.
312 do
313 Result := to_string
314 if is_set_for_application then
315 Result.append_string (" <set for application> ")
316 end
317 end
318
319 feature {NONE} -- Private constants
320
321 Application_breakpoint_set: INTEGER = 0
322 Application_breakpoint_not_set: INTEGER = 1
323
324 ;note
325 copyright: "Copyright (c) 1984-2014, Eiffel Software"
326 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
327 licensing_options: "http://www.eiffel.com/licensing"
328 copying: "[
329 This file is part of Eiffel Software's Eiffel Development Environment.
330
331 Eiffel Software's Eiffel Development Environment is free
332 software; you can redistribute it and/or modify it under
333 the terms of the GNU General Public License as published
334 by the Free Software Foundation, version 2 of the License
335 (available at the URL listed under "license" above).
336
337 Eiffel Software's Eiffel Development Environment is
338 distributed in the hope that it will be useful, but
339 WITHOUT ANY WARRANTY; without even the implied warranty
340 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
341 See the GNU General Public License for more details.
342
343 You should have received a copy of the GNU General Public
344 License along with Eiffel Software's Eiffel Development
345 Environment; if not, write to the Free Software Foundation,
346 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
347 ]"
348 source: "[
349 Eiffel Software
350 5949 Hollister Ave., Goleta, CA 93117 USA
351 Telephone 805-685-1006, Fax 805-685-6869
352 Website http://www.eiffel.com
353 Customer support http://support.eiffel.com
354 ]"
355
356
357 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23