com.cmpware.elf
Class Variable

java.lang.Object
  extended by com.cmpware.elf.Variable
All Implemented Interfaces:
TreeViewable

public class Variable
extends java.lang.Object
implements TreeViewable

This class stores all the data necessary for a DWARF variable. This just makes for a simpler structure to use in places like a tree display. Note that this variable is a named data element or parameter that may be of the type structure, array or scalar.

Copyright (c) 2005 Cmpware, Inc. All Rights Reserved.

Author:
SAG

Field Summary
 int addr
          The variable current address
 byte[] addrPgm
          The DWARF address program
 int declFile
          The declaration file number
 int declLine
          The declaration line number
 java.lang.Integer locList
          The location list (for non addrPgm[]s)
 java.lang.String name
          The variable name
 Scope scope
          The scope of this variable
 VariableType type
          The type of this variable
 
Constructor Summary
Variable(Scope scope)
          This constructor creates a variable.
 
Method Summary
 java.lang.Object[] getChildren()
          This method returns the children of this object.
 org.eclipse.swt.graphics.Image getImage()
          This method returns an image used as a decorator.
 java.lang.String getName()
           
 java.lang.Object getParent()
          This method returns the parent of this object.
 java.lang.String getText()
          This method returns the text string associated with this object.
static Variable getVariable(Scope scope, Tag tag)
          This method returns a Variable with data filled in from the ELF /DWARF tag.
 boolean hasChildren()
          This method returns true if this object has children and false otherwise.
 java.lang.String toString(int addrBytes, boolean byteSwap)
          This method returns a string representation of the variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
The variable name


addr

public int addr
The variable current address


declLine

public int declLine
The declaration line number


declFile

public int declFile
The declaration file number


addrPgm

public byte[] addrPgm
The DWARF address program


locList

public java.lang.Integer locList
The location list (for non addrPgm[]s)


type

public VariableType type
The type of this variable


scope

public Scope scope
The scope of this variable

Constructor Detail

Variable

public Variable(Scope scope)
This constructor creates a variable.

Parameters:
scope - The scope of this variable.
Method Detail

getVariable

public static Variable getVariable(Scope scope,
                                   Tag tag)
This method returns a Variable with data filled in from the ELF /DWARF tag. Note that this tag should be a DW_TAG_variable or a DW_TAG_formal_parameter.

Parameters:
scope - The scope for this variable.
tag - The ELF /DWARF tag representing this variable.
Returns:
This method returns a Variable with all of the fields filled in according to the input DWARF tag and its children.

getName

public java.lang.String getName()

getChildren

public java.lang.Object[] getChildren()
Description copied from interface: TreeViewable
This method returns the children of this object.

Specified by:
getChildren in interface TreeViewable
Returns:
This method returns the children of this object

getParent

public java.lang.Object getParent()
Description copied from interface: TreeViewable
This method returns the parent of this object.

Specified by:
getParent in interface TreeViewable
Returns:
This method returns the parent of this object.

hasChildren

public boolean hasChildren()
Description copied from interface: TreeViewable
This method returns true if this object has children and false otherwise.

Specified by:
hasChildren in interface TreeViewable
Returns:
This method returns true if this object has children and false otherwise.

getText

public java.lang.String getText()
Description copied from interface: TreeViewable
This method returns the text string associated with this object.

Specified by:
getText in interface TreeViewable
Returns:
This method returns the text string associated with this object.

getImage

public org.eclipse.swt.graphics.Image getImage()
Description copied from interface: TreeViewable
This method returns an image used as a decorator.

Specified by:
getImage in interface TreeViewable
Returns:
This method returns an image used as a decorator.

toString

public java.lang.String toString(int addrBytes,
                                 boolean byteSwap)
This method returns a string representation of the variable.

Parameters:
addrBytes - the number of bytes in an address.
byteSwap - the byte swappting flag from the ELF file.
Returns:
This method returns a string representation of the variable.