Class DebugInfoEncoder

java.lang.Object
com.android.dx.dex.file.DebugInfoEncoder

public final class DebugInfoEncoder extends Object
An encoder for the dex debug info state machine format. The format for each method enrty is as follows:
  1. signed LEB128: initial value for line register.
  2. n instances of signed LEB128: string indicies (offset by 1) for each method argument in left-to-right order with this excluded. A value of '0' indicates "no name"
  3. A sequence of special or normal opcodes as defined in DebugInfoConstants.
  4. A single terminating OP_END_SEQUENCE
  • Constructor Details

    • DebugInfoEncoder

      public DebugInfoEncoder(PositionList positions, LocalList locals, DexFile file, int codeSize, int regSize, boolean isStatic, CstMethodRef ref)
      Creates an instance.
      Parameters:
      positions - null-ok; positions (line numbers) to encode
      locals - null-ok; local variables to encode
      file - null-ok; may only be null if simply using this class to do a debug print
      codeSize -
      regSize -
      isStatic -
      ref -
  • Method Details

    • convert

      public byte[] convert()
      Converts this (PositionList, LocalList) pair into a state machine sequence.
      Returns:
      non-null; encoded byte sequence without padding and terminated with a 0x00 byte
    • convertAndAnnotate

      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 AnnotatedOutput.
      Parameters:
      prefix - null-ok; prefix to attach to each line of output
      debugPrint - null-ok; if specified, an alternate output for annotations
      out - null-ok; if specified, where annotations should go
      consume - whether to claim to have consumed output for out
      Returns:
      non-null; encoded output