IDEA-140321 Wrong current line highlighting when debugging synchronized block in decompiled code

This commit is contained in:
Egor.Ushakov
2015-05-18 18:40:38 +03:00
parent 44ba5816f2
commit 022d552b30
4 changed files with 30 additions and 14 deletions

View File

@@ -15,6 +15,8 @@
*/
package org.jetbrains.java.decompiler.modules.decompiler.stats;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.code.cfg.BasicBlock;
import org.jetbrains.java.decompiler.main.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
@@ -84,11 +86,20 @@ public class SynchronizedStatement extends Statement {
buf.append(ExprProcessor.jmpWrapper(body, indent + 1, true, tracer));
buf.appendIndent(indent).append("}").appendLineSeparator();
mapMonitorExitInstr(tracer);
tracer.incrementCurrentSourceLine();
return buf;
}
private void mapMonitorExitInstr(BytecodeMappingTracer tracer) {
BasicBlock block = body.getBasichead().getBlock();
if (!block.getSeq().isEmpty() && block.getLastInstruction().opcode == CodeConstants.opc_monitorexit) {
Integer offset = block.getOldOffset(block.size() - 1);
if (offset > -1) tracer.addMapping(offset);
}
}
public void initExprents() {
headexprent.set(0, first.getExprents().remove(first.getExprents().size() - 1));
}