Search code examples
javajvmbytecode

When I push a breakpoint in the java execution code, what does it really do?


When I push a breakpoint in the java execution code, what does it really do?

Is it a flag at the JVM level? At the processor level?

Can we see the difference in bytecode instructions ? Or is it a loop in the JVM?


Solution

  • I didn't find specific reference on setting breakpoints in Java but in native code, debugger would place a single byte interrupt instruction (INT 3) over original instruction. Once reached, interrupt kicks in and gives control to debugger. This article has some more information.

    From JVM Tools documentation I would infer that similar approach is used in Java bytecode.