diff --git a/pkg/dds/lib/src/dap/adapters/dart.dart b/pkg/dds/lib/src/dap/adapters/dart.dart index b838cb05203..908e2e598ee 100644 --- a/pkg/dds/lib/src/dap/adapters/dart.dart +++ b/pkg/dds/lib/src/dap/adapters/dart.dart @@ -832,7 +832,8 @@ abstract class DartDebugAdapter handleThreadStartup( + ThreadInfo thread, { + required bool sendStoppedOnEntry, + }) async { + // Don't resume from a PauseStart if this has already happened (see + // comments on [thread.startupHandled]). + if (thread.startupHandled) { + return; + } + + thread.startupHandled = true; + // Send a Stopped event to inform the client UI the thread is paused and + // declare that we are ready to resume (which might result in an + // immediate resume). + if (sendStoppedOnEntry) { + sendStoppedOnEntryEvent(thread); + } + await readyToResumeThread(thread.threadId); + } + /// Handles a resume event from the VM, updating our local state. void _handleResumed(vm.Event event) { final isolate = event.isolate!;