Skip to content

Commit

Permalink
Merge pull request #43821 from NipunaRanasinghe/master
Browse files Browse the repository at this point in the history
Clear debug hits before restarting the debug session
  • Loading branch information
NipunaRanasinghe authored Feb 14, 2025
2 parents 5f26a7b + 72760ae commit 6e5fece
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import org.eclipse.lsp4j.debug.ConfigurationDoneArguments;
import org.eclipse.lsp4j.debug.ContinueArguments;
import org.eclipse.lsp4j.debug.ContinueResponse;
import org.eclipse.lsp4j.debug.ContinuedEventArguments;
import org.eclipse.lsp4j.debug.DisconnectArguments;
import org.eclipse.lsp4j.debug.EvaluateArguments;
import org.eclipse.lsp4j.debug.EvaluateResponse;
Expand Down Expand Up @@ -1220,11 +1221,22 @@ private void clearSuspendedState() {
* Clears all state information.
*/
private void resetServer() {
clearDebugHits();
Optional.ofNullable(eventProcessor).ifPresent(JDIEventProcessor::reset);
Optional.ofNullable(outputLogger).ifPresent(DebugOutputLogger::reset);
Optional.ofNullable(executionManager).ifPresent(DebugExecutionManager::reset);
terminateDebuggee();
clearSuspendedState();
context.reset();
}

/**
* Clears any debug hits in the client side before restarting the debug session.
*/
private void clearDebugHits() {
// Notifies the debug client that the execution is resumed.
ContinuedEventArguments continuedEventArguments = new ContinuedEventArguments();
continuedEventArguments.setAllThreadsContinued(true);
context.getClient().continued(continuedEventArguments);
}
}

0 comments on commit 6e5fece

Please sign in to comment.