harpoon.IR.RawClass
Class AttributeLocalVariableTable

java.lang.Object
  extended by harpoon.IR.RawClass.Attribute
      extended by harpoon.IR.RawClass.AttributeLocalVariableTable

public class AttributeLocalVariableTable
extends Attribute

The LocalVariableTable attribute is an optional variable-length attribute of a Code attribute. It may be used by debuggers to determine the value of a given local variable during the execution of a method. If LocalVariableTable attributes are present in the attributes table of a given Code attribute, then they may appear in any order. There may be no more than one LocalVariableTable attribute per local variable in the Code attribute.

This object represents a table mapping local variable indexes to symbolic names. This attribute is optional; typically it is not included unless debugging flags are given to the compiler.

Version:
$Id: AttributeLocalVariableTable.java,v 1.3 2003/09/05 21:45:16 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
"The Java Virtual Machine Specification, section 4.7.7", AttributeCode, Attribute

Field Summary
static String ATTRIBUTE_NAME
          The string naming this Attribute type.
 LocalVariableTable[] local_variable_table
          Each entry in the local_variable_table array indicates a range of code offsets within which a local variable has a value.
 
Fields inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, parent
 
Constructor Summary
AttributeLocalVariableTable(ClassFile parent, int attribute_name_index, LocalVariableTable[] local_variable_table)
          Constructor.
 
Method Summary
 long attribute_length()
          The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.
 int local_variable_table_length()
           
 String localName(int pc, int index)
          Get the (debugging) name of a local variable.
 void print(PrintWriter pw, int indent)
          Pretty-print the contents of this attribute.
 void write(ClassDataOutputStream out)
          Write to bytecode stream.
 
Methods inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, attribute_name, read, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
The string naming this Attribute type.

See Also:
Constant Field Values

local_variable_table

public LocalVariableTable[] local_variable_table
Each entry in the local_variable_table array indicates a range of code offsets within which a local variable has a value. It also indicates the index into the local variables of the current frame at which that local variable can be found.

Constructor Detail

AttributeLocalVariableTable

public AttributeLocalVariableTable(ClassFile parent,
                                   int attribute_name_index,
                                   LocalVariableTable[] local_variable_table)
Constructor.

Method Detail

attribute_length

public long attribute_length()
Description copied from class: Attribute
The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.

Specified by:
attribute_length in class Attribute

local_variable_table_length

public int local_variable_table_length()

write

public void write(ClassDataOutputStream out)
           throws IOException
Write to bytecode stream.

Specified by:
write in class Attribute
Throws:
IOException

localName

public String localName(int pc,
                        int index)
Get the (debugging) name of a local variable.

Parameters:
pc - the pc at which the inquiry is being made.
index - the index of the local variable to query.
Returns:
the name of the index'th local variable, or null if none can be found.

print

public void print(PrintWriter pw,
                  int indent)
Pretty-print the contents of this attribute.

Overrides:
print in class Attribute
Parameters:
indent - the indentation level to use.