Package ghidra.app.util.bin.format.elf
Class ElfDynamicTable
- java.lang.Object
- 
- ghidra.app.util.bin.format.elf.ElfDynamicTable
 
- 
- All Implemented Interfaces:
- ElfFileSection,- StructConverter
 
 public class ElfDynamicTable extends java.lang.Object implements ElfFileSection If an object file participates in dynamic linking, its program header table will have an element of type PT_DYNAMIC. This "segment" contains the ".dynamic" section. A special symbol, _DYNAMIC, labels the section, which contains an array of the Elf32_Dyn or Elf64_Dyn structures.All address entries contained within this table should adjusted for pre-linking using ElfHeader.adjustAddressForPrelink(long). If a pre-link adjustment is not applicable, this adjustment will have no affect.
- 
- 
Constructor SummaryConstructors Constructor Description ElfDynamicTable()DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDynamic(ElfDynamic dyn, int index)Adds the new dynamic at the specified index.booleancontainsDynamicValue(long type)Returns true if the specified dynamic type has a value.booleancontainsDynamicValue(ElfDynamicType type)Returns true if the specified dynamic (enum) type has a value.static ElfDynamicTablecreateDynamicTable(FactoryBundledWithBinaryReader reader, ElfHeader header, long fileOffset, long addrOffset)longgetAddressOffset()Preferred memory address offset where data should be loaded.ElfDynamic[]getDynamics()Returns an array of the dynamics defined this dynamic header.ElfDynamic[]getDynamics(long type)Returns an array of the dynamics defined this dynamic header with the specified type.ElfDynamic[]getDynamics(ElfDynamicType type)Returns an array of the dynamics defined this dynamic header with the specified (enum) type.longgetDynamicValue(long type)Returns the value of the specified dynamic type.longgetDynamicValue(ElfDynamicType type)Returns the value of the specified dynamic (enum) type.intgetEntrySize()Size of each structured entry in byteslonggetFileOffset()Offset within file where section bytes are specifiedlonggetLength()Length of file section in bytesvoidsetDynamicValue(long type, long value)Sets the dynamic with the specified type to the specified value.voidsetDynamicValue(ElfDynamicType type, long value)Sets the dynamic with the specified (enum) type to the specified value.byte[]toBytes(DataConverter dc)Get this dynamic table data as a byte arrayDataTypetoDataType()Returns a structure datatype representing the contents of the implementor of this interface.
 
- 
- 
- 
Method Detail- 
createDynamicTablepublic static ElfDynamicTable createDynamicTable(FactoryBundledWithBinaryReader reader, ElfHeader header, long fileOffset, long addrOffset) throws java.io.IOException - Throws:
- java.io.IOException
 
 - 
addDynamicpublic void addDynamic(ElfDynamic dyn, int index) Adds the new dynamic at the specified index.- Parameters:
- dyn- the new dynamic
- index- the new index
 
 - 
getDynamicspublic ElfDynamic[] getDynamics() Returns an array of the dynamics defined this dynamic header.- Returns:
- an array of the dynamics defined this dynamic header
 
 - 
getDynamicspublic ElfDynamic[] getDynamics(long type) Returns an array of the dynamics defined this dynamic header with the specified type.- Parameters:
- type- the desired dynamic type, e.g., DT_NEEDED
- Returns:
- an array of the dynamics defined this dynamic header
 
 - 
getDynamicspublic ElfDynamic[] getDynamics(ElfDynamicType type) Returns an array of the dynamics defined this dynamic header with the specified (enum) type.- Parameters:
- type- the desired dynamic type, e.g., DT_NEEDED
- Returns:
- an array of the dynamics defined this dynamic header
 
 - 
setDynamicValuepublic void setDynamicValue(long type, long value)Sets the dynamic with the specified type to the specified value.- Parameters:
- type- the dynamic type
- value- the new value
 
 - 
setDynamicValuepublic void setDynamicValue(ElfDynamicType type, long value) Sets the dynamic with the specified (enum) type to the specified value.- Parameters:
- type- the dynamic (enum) type
- value- the new value
 
 - 
getDynamicValuepublic long getDynamicValue(long type) throws NotFoundExceptionReturns the value of the specified dynamic type.- Parameters:
- type- the dynamic type
- Returns:
- the dynamic value
- Throws:
- NotFoundException
 
 - 
containsDynamicValuepublic boolean containsDynamicValue(ElfDynamicType type) Returns true if the specified dynamic (enum) type has a value.- Parameters:
- type- the dynamic (enum) type
- Returns:
- true if dynamic value exists
 
 - 
containsDynamicValuepublic boolean containsDynamicValue(long type) Returns true if the specified dynamic type has a value.- Parameters:
- type- the dynamic type
- Returns:
- true if dynamic value exists
 
 - 
getDynamicValuepublic long getDynamicValue(ElfDynamicType type) throws NotFoundException Returns the value of the specified dynamic (enum) type.- Parameters:
- type- the dynamic (enum) type
- Returns:
- the dynamic value
- Throws:
- NotFoundException
 
 - 
getFileOffsetpublic long getFileOffset() Description copied from interface:ElfFileSectionOffset within file where section bytes are specified- Specified by:
- getFileOffsetin interface- ElfFileSection
- Returns:
- offset within file where section bytes are specified
 
 - 
getAddressOffsetpublic long getAddressOffset() Description copied from interface:ElfFileSectionPreferred 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:
- getAddressOffsetin interface- ElfFileSection
- Returns:
- default memory address offset where data should be loaded
 
 - 
toDataTypepublic DataType toDataType() throws DuplicateNameException, java.io.IOException Description copied from interface:StructConverterReturns 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:
- toDataTypein interface- StructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
- DuplicateNameException- when a datatype of the same name already exists
- java.io.IOException
- See Also:
- StructureDataType
 
 - 
getLengthpublic long getLength() Description copied from interface:ElfFileSectionLength of file section in bytes- Specified by:
- getLengthin interface- ElfFileSection
- Returns:
- length of file section in bytes
 
 - 
getEntrySizepublic int getEntrySize() Description copied from interface:ElfFileSectionSize of each structured entry in bytes- Specified by:
- getEntrySizein interface- ElfFileSection
- Returns:
- entry size or -1 if variable
 
 - 
toBytespublic byte[] toBytes(DataConverter dc) throws java.lang.ArrayIndexOutOfBoundsException Get this dynamic table data as a byte array- Parameters:
- dc- data converter
- Returns:
- data array
- Throws:
- java.lang.ArrayIndexOutOfBoundsException
 
 
- 
 
-