hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp
void JvmtiEnvThreadState::reset_current_location(jvmtiEvent event_type, bool enabled) {
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(event_type == JVMTI_EVENT_SINGLE_STEP || event_type == JVMTI_EVENT_BREAKPOINT,
"must be single-step or breakpoint event");
{- -------------------------------------------
(1)
---------------------------------------- -}
// Current location is used to detect the following:
// 1) a breakpoint event followed by single-stepping to the same bci
// 2) single-step to a bytecode that will be transformed to a fast version
// We skip to avoid posting the duplicate single-stepping event.
// If single-stepping is disabled, clear current location so that
// single-stepping to the same method and bcp at a later time will be
// detected if single-stepping is enabled at that time (see 4388912).
// If single-stepping is enabled, set the current location to the
// current method and bcp. This covers the following type of case,
// e.g., the debugger stepi command:
// - bytecode single stepped
// - SINGLE_STEP event posted and SINGLE_STEP event disabled
// - SINGLE_STEP event reenabled
// - bytecode rewritten to fast version
// If breakpoint event is disabled, clear current location only if
// single-stepping is not enabled. Otherwise, keep the thread location
// to detect any duplicate events.
if (enabled) {
// If enabling breakpoint, no need to reset.
// Can't do anything if empty stack.
if (event_type == JVMTI_EVENT_SINGLE_STEP && _thread->has_last_Java_frame()) {
jmethodID method_id;
int bci;
// The java thread stack may not be walkable for a running thread
// so get current location at safepoint.
VM_GetCurrentLocation op(_thread);
VMThread::execute(&op);
op.get_current_location(&method_id, &bci);
set_current_location(method_id, bci);
}
} else if (event_type == JVMTI_EVENT_SINGLE_STEP || !is_enabled(JVMTI_EVENT_SINGLE_STEP)) {
// If this is to disable breakpoint, also check if single-step is not enabled
clear_current_location();
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.