Skip to content

Commit 27b61d6

Browse files
committed
fix: let step command execute for current thread
1 parent ba368b0 commit 27b61d6

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import com.sun.jdi.StackFrame;
4949
import com.sun.jdi.ThreadReference;
5050
import com.sun.jdi.Value;
51-
import com.sun.jdi.VMDisconnectedException;
5251
import com.sun.jdi.VoidValue;
5352
import com.sun.jdi.event.BreakpointEvent;
5453
import com.sun.jdi.event.Event;
@@ -113,16 +112,8 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
113112
threadState.pendingStepRequest = DebugUtility.createStepOverRequest(thread, null);
114113
}
115114

116-
if (context.getDebugSession().suspendAllThreads()) {
117-
threadState.pendingStepRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
118-
}
119-
120115
threadState.pendingMethodExitRequest = thread.virtualMachine().eventRequestManager().createMethodExitRequest();
121-
if (context.getDebugSession().suspendAllThreads()) {
122-
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
123-
} else {
124-
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
125-
}
116+
threadState.pendingMethodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
126117

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

200191
context.getThreadCache().removeEventThread(thread.uniqueID());
201-
if (context.getDebugSession().suspendAllThreads()) {
202-
try {
203-
context.getDebugSession().resume();
204-
} catch (VMDisconnectedException e) {
205-
// ignore
206-
}
207-
} else {
208-
DebugUtility.resumeThread(thread);
209-
}
192+
DebugUtility.resumeThread(thread);
210193
ThreadsRequestHandler.checkThreadRunningAndRecycleIds(thread, context);
211194
} catch (IncompatibleThreadStateException ex) {
212195
// Roll back the Exception info if stepping fails.
@@ -327,9 +310,7 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
327310
threadState.eventSubscription.dispose();
328311
}
329312
context.getThreadCache().addEventThread(thread, "step");
330-
boolean allThreadsStopped = event.request() != null
331-
&& event.request().suspendPolicy() == EventRequest.SUSPEND_ALL;
332-
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID(), allThreadsStopped));
313+
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID()));
333314
debugEvent.shouldResume = false;
334315
} else if (event instanceof MethodExitEvent) {
335316
MethodExitEvent methodExitEvent = (MethodExitEvent) event;

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JavaHotCodeReplaceProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,7 @@ private void stepIntoThread(ThreadReference thread) {
626626
.take(1).subscribe(debugEvent -> {
627627
debugEvent.shouldResume = false;
628628
// Have to send to events to keep the UI sync with the step in operations:
629-
boolean allThreadsStopped = request.suspendPolicy() == EventRequest.SUSPEND_ALL;
630-
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID(), allThreadsStopped));
629+
context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID()));
631630
context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID()));
632631
});
633632
request.enable();

0 commit comments

Comments
 (0)