Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: let step command execute for current thread
  • Loading branch information
chagong committed Jan 27, 2026
commit 27b61d6b8b5e106c2dd49ccd1e215fc28e1d1af8
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import com.sun.jdi.StackFrame;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.Value;
import com.sun.jdi.VMDisconnectedException;
import com.sun.jdi.VoidValue;
import com.sun.jdi.event.BreakpointEvent;
import com.sun.jdi.event.Event;
Expand Down Expand Up @@ -113,16 +112,8 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
threadState.pendingStepRequest = DebugUtility.createStepOverRequest(thread, null);
}

if (context.getDebugSession().suspendAllThreads()) {
threadState.pendingStepRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
}

threadState.pendingMethodExitRequest = thread.virtualMachine().eventRequestManager().createMethodExitRequest();
if (context.getDebugSession().suspendAllThreads()) {
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
} else {
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
}
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

threadState.targetStepIn = targetId > 0
? (MethodInvocation) context.getRecyclableIdPool().getObjectById(targetId) : null;
Expand Down Expand Up @@ -198,15 +189,7 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
}

context.getThreadCache().removeEventThread(thread.uniqueID());
if (context.getDebugSession().suspendAllThreads()) {
try {
context.getDebugSession().resume();
} catch (VMDisconnectedException e) {
// ignore
}
} else {
DebugUtility.resumeThread(thread);
}
DebugUtility.resumeThread(thread);
ThreadsRequestHandler.checkThreadRunningAndRecycleIds(thread, context);
} catch (IncompatibleThreadStateException ex) {
// Roll back the Exception info if stepping fails.
Expand Down Expand Up @@ -327,9 +310,7 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
threadState.eventSubscription.dispose();
}
context.getThreadCache().addEventThread(thread, "step");
boolean allThreadsStopped = event.request() != null
&& event.request().suspendPolicy() == EventRequest.SUSPEND_ALL;
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID(), allThreadsStopped));
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID()));
debugEvent.shouldResume = false;
} else if (event instanceof MethodExitEvent) {
MethodExitEvent methodExitEvent = (MethodExitEvent) event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ private void stepIntoThread(ThreadReference thread) {
.take(1).subscribe(debugEvent -> {
debugEvent.shouldResume = false;
// Have to send to events to keep the UI sync with the step in operations:
boolean allThreadsStopped = request.suspendPolicy() == EventRequest.SUSPEND_ALL;
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID(), allThreadsStopped));
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID()));
context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID()));
});
request.enable();
Expand Down
Loading