Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* debugger - enhancement: proper thread status and suspend any thread #628

Merged
merged 1 commit into from Apr 7, 2022

Conversation

dkimitsa
Copy link
Contributor

background

debugger was able to suspend thread only when code was reaching software breakpoint -- hook callback. so hitting "pause" in debugger in general wasn't doing anything if there was no hook instrumented java code running (e.g. threads are waiting on lock/sleep or running native message loop).
Also debugger wasn't picking JDWP thread statuses like sleeping/monitor etc.
debugger-wrong-thread-state

thread status

thread status was not propagated from VM (hooks) to JDWP and was solved by extending the protocol.
debugger-proper-states

changes to suspend threads

interrupt any random thread is possible by sending a signal to it. There is already two signals dedicated to RoboVM and introducing another one would be wastefully.
Lucky for us one signal was used to capture thread stack trace. Last ones also good to have when you suspend the thread. So it was extended to provide a callback to hooks infrastructure and if thread was pending for suspend -- suspend loop was running there. Debugger code was updated to support these changes in debugger-hooks protocol.

debugger-sleeping-with-stack-trace

# background: debugger was able to suspend thread only when code was reaching software breakpoint -- hook callback. so hitting "pause" in debugger in general wasn't doing anything if there was no hook instrumented java code running (e.g. threads are waiting on lock/sleep or running native message loop).
Also debugger wasn't picking JDWP thread statuses like sleeping/monitor etc.

# changes to suspend threads
interrupt any random thread is possible by sending a signal to it. There is already two signals dedicated to RoboVM and introducing another one would be wastefully.
Lucky for us one signal was used to capture thread stack trace. Last ones also good to have when you suspend the thread. So it was extended to provide a callback to hooks infrastructure and if thread was pending for suspend -- suspend loop was running there.
Debugger code was updated to support these changes in debugger-hooks protocol.
@Tom-Ski Tom-Ski added this to the 2.3.17 milestone Apr 4, 2022
@Tom-Ski Tom-Ski merged commit 7ad29fd into MobiVM:master Apr 7, 2022
@dkimitsa dkimitsa deleted the debugger/suspend_threads branch April 16, 2022 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants