diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java index e12e9c82c..219674f0f 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java @@ -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; @@ -117,6 +118,12 @@ public class DSPDebugTarget extends DSPDebugElement implements IDebugTarget, IDe */ private final CompletableFuture initialized = new CompletableFuture<>(); + /** + * The debuggees that this target has spawned, for example when handling + * the {@link #startDebugging(StartDebuggingRequestArguments)} notification + */ + private final Set 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 @@ -318,6 +325,7 @@ private void terminated() { } } fireTerminateEvent(); + debuggees.forEach(DSPDebugTarget::terminated); if (breakpointManager != null) { breakpointManager.shutdown(); } @@ -348,6 +356,7 @@ public CompletableFuture 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); }