com.ibm.wala.shrikeCT
Class LineNumberTableReader

java.lang.Object
  extended by com.ibm.wala.shrikeCT.AttributeReader
      extended by com.ibm.wala.shrikeCT.LineNumberTableReader

public final class LineNumberTableReader
extends AttributeReader

This class reads LineNumberTable attributes. Instead of constructing a LineNumberTableReader directly, consider just calling LineNumberTableReader.makeBytecodeToSourceMap for convenient access to aggregate line number data from all the LineNumberTable attributes for a given Code.


Field Summary
 
Fields inherited from class com.ibm.wala.shrikeCT.AttributeReader
attr, cr, length
 
Constructor Summary
LineNumberTableReader(ClassReader.AttrIterator iter)
          Build a reader for a LineNumberTable attribute.
 
Method Summary
 int[] getRawTable()
           
static int[] makeBytecodeToSourceMap(CodeReader code)
          Construct a "bytecode to source" map for the given code.
 
Methods inherited from class com.ibm.wala.shrikeCT.AttributeReader
checkSize, checkSizeEquals, getClassReader, getRawOffset, getRawSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineNumberTableReader

public LineNumberTableReader(ClassReader.AttrIterator iter)
                      throws InvalidClassFileException
Build a reader for a LineNumberTable attribute.

Throws:
InvalidClassFileException
Method Detail

getRawTable

public int[] getRawTable()
Returns:
the raw line number table data, a flattened sequence of (startPC, lineNumber) pairs

makeBytecodeToSourceMap

public static int[] makeBytecodeToSourceMap(CodeReader code)
                                     throws InvalidClassFileException,
                                            java.lang.IllegalArgumentException
Construct a "bytecode to source" map for the given code. This method aggregates all the LineNumberTable attributes for the code into one handy data structure.

Returns:
an array mapping each byte of the bytecode bytes to the line number that that byte belongs to, or null if there is no line number data in the Code
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException