mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 09:29:38 +00:00
Breakpoints in already-loaded classes don't work #21
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fancypantalons on 11/30/2023
I'm not sure if this is new behaviour in ADB, but it appears that the
classprepareevent doesn't get triggered if the JVM has already loaded a class.The trouble is that the plugin relies on those events to learn about classes when setting breakpoints. So if you set a breakpoint before you start the debugger, then the event is registered before the class is loaded and everything works fine.
But if you set a breakpoint after the application has started in an already-loaded class, the plugin is never notified that the class exists and so the breakpoint can never be enabled.
I've thrown together a PR that changes this behaviour so that the plugin calls getAllClasses (which doesn't actually appear to be that slow?) if a class isn't known, and only after that fails does it then register for a
classprepareevent so that the JVM will notify the plugin when the class finally loads.It all seems to work, both for BPs set before the debugger is started and after its already loaded. Feel free to take a look. To be honest it feels a little hacky, and I'm sure there's a more elegant approach possible, but I'm low on sleep and pretty far outta my depth!