Introducing useful event when a debug session has been cleared, so that all subscribers can unsubscribe from any cleared session automatically #14670
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a debug session is cleared, its process becomes
nil
so we can't get information from this process anymore.Also, it means any subscribed debugger shouldn't be able to perform any action on the debug session anymore. That's why, a debugger that has a cleared debug session should unsubscribe from the debug session and from the SystemAnnouncer (it is subscribed to the SystemAnnouncer to get notified when a method has been compiled/recompiled).
For now, we don't have a mechanism that does that automatically. All debuggers should call their method
#clear
, which is annoying, especially in tests. Because if someone instanciates a debugger in a test but doesn't know that they should ensure the method#clear
is called, then some errors (like this one: pharo-spec/NewTools#579) might happen because the debugger executes code due to subscriptions that should have been cancelled, causing some messages to be sent to anil
process.This PR introduces an event triggered when a session is cleared so that all subscribers can unsubscribe from whatever they should unsubscribe from