this excluded. A value of '0' indicates "no name"
DebugInfoConstants.
OP_END_SEQUENCE
| Modifier and Type | Field and Description |
|---|---|
| private int | address
current encoding state: bytecode address |
| private AnnotatedOutput | annotateTo
if non-null: the output to write annotations to. |
| private final int | |
| private static final boolean | |
| private PrintWriter | debugPrint
if non-null: another possible output for annotations |
| private final Prototype | |
| private final DexFile | |
| private final boolean | |
| private final LocalList. | lastEntryForReg
indexed by register; last local alive in register |
| private int | line
current encoding state: line number |
| private final LocalList | locals
|
| private final ByteArrayAnnotatedOutput | |
| private final PositionList | positions
|
| private String | prefix
if non-null: the prefix for each annotation or debugPrint line |
| private final int | |
| private boolean | shouldConsume
true if output should be consumed during annotation |
| Access | Constructor and Description |
|---|---|
| public | DebugInfoEncoder(PositionList
null-ok; positions (line numbers) to encodenull-ok; local variables to encodenull-ok; may only be null if simply using
this class to do a debug printCreates an instance. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private ArrayList | Returns: A sorted positions listBuilds a list of position entries, sorted by ascending address. |
| private static int | Returns: <= 0xff if in range, otherwise parameters are out
of range>= DBG_LINE_BASE, <= DBG_LINE_BASE +
DBG_LINE_RANGE; the line change to encode>= 0; the address change to encodeComputes a special opcode that will encode the given position change. |
| public byte[] | Returns: non-null; encoded byte sequence without padding and
terminated with a 0x00 byteConverts this (PositionList, LocalList) pair into a state machine sequence. |
| private byte[] | |
| public byte[] | Returns: non-null; encoded outputnull-ok; prefix to attach to each line of outputnull-ok; if specified, an alternate output for
annotationsnull-ok; if specified, where annotations should gowhether to claim to have consumed output for
consume)outConverts and produces annotations on a stream. |
| private void | emitAdvanceLine(int
amount to change line number register by deltaLines)Emits an |
| private void | emitAdvancePc(int
>= 0; amount to change program counter byEmits an |
| private void | |
| private void | emitHeader(ArrayList<PositionList.
positions, sorted by ascending address sortedPositions,local list entries for method argumens arguments,
in left-to-right order omitting "this" methodArgsEmits the header sequence, which consists of LEB128-encoded initial line number and string indicies for names of all non-"this" arguments. |
| private void | emitLocalEnd(LocalList.
entry non-null; entry associated with end.Emits a |
| private void | emitLocalRestart(LocalList.
entry associated with this restart entryEmits a |
| private int | Returns: new value forcurLocalIdxCurrent index in locals curLocalIdx)Emits all local variable activity that occurs at the current
|
| private void | emitLocalStart(LocalList.
entry to emit entryEmits a |
| private void | emitLocalStartExtended(LocalList.
entry to emit entryEmits a |
| private void | emitPosition(PositionList.
position entry to emit. entryEmits the necessary byte sequences to emit the given position table entry. |
| private int | Returns: new value forcurPositionIdxCurrent index in sortedPositions curPositionIdx, ArrayList<PositionList.positions, sorted by ascending address sortedPositionsEmits all positions that occur at the current |
| private void | |
| private void | |
| private void | emitUnsignedLeb128(int
>= 0; value to emit. Note that, although this can
represent integers larger than Integer.MAX_VALUE, we currently don't
allow that.Emits an unsigned LEB128 value. |
| private String | Returns: non-null; annotation stringnon-null; entryReturns a string representation of this LocalList entry that is appropriate for emitting as an annotation. |
| private ArrayList | Returns: list of non-this method argument locals,
sorted by ascending registerExtracts method arguments from a locals list. |
| private int | Returns: register as noted aboveGets the register that begins the method's parameter range (including the 'this' parameter for non-static methods). |
| address | back to summary |
|---|---|
| private int address current encoding state: bytecode address | |
| annotateTo | back to summary |
|---|---|
| private AnnotatedOutput annotateTo if non-null: the output to write annotations to. No normal output is written to this. | |
| codeSize | back to summary |
|---|---|
| private final int codeSize | |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| debugPrint | back to summary |
|---|---|
| private PrintWriter debugPrint if non-null: another possible output for annotations | |
| desc | back to summary |
|---|---|
| private final Prototype desc | |
| file | back to summary |
|---|---|
| private final DexFile file | |
| isStatic | back to summary |
|---|---|
| private final boolean isStatic | |
| lastEntryForReg | back to summary |
|---|---|
| private final LocalList. indexed by register; last local alive in register | |
| line | back to summary |
|---|---|
| private int line current encoding state: line number | |
| locals | back to summary |
|---|---|
| private final LocalList locals
| |
| output | back to summary |
|---|---|
| private final ByteArrayAnnotatedOutput output | |
| positions | back to summary |
|---|---|
| private final PositionList positions
| |
| prefix | back to summary |
|---|---|
| private String prefix if non-null: the prefix for each annotation or debugPrint line | |
| regSize | back to summary |
|---|---|
| private final int regSize | |
| shouldConsume | back to summary |
|---|---|
| private boolean shouldConsume true if output should be consumed during annotation | |
| DebugInfoEncoder | back to summary |
|---|---|
| public DebugInfoEncoder(PositionList positions, LocalList locals, DexFile file, int codeSize, int regSize, boolean isStatic, CstMethodRef ref) Creates an instance.
| |
| annotate | back to summary |
|---|---|
| private void annotate(int length, String message) Annotates or writes a message to the
| |
| buildSortedPositions | back to summary |
|---|---|
| private ArrayList Builds a list of position entries, sorted by ascending address.
| |
| computeOpcode | back to summary |
|---|---|
| private static int computeOpcode(int deltaLines, int deltaAddress) Computes a special opcode that will encode the given position change. If the return value is > 0xff, then the request cannot be fulfilled. Essentially the same as described in "DWARF Debugging Format Version 3" section 6.2.5.1.
| |
| convert | back to summary |
|---|---|
| public byte[] convert() Converts this (PositionList, LocalList) pair into a state machine sequence.
| |
| convert0 | back to summary |
|---|---|
| private byte[] convert0() throws IOException | |
| convertAndAnnotate | back to summary |
|---|---|
| public byte[] convertAndAnnotate(String prefix, PrintWriter debugPrint, AnnotatedOutput out, boolean consume) Converts and produces annotations on a stream. Does not write
actual bits to the
| |
| emitAdvanceLine | back to summary |
|---|---|
| private void emitAdvanceLine(int deltaLines) throws IOException Emits an
| |
| emitAdvancePc | back to summary |
|---|---|
| private void emitAdvancePc(int deltaAddress) throws IOException Emits an
| |
| emitEndSequence | back to summary |
|---|---|
| private void emitEndSequence() Emits the | |
| emitHeader | back to summary |
|---|---|
| private void emitHeader(ArrayList<PositionList. Emits the header sequence, which consists of LEB128-encoded initial line number and string indicies for names of all non-"this" arguments. | |
| emitLocalEnd | back to summary |
|---|---|
| private void emitLocalEnd(LocalList. Emits a | |
| emitLocalRestart | back to summary |
|---|---|
| private void emitLocalRestart(LocalList. Emits a | |
| emitLocalsAtAddress | back to summary |
|---|---|
| private int emitLocalsAtAddress(int curLocalIdx) throws IOException Emits all local variable activity that occurs at the current
| |
| emitLocalStart | back to summary |
|---|---|
| private void emitLocalStart(LocalList. Emits a | |
| emitLocalStartExtended | back to summary |
|---|---|
| private void emitLocalStartExtended(LocalList. Emits a | |
| emitPosition | back to summary |
|---|---|
| private void emitPosition(PositionList. Emits the necessary byte sequences to emit the given position table entry. This will typically be a single special opcode, although it may also require DBG_ADVANCE_PC or DBG_ADVANCE_LINE.
| |
| emitPositionsAtAddress | back to summary |
|---|---|
| private int emitPositionsAtAddress(int curPositionIdx, ArrayList<PositionList. Emits all positions that occur at the current
| |
| emitStringIndex | back to summary |
|---|---|
| private void emitStringIndex(CstString string) throws IOException Emits a string index as an unsigned LEB128. The actual value written is shifted by 1, so that the '0' value is reserved for "null". The null symbol is used in some cases by the parameter name list at the beginning of the sequence.
| |
| emitTypeIndex | back to summary |
|---|---|
| private void emitTypeIndex(CstType type) throws IOException Emits a type index as an unsigned LEB128. The actual value written is shifted by 1, so that the '0' value is reserved for "null".
| |
| emitUnsignedLeb128 | back to summary |
|---|---|
| private void emitUnsignedLeb128(int n) throws IOException Emits an unsigned LEB128 value.
| |
| entryAnnotationString | back to summary |
|---|---|
| private String entryAnnotationString(LocalList. Returns a string representation of this LocalList entry that is appropriate for emitting as an annotation. | |
| extractMethodArguments | back to summary |
|---|---|
| private ArrayList Extracts method arguments from a locals list. These will be collected from the input list and sorted by ascending register in the returned list. | |
| getParamBase | back to summary |
|---|---|
| private int getParamBase() Gets the register that begins the method's parameter range (including
the 'this' parameter for non-static methods). The range continues until
| |