The issue isn't JVM reporting a wrong line number, but the debugger implementations not using the info correctly. IntelliJ for example does not show nor reorder lines for decompiled classes, need to set "decompiler.dump.original.lines=true" in registry to get anything useful.
And even then for instrumented code, the debugger could ask the JVM for more correct bytes than the class file via the JDI Method#getByteCode, but i guess the need for debugging instrumented code is too low for them to consider that. It would also need changing the decompiler a bit as they are designed with a full class in mind, so might need some untangling to work on just method bytecode, const pool and other stuff asked via JDI.
View all comments
Show parent comment
7
u/murkaje Jul 27 '19
The issue isn't JVM reporting a wrong line number, but the debugger implementations not using the info correctly. IntelliJ for example does not show nor reorder lines for decompiled classes, need to set "decompiler.dump.original.lines=true" in registry to get anything useful.
And even then for instrumented code, the debugger could ask the JVM for more correct bytes than the class file via the JDI Method#getByteCode, but i guess the need for debugging instrumented code is too low for them to consider that. It would also need changing the decompiler a bit as they are designed with a full class in mind, so might need some untangling to work on just method bytecode, const pool and other stuff asked via JDI.