Commit 455443f4 authored by Benoit Lamarche's avatar Benoit Lamarche
Browse files

Relax conditions to retrieve LV debug info

Dx used to make assumptions about variable scopes. It assumed that
parameter scopes started at pc 0 of a method, and that after a "store"
local variables scope start at the next instruction.
These assumptions may not be true when the bytecode is modified, for
instance when instrumented with Jacoco.
This CL loosens the conditions that allow to retrieve local variable
debug info according to the pc.
This fixes problems with missing local variables and parameters when
debugging and prevents an infinite loop in LocalVariableExtractor.

I also incremented the dx version to 1.13

Bug: 32432143
Bug: 25998400
Test: manual
Change-Id: I3f37febe770854e77793c9a458bf381d182722de
parent 6bd70bc7
......@@ -21,5 +21,5 @@ package com.android.dx;
*/
public class Version {
/** {@code non-null;} version string */
public static final String VERSION = "1.12";
public static final String VERSION = "1.13";
}
......@@ -351,7 +351,8 @@ public final class LocalVariableList extends FixedSizeList {
*/
public boolean matchesPcAndIndex(int pc, int index) {
return (index == this.index) &&
(pc >= startPc) &&
// do not check that "pc >= startPc" because startPc may be later than the expected
// pc, if the bytecode has been modified, by Jacoco instrumentation for instance
(pc < (startPc + length));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment