|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.SourceMapping
The SourceMapping
class embodies the concept of mapping machine code level
addresses and constructions in the Program
class back to a source code program,
either in assembly language (labels), or a high-level programming lagnguage like C. This
class is used by the simulator to report information about the program in a higher-level
way more readibly understandable, for example to report calls / returns between functions
by their names rather than their machine code addresses.
Nested Class Summary | |
class |
SourceMapping.Location
The Location class represents a location in the program; either named by
a label, or an unnamed integer address. |
Field Summary | |
static java.util.Comparator |
LOCATION_COMPARATOR
The LOCATION_COMPARATOR comparator is used in order to sort locations
in the program from lowest address to highest address. |
protected Program |
program
The program field stores a reference to the program for this source mapping. |
Constructor Summary | |
SourceMapping(Program p)
The constructor for the SourceMapping base class creates a new instance of source mapping
information for the specified program. |
Method Summary | |
abstract int |
getAddress(java.lang.String name)
The getAddress() method translates a source level name into a machine-code level
address. |
abstract SourceMapping.Location |
getLocation(java.lang.String name)
|
abstract java.lang.String |
getName(int address)
The getName() method translates a code address into a name that is more useful to
the user, such as a label, a location in a method, a location in a module and the source line, etc. |
Program |
getProgram()
The getProgram() class returns a reference to the program for which this class
provides source information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final Program program
program
field stores a reference to the program for this source mapping.
public static java.util.Comparator LOCATION_COMPARATOR
LOCATION_COMPARATOR
comparator is used in order to sort locations
in the program from lowest address to highest address.
Constructor Detail |
public SourceMapping(Program p)
SourceMapping
base class creates a new instance of source mapping
information for the specified program. The mapping is tied to the program throughout its lifetime.
p
- the program to create the source mapping forMethod Detail |
public abstract java.lang.String getName(int address)
getName()
method translates a code address into a name that is more useful to
the user, such as a label, a location in a method, a location in a module and the source line, etc.
address
- the address of an instruction in the program
public abstract int getAddress(java.lang.String name)
getAddress()
method translates a source level name into a machine-code level
address. For example, the name might represent the beginning of a method or a label in an
assembly program. If the name is not known in the program, this method should return -1.
name
- the name of some program entity as a string
public Program getProgram()
getProgram()
class returns a reference to the program for which this class
provides source information.
public abstract SourceMapping.Location getLocation(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |