use of com.sun.jdi.request.StepRequest in project intellij-community by JetBrains.
the class DebugProcessImpl method doStep.
/**
*
* @param suspendContext
* @param stepThread
* @param size the step size. One of {@link StepRequest#STEP_LINE} or {@link StepRequest#STEP_MIN}
* @param depth
* @param hint may be null
*/
protected void doStep(final SuspendContextImpl suspendContext, final ThreadReferenceProxyImpl stepThread, int size, int depth, RequestHint hint) {
if (stepThread == null) {
return;
}
try {
final ThreadReference stepThreadReference = stepThread.getThreadReference();
if (LOG.isDebugEnabled()) {
LOG.debug("DO_STEP: creating step request for " + stepThreadReference);
}
deleteStepRequests(stepThreadReference);
EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
StepRequest stepRequest = requestManager.createStepRequest(stepThreadReference, size, depth);
if (!(hint != null && hint.isIgnoreFilters())) /*&& depth == StepRequest.STEP_INTO*/
{
checkPositionNotFiltered(stepThread, filters -> filters.forEach(f -> stepRequest.addClassExclusionFilter(f.getPattern())));
}
// suspend policy to match the suspend policy of the context:
// if all threads were suspended, then during stepping all the threads must be suspended
// if only event thread were suspended, then only this particular thread must be suspended during stepping
stepRequest.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? EventRequest.SUSPEND_EVENT_THREAD : EventRequest.SUSPEND_ALL);
if (hint != null) {
//noinspection HardCodedStringLiteral
stepRequest.putProperty("hint", hint);
}
stepRequest.enable();
} catch (ObjectCollectedException ignored) {
}
}
use of com.sun.jdi.request.StepRequest in project intellij-community by JetBrains.
the class DebugProcessImpl method deleteStepRequests.
void deleteStepRequests(@Nullable final ThreadReference stepThread) {
EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
List<StepRequest> stepRequests = requestManager.stepRequests();
if (!stepRequests.isEmpty()) {
final List<StepRequest> toDelete = new ArrayList<>(stepRequests.size());
for (final StepRequest request : stepRequests) {
ThreadReference threadReference = request.thread();
// [jeka] on attempt to delete a request assigned to a thread with unknown status, a JDWP error occurs
try {
if (threadReference.status() != ThreadReference.THREAD_STATUS_UNKNOWN && (stepThread == null || stepThread.equals(threadReference))) {
toDelete.add(request);
}
} catch (IllegalThreadStateException e) {
// undocumented by JDI: may be thrown when querying thread status
LOG.info(e);
} catch (ObjectCollectedException ignored) {
}
}
requestManager.deleteEventRequests(toDelete);
}
}
use of com.sun.jdi.request.StepRequest in project che by eclipse.
the class JavaDebugger method doStep.
private void doStep(int depth) throws DebuggerException {
lock.lock();
try {
clearSteps();
StepRequest request = getEventManager().createStepRequest(getCurrentThread(), StepRequest.STEP_LINE, depth);
request.addCountFilter(1);
request.enable();
resume(newDto(ResumeActionDto.class));
} finally {
lock.unlock();
}
}
use of com.sun.jdi.request.StepRequest in project kotlin by JetBrains.
the class DebuggerSteppingHelper method createStepRequest.
// copied from DebugProcessImpl.doStep
private static void createStepRequest(@NotNull SuspendContextImpl suspendContext, @Nullable ThreadReferenceProxyImpl stepThread, @NotNull EventRequestManager requestManager, int size, int depth) {
if (stepThread == null) {
return;
}
try {
ThreadReference stepThreadReference = stepThread.getThreadReference();
requestManager.deleteEventRequests(requestManager.stepRequests());
StepRequest stepRequest = requestManager.createStepRequest(stepThreadReference, size, depth);
List<ClassFilter> activeFilters = getActiveFilters();
if (!activeFilters.isEmpty()) {
String currentClassName = getCurrentClassName(stepThread);
if (currentClassName == null || !DebuggerUtilsEx.isFiltered(currentClassName, activeFilters)) {
// add class filters
for (ClassFilter filter : activeFilters) {
stepRequest.addClassExclusionFilter(filter.getPattern());
}
}
}
// suspend policy to match the suspend policy of the context:
// if all threads were suspended, then during stepping all the threads must be suspended
// if only event thread were suspended, then only this particular thread must be suspended during stepping
stepRequest.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? EventRequest.SUSPEND_EVENT_THREAD : EventRequest.SUSPEND_ALL);
stepRequest.enable();
} catch (ObjectCollectedException ignored) {
}
}
Aggregations