Search code examples
intellij-ideajvmremote-debuggingjvmtijdwp

How to receive breakpoint events by jvmti, from remoting debugger?


There is a jvm in a shared vm. Other developer may remote debugging by idea, and cause hang up at breakpoints.

In some reason, I need to continue the process.

I've programed an agent with jvmti, tried to receive breakpoint events for clearing them. But there are no events received.

What is the right way to receive setbreakpoint event? Or any other way to stop hangup from remote?

Thanks in advance.


Solution

  • In HotSpot JVM, can_generate_breakpoint_events is an exclusive capability - this means, only one JVM TI agent at a time may possess this capability.

    The standard jdwp agent used for remote debugging is also a JVM TI agent. When it is loaded, no other JVM TI agent may acquire can_generate_breakpoint_events capability. As a result, your agent will not be able to set/clear breakpoints or receive breakpoint events.

    What you may try to do is to modify the original libjdwp instead of trying to intercept breakpoint events in your separate agent. Or even simpler - forcibly close jdwp connections whenever you want to resume the suspended application.