javaremote-debuggingjvm-hotspotjvmtijdwp

Will breakpoints set via SetBreakpoint in JVMTI from one agent be visible to a remote debugger connected to the JVM?


Let's assume a remote debugger is connected to the local JVM. At some point if a JVMTI agent (other than the debugger one) sets a breakpoint via SetBreakpoint, will it be visible to the remote debugger? Will the remote debugger be able to step over or removee this breakpoint?

By visible I mean that the breakpoint hit event will be sent to the remote debugger, as a result the debugger would be able to behave in the same way as if he was the one that did set the breakpoint.


Solution

  • Setting breakpoints and receiving Breakpoint events requires can_generate_breakpoint_events capability. In HotSpot JVM this capability is exclusive (or solo), i.e. can_generate_breakpoint_events may be possessed by only one JVM TI environment at a time.

    In other words, the described situation can never happen: when JDWP agent is present, no other JVM TI agent may set breakpoints or subscribe to Breakpoint events.