-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Description
I had a bug raised against Dart where the debugger shows threads as "paused on entry" when they should not be. The DAP traffic looks good:
// Start
[5:17:21 PM] [DAP] [Info] <== {"seq":21,"type":"event","body":{"reason":"started","threadId":3},"event":"thread"}
// Pause
[5:17:21 PM] [DAP] [Info] <== {"seq":43,"type":"event","body":{"allThreadsStopped":false,"reason":"entry","threadId":3},"event":"stopped"}
// Resume
[5:17:21 PM] [DAP] [Info] <== {"seq":78,"type":"event","body":{"allThreadsContinued":false,"threadId":3},"event":"continued"}
Yet the UI shows the thread as paused. I was able to reproduce this in MockDebug. It seems to only occur when the events occur close together (if I add delays, it doesn't seem to happen):
// Start additional threads, pause on entry, continue.
for (var i = 2; i < 5; i++) {
this._threads.push(new Thread(i, `Thread ${i}`));
this.sendEvent(new ThreadEvent('started', i));
this.sendEvent(new OutputEvent(`Thread ${i} started\n`));
this.sendEvent(new StoppedEvent('entry', i));
this.sendEvent(new OutputEvent(`Thread ${i} stopped on entry\n`));
// await this.delay(1); // Uncomment this to fix it
this.sendEvent(new ContinuedEvent(i, false));
this.sendEvent(new OutputEvent(`Thread ${i} continued\n`));
}Full repro is here:
https://github.com/DanTup/vscode-mock-debug/tree/repro-dart-code-5397 / DanTup/vscode-mock-debug@04f4764
This felt a bit like microsoft/debug-adapter-protocol#513 to me, but that actually turned out to be caused by allThreadsStopped defaulting to true. I don't believe that's the case here because in the real project where this happens (Dart debugger), we set both allThreadsStopped and allThreadsContinued to false (though I haven't set allThreadsContinued in the MockDebug example because it doesn't seem to be available in the constructor... I don't believe that's the issue though as allThreadsContinued seems to default to false and the delay shouldn't fix the issue in that case).
