diff options
author | mikaelpeltier <mikaelpeltier@google.com> | 2014-06-16 13:48:20 +0200 |
---|---|---|
committer | mikaelpeltier <mikaelpeltier@google.com> | 2014-06-16 16:31:49 +0200 |
commit | 60eda82ffd6b128920e54e2ffaa25a608e5f29b0 (patch) | |
tree | 16bfcf071778008fdc902dab27d87246b264d330 /dx | |
parent | 9bc381f6f59e8b443ceb224bb150cae707e859a9 (diff) | |
download | toolchain_jack-60eda82ffd6b128920e54e2ffaa25a608e5f29b0.zip toolchain_jack-60eda82ffd6b128920e54e2ffaa25a608e5f29b0.tar.gz toolchain_jack-60eda82ffd6b128920e54e2ffaa25a608e5f29b0.tar.bz2 |
Modify how debug information will be imported
- Size of debug information is not longer provided but it will be
compute automatically
Change-Id: Ie46021bcc307eca0c5104f869926ee96bcf3b492
Diffstat (limited to 'dx')
-rw-r--r-- | dx/src/com/android/jack/dx/dex/file/ClassDefItem.java | 2 | ||||
-rw-r--r-- | dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java | 32 |
2 files changed, 24 insertions, 10 deletions
diff --git a/dx/src/com/android/jack/dx/dex/file/ClassDefItem.java b/dx/src/com/android/jack/dx/dex/file/ClassDefItem.java index e845fab..a75a2fd 100644 --- a/dx/src/com/android/jack/dx/dex/file/ClassDefItem.java +++ b/dx/src/com/android/jack/dx/dex/file/ClassDefItem.java @@ -96,7 +96,7 @@ public final class ClassDefItem extends IndexedItem { * least for easily-checked stuff? */ -if (interfaces == null) { + if (interfaces == null) { throw new NullPointerException("interfaces == null"); } diff --git a/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java b/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java index d787c85..8fab30e 100644 --- a/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java +++ b/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java @@ -27,13 +27,19 @@ import static com.android.jack.dx.dex.file.DebugInfoConstants.DBG_SET_PROLOGUE_E import static com.android.jack.dx.dex.file.DebugInfoConstants.DBG_START_LOCAL; import static com.android.jack.dx.dex.file.DebugInfoConstants.DBG_START_LOCAL_EXTENDED; +import com.android.jack.dx.io.ClassDef; import com.android.jack.dx.io.DexBuffer; import com.android.jack.dx.rop.cst.Constant; import com.android.jack.dx.rop.cst.CstIndexMap; import com.android.jack.dx.util.AnnotatedOutput; +import com.android.jack.dx.util.ByteArrayAnnotatedOutput; import java.io.PrintWriter; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; + /** * TODO(jack team) */ @@ -42,20 +48,24 @@ public class ImportedDebugInfoItem extends OffsettedItem { /** the required alignment for instances of this class */ private static final int ALIGNMENT = 1; + @Nonnull private final DexBuffer dexBuffer; + @Nonnegative private final int debugInfoOffset; - private final int debugInfoSize; + @CheckForNull + private byte[] encodedDebugInfo; /** * {@code non-null;} map index values used into debug information that references {@link Constant} * from one dex file into index values compliant with another dex file. */ + @Nonnull private CstIndexMap cstIndexMap; - public ImportedDebugInfoItem(DexBuffer dexBuffer, int debugInfoOffset, int debugInfoSize, - CstIndexMap cstIndexMap) { + public ImportedDebugInfoItem(@Nonnull DexBuffer dexBuffer, @Nonnegative int debugInfoOffset, + @Nonnull CstIndexMap cstIndexMap) { // We don't know the write size yet. super(ALIGNMENT, -1); @@ -65,8 +75,6 @@ public class ImportedDebugInfoItem extends OffsettedItem { this.debugInfoOffset = debugInfoOffset; - this.debugInfoSize = debugInfoSize; - this.cstIndexMap = cstIndexMap; } @@ -79,14 +87,16 @@ public class ImportedDebugInfoItem extends OffsettedItem { /** {@inheritDoc} */ @Override public void addContents(DexFile file) { - // Nothing to do + ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); + encodeAndRemapDebugInfoItem(file, out); + encodedDebugInfo = out.toByteArray(); } /** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { - setWriteSize(debugInfoSize); + setWriteSize(encodedDebugInfo.length); } /** {@inheritDoc} */ @@ -119,7 +129,7 @@ public class ImportedDebugInfoItem extends OffsettedItem { /** {@inheritDoc} */ @Override protected void writeTo0(DexFile file, AnnotatedOutput out) { - encodeAndRemapDebugInfoItem(file, out); + out.write(encodedDebugInfo); } private void encodeAndRemapDebugInfoItem(DexFile file, AnnotatedOutput out) { @@ -133,7 +143,11 @@ public class ImportedDebugInfoItem extends OffsettedItem { for (int p = 0; p < parametersSize; p++) { int parameterName = in.readUleb128p1(); - out.writeUleb128(cstIndexMap.getRemappedCstStringIndex(file, parameterName) + 1); + if (parameterName != ClassDef.NO_INDEX) { + out.writeUleb128(cstIndexMap.getRemappedCstStringIndex(file, parameterName) + 1); + } else { + out.writeUleb128(0); + } } int addrDiff; // uleb128 address delta. |