DebugInfoItempublic class DebugInfoItem extends OffsettedItem
Fields Summary |
---|
private static final int | ALIGNMENTthe required alignment for instances of this class | private static final boolean | ENABLE_ENCODER_SELF_CHECK | private final com.android.dx.dex.code.DalvCode | code{@code non-null;} the code this item represents | private byte[] | encoded | private final boolean | isStatic | private final com.android.dx.rop.cst.CstMethodRef | ref |
Methods Summary |
---|
public void | addContents(DexFile file){@inheritDoc}
// No contents to add.
| public void | annotateTo(DexFile file, com.android.dx.util.AnnotatedOutput out, java.lang.String prefix)Writes annotations for the elements of this list, as
zero-length. This is meant to be used for dumping this instance
directly after a code dump (with the real local list actually
existing elsewhere in the output).
encode(file, prefix, null, out, false);
| public void | debugPrint(java.io.PrintWriter out, java.lang.String prefix)Does a human-friendly dump of this instance.
encode(null, prefix, out, null, false);
| private byte[] | encode(DexFile file, java.lang.String prefix, java.io.PrintWriter debugPrint, com.android.dx.util.AnnotatedOutput out, boolean consume)Performs debug info encoding.
byte[] result = encode0(file, prefix, debugPrint, out, consume);
if (ENABLE_ENCODER_SELF_CHECK && (file != null)) {
try {
DebugInfoDecoder.validateEncode(result, file, ref, code,
isStatic);
} catch (RuntimeException ex) {
// Reconvert, annotating to System.err.
encode0(file, "", new PrintWriter(System.err, true), null,
false);
throw ex;
}
}
return result;
| private byte[] | encode0(DexFile file, java.lang.String prefix, java.io.PrintWriter debugPrint, com.android.dx.util.AnnotatedOutput out, boolean consume)Helper for {@link #encode} to do most of the work.
PositionList positions = code.getPositions();
LocalList locals = code.getLocals();
DalvInsnList insns = code.getInsns();
int codeSize = insns.codeSize();
int regSize = insns.getRegistersSize();
DebugInfoEncoder encoder =
new DebugInfoEncoder(positions, locals,
file, codeSize, regSize, isStatic, ref);
byte[] result;
if ((debugPrint == null) && (out == null)) {
result = encoder.convert();
} else {
result = encoder.convertAndAnnotate(prefix, debugPrint, out,
consume);
}
return result;
| public ItemType | itemType(){@inheritDoc}
return ItemType.TYPE_DEBUG_INFO_ITEM;
| protected void | place0(Section addedTo, int offset){@inheritDoc}
// Encode the data and note the size.
try {
encoded = encode(addedTo.getFile(), null, null, null, false);
setWriteSize(encoded.length);
} catch (RuntimeException ex) {
throw ExceptionWithContext.withContext(ex,
"...while placing debug info for " + ref.toHuman());
}
| public java.lang.String | toHuman(){@inheritDoc}
throw new RuntimeException("unsupported");
| protected void | writeTo0(DexFile file, com.android.dx.util.AnnotatedOutput out){@inheritDoc}
if (out.annotates()) {
/*
* Re-run the encoder to generate the annotations,
* but write the bits from the original encode
*/
out.annotate(offsetString() + " debug info");
encode(file, null, null, out, true);
}
out.write(encoded);
|
|