Package ghidra.app.util.bin.format.elf
Class ElfSymbolTable
- java.lang.Object
-
- ghidra.app.util.bin.format.elf.ElfSymbolTable
-
- All Implemented Interfaces:
ByteArrayConverter
,ElfFileSection
,StructConverter
public class ElfSymbolTable extends java.lang.Object implements ElfFileSection, ByteArrayConverter
A container class to hold ELF symbols.
-
-
Constructor Summary
Constructors Constructor Description ElfSymbolTable()
DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSymbol(ElfSymbol symbol)
Adds the specified symbol into this symbol table.long
getAddressOffset()
Preferred memory address offset where data should be loaded.int
getEntrySize()
Size of each structured entry in byteslong
getFileOffset()
Offset within file where section bytes are specifiedElfSymbol[]
getGlobalSymbols()
Returns all of the global symbols.long
getLength()
Length of file section in bytesjava.lang.String[]
getSourceFiles()
Returns all of the sources file names.ElfStringTable
getStringTable()
Returns the associated string table section.ElfSymbol
getSymbolAt(long addr)
Returns the symbol at the specified address.int
getSymbolCount()
int
getSymbolIndex(ElfSymbol symbol)
Returns the index of the specified symbol in this symbol table.ElfSymbol[]
getSymbols()
Returns all of the symbols defined in this symbol table.ElfSectionHeader
getTableSectionHeader()
Get the section header which corresponds to this table, or null if only associated with a dynamic table entryboolean
isDynamic()
Returns true if this is the dynamic symbol tablebyte[]
toBytes(DataConverter dc)
Returns a byte array representing this implementor of this interface.DataType
toDataType()
Returns a structure datatype representing the contents of the implementor of this interface.
-
-
-
Method Detail
-
isDynamic
public boolean isDynamic()
Returns true if this is the dynamic symbol table- Returns:
- true if this is the dynamic symbol table
-
getStringTable
public ElfStringTable getStringTable()
Returns the associated string table section.- Returns:
- the associated string table section
-
getSymbolCount
public int getSymbolCount()
- Returns:
- number of symbols
-
getSymbols
public ElfSymbol[] getSymbols()
Returns all of the symbols defined in this symbol table.- Returns:
- all of the symbols defined in this symbol table
-
getSymbolIndex
public int getSymbolIndex(ElfSymbol symbol)
Returns the index of the specified symbol in this symbol table.- Parameters:
symbol
- the symbol- Returns:
- the index of the specified symbol
-
getSymbolAt
public ElfSymbol getSymbolAt(long addr)
Returns the symbol at the specified address.- Parameters:
addr
- the symbol address- Returns:
- the symbol at the specified address
-
getGlobalSymbols
public ElfSymbol[] getGlobalSymbols()
Returns all of the global symbols.- Returns:
- all of the global symbols
-
getSourceFiles
public java.lang.String[] getSourceFiles()
Returns all of the sources file names.- Returns:
- all of the sources file names
-
addSymbol
public void addSymbol(ElfSymbol symbol)
Adds the specified symbol into this symbol table.- Parameters:
symbol
- the new symbol to add
-
toBytes
public byte[] toBytes(DataConverter dc)
Description copied from interface:ByteArrayConverter
Returns a byte array representing this implementor of this interface.- Specified by:
toBytes
in interfaceByteArrayConverter
- Parameters:
dc
- the data converter to use- Returns:
- a byte array representing this object
- See Also:
ByteArrayConverter.toBytes(ghidra.util.DataConverter)
-
getLength
public long getLength()
Description copied from interface:ElfFileSection
Length of file section in bytes- Specified by:
getLength
in interfaceElfFileSection
- Returns:
- length of file section in bytes
-
getAddressOffset
public long getAddressOffset()
Description copied from interface:ElfFileSection
Preferred memory address offset where data should be loaded. The returned offset will already have the prelink adjustment applied, although will not reflect any change in the image base.- Specified by:
getAddressOffset
in interfaceElfFileSection
- Returns:
- default memory address offset where data should be loaded
-
getTableSectionHeader
public ElfSectionHeader getTableSectionHeader()
Get the section header which corresponds to this table, or null if only associated with a dynamic table entry- Returns:
- symbol table section header or null
-
getFileOffset
public long getFileOffset()
Description copied from interface:ElfFileSection
Offset within file where section bytes are specified- Specified by:
getFileOffset
in interfaceElfFileSection
- Returns:
- offset within file where section bytes are specified
-
getEntrySize
public int getEntrySize()
Description copied from interface:ElfFileSection
Size of each structured entry in bytes- Specified by:
getEntrySize
in interfaceElfFileSection
- Returns:
- entry size or -1 if variable
-
toDataType
public DataType toDataType() throws DuplicateNameException
Description copied from interface:StructConverter
Returns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }
The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataType
in interfaceStructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException
- when a datatype of the same name already exists- See Also:
StructureDataType
-
-