Skip to content

Commit

Permalink
Terminate debuggees
Browse files Browse the repository at this point in the history
When dealing with startDebugging request, also terminate debuggees when
parent is terminated
  • Loading branch information
mickaelistria committed Oct 4, 2023
1 parent d860ec7 commit 835b6be
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -117,6 +118,12 @@ public class DSPDebugTarget extends DSPDebugElement implements IDebugTarget, IDe
*/
private final CompletableFuture<Void> initialized = new CompletableFuture<>();

/**
* The debuggees that this target has spawned, for example when handling
* the {@link #startDebugging(StartDebuggingRequestArguments)} notification
*/
private final Set<DSPDebugTarget> debuggees = new HashSet<>();

/**
* The cached set of current threads. This should generally not be directly
* accessed and instead accessed via {@link #getThreads()} which will ensure
Expand Down Expand Up @@ -318,6 +325,7 @@ private void terminated() {
}
}
fireTerminateEvent();
debuggees.forEach(DSPDebugTarget::terminated);
if (breakpointManager != null) {
breakpointManager.shutdown();
}
Expand Down Expand Up @@ -348,6 +356,7 @@ public CompletableFuture<Void> startDebugging(StartDebuggingRequestArguments arg
DSPDebugTarget newTarget = new DSPDebugTarget(launch, streamsSupplier, parameters);
launch.addDebugTarget(newTarget);
newTarget.initialize(new NullProgressMonitor());
debuggees.add(newTarget);
} catch (CoreException e) {
DSPPlugin.logError(e);
}
Expand Down

0 comments on commit 835b6be

Please sign in to comment.