com.cmpware.elf
Class Dwarf

java.lang.Object
  extended by com.cmpware.elf.Dwarf

public class Dwarf
extends java.lang.Object

This describes an ELF / DWARF debug section interpretation.

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

Author:
SAG

Field Summary
static java.lang.String copyright
          Copyright string
 
Constructor Summary
Dwarf()
          Constructor
Dwarf(Elf elf)
          This constructor initializes the DWARF data structures with the sections from the ELF file data.
 
Method Summary
 java.lang.String getSourceFileName(int addr)
          This method takes in an address (often the Program Counter of a running program) and returns the name of the file containing the source code for this portion of the code.
 int getSourceLine(int addr)
          This method returns the line number in the source code file given a memory address of an instruction.
 boolean isDwarf()
          This method returns true if valid DWARF information was found and false otherwise.
 java.lang.String toString()
          This method returns a string representation of the DWARF data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
Copyright string

See Also:
Constant Field Values
Constructor Detail

Dwarf

public Dwarf()
Constructor


Dwarf

public Dwarf(Elf elf)
This constructor initializes the DWARF data structures with the sections from the ELF file data.

Parameters:
elf - The data loaded from an ELF file.
Method Detail

getSourceFileName

public java.lang.String getSourceFileName(int addr)
This method takes in an address (often the Program Counter of a running program) and returns the name of the file containing the source code for this portion of the code. a null string ("") is returned the address does not correspond to any known source code file.

Parameters:
addr - The address.
Returns:
This method returns the name of the source code file associated with a particular program counter / memory address.

getSourceLine

public int getSourceLine(int addr)
This method returns the line number in the source code file given a memory address of an instruction. Note that this only returns exact matches from the .line data. If zero is returned, this simply means that this particular address does not map exactly to a line offset. It is the job of the caller to interpret the results of this call appropriately.

Parameters:
addr - The program counter / memory address of an instruction.
Returns:
This method returns the line number in the source code file given a memory address of an instruction.

isDwarf

public boolean isDwarf()
This method returns true if valid DWARF information was found and false otherwise.

Returns:
This method returns true if valid DWARF information was found and false otherwise.

toString

public java.lang.String toString()
This method returns a string representation of the DWARF data.

Overrides:
toString in class java.lang.Object
Returns:
This method returns a string representation of the DWARF data.