@@ -145,20 +145,22 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
145145 private void handleDebugEvent (DebugEvent debugEvent , IDebugSession debugSession , IDebugAdapterContext context ,
146146 ThreadState threadState ) {
147147 Event event = debugEvent .event ;
148+ EventRequestManager eventRequestManager = debugSession .getVM ().eventRequestManager ();
148149
149150 // When a breakpoint occurs, abort any pending step requests from the same thread.
150151 if (event instanceof BreakpointEvent || event instanceof ExceptionEvent ) {
151152 long threadId = ((LocatableEvent ) event ).thread ().uniqueID ();
152153 if (threadId == threadState .threadId && threadState .pendingStepRequest != null ) {
153- threadState .deleteStepRequests (debugSession .getVM ().eventRequestManager ());
154+ threadState .deleteStepRequest (eventRequestManager );
155+ threadState .deleteMethodExitRequest (eventRequestManager );
154156 context .getStepResultManager ().removeMethodResult (threadId );
155157 if (threadState .eventSubscription != null ) {
156158 threadState .eventSubscription .dispose ();
157159 }
158160 }
159161 } else if (event instanceof StepEvent ) {
160162 ThreadReference thread = ((StepEvent ) event ).thread ();
161- threadState .deleteStepRequests ( debugSession . getVM (). eventRequestManager () );
163+ threadState .deleteStepRequest ( eventRequestManager );
162164 if (isStepFiltersConfigured (context .getStepFilters ())) {
163165 try {
164166 if (threadState .pendingStepType == Command .STEPIN ) {
@@ -181,6 +183,7 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
181183 // ignore.
182184 }
183185 }
186+ threadState .deleteMethodExitRequest (eventRequestManager );
184187 if (threadState .eventSubscription != null ) {
185188 threadState .eventSubscription .dispose ();
186189 }
@@ -280,10 +283,13 @@ class ThreadState {
280283 Location stepLocation = null ;
281284 Disposable eventSubscription = null ;
282285
283- public void deleteStepRequests (EventRequestManager manager ) {
284- DebugUtility .deleteEventRequestSafely (manager , this .pendingStepRequest );
286+ public void deleteMethodExitRequest (EventRequestManager manager ) {
285287 DebugUtility .deleteEventRequestSafely (manager , this .pendingMethodExitRequest );
286288 this .pendingMethodExitRequest = null ;
289+ }
290+
291+ public void deleteStepRequest (EventRequestManager manager ) {
292+ DebugUtility .deleteEventRequestSafely (manager , this .pendingStepRequest );
287293 this .pendingStepRequest = null ;
288294 }
289295 }
0 commit comments