Description
Problem
To debug coroutines the debugger should pass kotlinx-coroutines-core.jar
found in the project’s classpath as a -javaagent
vm parameter to the given run configuration.
The debugger does the following:
- Checks if the given run configuration has coroutines dependency in it’s classpath
- Retrieves all the
kotlinx-coroutines-core
jars available - Chooses the correct version to become the debug agent (the latest version available)
Various bugs appear in this logic from time to time (like incorrect jar version was chosen or run configuration api has changed), which cause attach of the coroutines debug agent to fail or crash the debug session: IDEA-368446, IDEA-369170, IDEA-278577
Would be great
if the correct coroutines jar was already added as a javaagent
by the time the debugger is attached to the run configuration. And by setting some flag in the debugger we would enable actual insertion of debug probes.
But It may be not ok to always add a vm parameter to the run configuration (not in the debug mode).
Could we discuss whether it’s possible and makes sense to remove this attach logic from the debugger? And how this could be implemented and whether any similar agent examples already exist? 👀