IDEA-169057 Emulated method breakpoints does not work with decompiled code

This commit is contained in:
Egor.Ushakov
2017-05-17 15:46:11 +03:00
parent 5fd2f2c0a8
commit 469aedb132
3 changed files with 10 additions and 6 deletions
@@ -590,13 +590,13 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
return new SigReader(s).getSignature();
}
@NotNull
@Nullable
public static List<Location> allLineLocations(Method method) {
try {
return method.allLineLocations();
}
catch (AbsentInformationException ignored) {
return Collections.emptyList();
return null;
}
}
@@ -201,7 +201,7 @@ public class MethodBytecodeUtil {
dos.write(bytecodes); // code
dos.writeShort(0); // exception_table_length
List<Location> locations = withLineNumbers ? DebuggerUtilsEx.allLineLocations(method) : Collections.emptyList();
if (!locations.isEmpty()) {
if (!ContainerUtil.isEmpty(locations)) {
dos.writeShort(1); // attributes_count
dos.writeShort(cw.newUTF8("LineNumberTable"));
dos.writeInt(2 * locations.size() + 2);
@@ -200,17 +200,21 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
boolean found = false;
for (Method method : methods) {
found = true;
if (base && method.isNative()) {
if (method.isNative()) {
breakpoint.disableEmulation();
return;
}
Method target = MethodBytecodeUtil.getBridgeTargetMethod(method, debugProcess.getVirtualMachineProxy());
if (target != null && !DebuggerUtilsEx.allLineLocations(target).isEmpty()) {
if (target != null && !ContainerUtil.isEmpty(DebuggerUtilsEx.allLineLocations(target))) {
method = target;
}
List<Location> allLineLocations = DebuggerUtilsEx.allLineLocations(method);
if (!allLineLocations.isEmpty()) {
if (allLineLocations == null) { // no line numbers
breakpoint.disableEmulation();
return;
}
if (!ContainerUtil.isEmpty(allLineLocations)) {
if (breakpoint.isWatchEntry()) {
createLocationBreakpointRequest(breakpoint, ContainerUtil.getFirstItem(allLineLocations), debugProcess);
}