Skip to content

Simplify attach of the coroutines debug agent in the debugger #4469

Open
@mvicsokolova

Description

@mvicsokolova

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:

  1. Checks if the given run configuration has coroutines dependency in it’s classpath
  2. Retrieves all the kotlinx-coroutines-core jars available
  3. 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? 👀

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions