202 }; |
202 }; |
203 |
203 |
204 |
204 |
205 /////////////////////////////////////////////////////////////// |
205 /////////////////////////////////////////////////////////////// |
206 // |
206 // |
207 // class VM_ChangeBreakpoints |
|
208 // Used by : JvmtiBreakpoints |
|
209 // Used by JVMTI methods: none directly. |
|
210 // Note: A Helper class. |
|
211 // |
|
212 // VM_ChangeBreakpoints implements a VM_Operation for ALL modifications to the JvmtiBreakpoints class. |
|
213 // |
|
214 |
|
215 class VM_ChangeBreakpoints : public VM_Operation { |
|
216 private: |
|
217 JvmtiBreakpoints* _breakpoints; |
|
218 int _operation; |
|
219 JvmtiBreakpoint* _bp; |
|
220 |
|
221 public: |
|
222 enum { SET_BREAKPOINT=0, CLEAR_BREAKPOINT=1, CLEAR_ALL_BREAKPOINT=2 }; |
|
223 |
|
224 VM_ChangeBreakpoints(JvmtiBreakpoints* breakpoints, int operation) { |
|
225 _breakpoints = breakpoints; |
|
226 _bp = NULL; |
|
227 _operation = operation; |
|
228 assert(breakpoints != NULL, "breakpoints != NULL"); |
|
229 assert(operation == CLEAR_ALL_BREAKPOINT, "unknown breakpoint operation"); |
|
230 } |
|
231 VM_ChangeBreakpoints(JvmtiBreakpoints* breakpoints, int operation, JvmtiBreakpoint *bp) { |
|
232 _breakpoints = breakpoints; |
|
233 _bp = bp; |
|
234 _operation = operation; |
|
235 assert(breakpoints != NULL, "breakpoints != NULL"); |
|
236 assert(bp != NULL, "bp != NULL"); |
|
237 assert(operation == SET_BREAKPOINT || operation == CLEAR_BREAKPOINT , "unknown breakpoint operation"); |
|
238 } |
|
239 |
|
240 VMOp_Type type() const { return VMOp_ChangeBreakpoints; } |
|
241 void doit(); |
|
242 void oops_do(OopClosure* f); |
|
243 }; |
|
244 |
|
245 |
|
246 /////////////////////////////////////////////////////////////// |
|
247 // |
|
248 // class JvmtiBreakpoints |
207 // class JvmtiBreakpoints |
249 // Used by : JvmtiCurrentBreakpoints |
208 // Used by : JvmtiCurrentBreakpoints |
250 // Used by JVMTI methods: none directly |
209 // Used by JVMTI methods: none directly |
251 // Note: A Helper class |
210 // Note: A Helper class |
252 // |
211 // |
269 // to insure they only occur at safepoints. |
228 // to insure they only occur at safepoints. |
270 // Todo: add checks for safepoint |
229 // Todo: add checks for safepoint |
271 friend class VM_ChangeBreakpoints; |
230 friend class VM_ChangeBreakpoints; |
272 void set_at_safepoint(JvmtiBreakpoint& bp); |
231 void set_at_safepoint(JvmtiBreakpoint& bp); |
273 void clear_at_safepoint(JvmtiBreakpoint& bp); |
232 void clear_at_safepoint(JvmtiBreakpoint& bp); |
274 void clearall_at_safepoint(); |
|
275 |
233 |
276 static void do_element(GrowableElement *e); |
234 static void do_element(GrowableElement *e); |
277 |
235 |
278 public: |
236 public: |
279 JvmtiBreakpoints(void listener_fun(void *, address *)); |
237 JvmtiBreakpoints(void listener_fun(void *, address *)); |
341 for ( ; (*bps) != NULL; bps++) { |
298 for ( ; (*bps) != NULL; bps++) { |
342 if ((*bps) == bcp) return true; |
299 if ((*bps) == bcp) return true; |
343 } |
300 } |
344 return false; |
301 return false; |
345 } |
302 } |
|
303 |
|
304 |
|
305 /////////////////////////////////////////////////////////////// |
|
306 // |
|
307 // class VM_ChangeBreakpoints |
|
308 // Used by : JvmtiBreakpoints |
|
309 // Used by JVMTI methods: none directly. |
|
310 // Note: A Helper class. |
|
311 // |
|
312 // VM_ChangeBreakpoints implements a VM_Operation for ALL modifications to the JvmtiBreakpoints class. |
|
313 // |
|
314 |
|
315 class VM_ChangeBreakpoints : public VM_Operation { |
|
316 private: |
|
317 JvmtiBreakpoints* _breakpoints; |
|
318 int _operation; |
|
319 JvmtiBreakpoint* _bp; |
|
320 |
|
321 public: |
|
322 enum { SET_BREAKPOINT=0, CLEAR_BREAKPOINT=1 }; |
|
323 |
|
324 VM_ChangeBreakpoints(int operation, JvmtiBreakpoint *bp) { |
|
325 JvmtiBreakpoints& current_bps = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); |
|
326 _breakpoints = ¤t_bps; |
|
327 _bp = bp; |
|
328 _operation = operation; |
|
329 assert(bp != NULL, "bp != NULL"); |
|
330 } |
|
331 |
|
332 VMOp_Type type() const { return VMOp_ChangeBreakpoints; } |
|
333 void doit(); |
|
334 void oops_do(OopClosure* f); |
|
335 }; |
|
336 |
346 |
337 |
347 /////////////////////////////////////////////////////////////// |
338 /////////////////////////////////////////////////////////////// |
348 // The get/set local operations must only be done by the VM thread |
339 // The get/set local operations must only be done by the VM thread |
349 // because the interpreter version needs to access oop maps, which can |
340 // because the interpreter version needs to access oop maps, which can |
350 // only safely be done by the VM thread |
341 // only safely be done by the VM thread |