Nfff3
Nfff3

Reputation: 439

Java Breakpoints not firing after instrumenting class?

After I instrument some classes with my custom Java agent, breakpoints are not firing inside Intellij IDEA anymore. I know that when classes are instrumented, breakpoints are removed(Hotspot JVM at least)...But I tried to insert new breakpoints in the code after instrumentation is done and they won't fire either. How to overcome this issue?

UPDATE: Method breakpoints fire just fine, so I think that after instrumentation, lines are mismatching that's why breakpoints are set at wrong locations(?) and that's why they are not firing. But I tried setting line breakpoints on every single line of my class and none of them is fired.

Upvotes: 0

Views: 391

Answers (1)

k.wahome
k.wahome

Reputation: 1062

There are several reasons for breakpoints not being hit such as a wrong version of the runtime JVM or debug information being removed from the generated class.

However, more often than not, failure to hit a breakpoint means that the .java and the .class are out of sync. In other words, the compiled code is not exactly the same as the source code.

Breakpoints are set by line number thus if the source and the compiled code is out of sync and line numbers don't match, the breakpoints could point to a line number that is not a valid candidate for a breakpoint on the remote system e.g one that is not executable. In such a case the breakpoint would not be set and appears to be skipped.

You can try cleaning the project first before compiling/building

Upvotes: 1

Related Questions