Package ghidra.app.util.bin.format.coff
Class CoffSectionHeader
java.lang.Object
ghidra.app.util.bin.format.coff.CoffSectionHeader
- All Implemented Interfaces:
StructConverter
A 0x28 byte COFF section header
-
Field Summary
Modifier and TypeFieldDescriptionprotected CoffFileHeader
protected List
<CoffLineNumber> protected List
<CoffRelocation> protected int
protected int
protected String
protected int
protected int
protected int
protected short
protected int
protected short
protected int
protected int
protected int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Address
getAddress
(Language language, long offset, CoffSectionHeader section) Convert address offset to an Address object.static Address
getAddress
(Language language, long offset, AddressSpace space) Convert address offset to an Address in the specified space (defined by pspec).int
getFlags()
Returns the flags for this section.int
Returns the number of line number entries for this section.getName()
Returns the section name.short
getPage()
int
Returns the physical address offset.getPhysicalAddress
(Language language) Returns the physical address.int
Returns the file offset to the line numbers for this section.int
Returns the file offset to the section data.int
Returns the file offset to the relocations for this section.getRawDataStream
(ByteProvider provider, Language language) Returns an input stream that will supply the bytes for this section.int
Returns the number of relocations for this section.short
int
Returns the number of bytes of data stored in the file for this section.int
Returns the virtual address.boolean
boolean
isData()
boolean
boolean
Returns true if this section is byte oriented and aligned and should assume an addressable unit size of 1.boolean
isGroup()
boolean
boolean
isProcessedBytes
(Language language) boolean
boolean
boolean
void
move
(int offset) Adds offset to the physical address; this must be performed before relocations in order to achieve the proper result.protected void
readName
(BinaryReader reader) Returns a structure datatype representing the contents of the implementor of this interface.toString()
-
Field Details
-
s_name
-
s_paddr
protected int s_paddr -
s_vaddr
protected int s_vaddr -
s_size
protected int s_size -
s_scnptr
protected int s_scnptr -
s_relptr
protected int s_relptr -
s_lnnoptr
protected int s_lnnoptr -
s_nreloc
protected int s_nreloc -
s_nlnno
protected int s_nlnno -
s_flags
protected int s_flags -
s_reserved
protected short s_reserved -
s_page
protected short s_page -
_header
-
_relocations
-
_lineNumbers
-
-
Constructor Details
-
CoffSectionHeader
protected CoffSectionHeader()
-
-
Method Details
-
readName
- Throws:
IOException
-
getName
Returns the section name. The section name will never be more than eight characters.- Returns:
- the section name
-
getPhysicalAddress
public int getPhysicalAddress()Returns the physical address offset. This is the address at which the section should be loaded into memory and reflects a addressable word offset. For linked executables, this is the absolute address within the program space. For unlinked objects, this address is relative to the object's address space (i.e. the first section is always at offset zero).- Returns:
- the physical address
-
move
public void move(int offset) Adds offset to the physical address; this must be performed before relocations in order to achieve the proper result.- Parameters:
offset
- the offset to add to the physical address
-
getPhysicalAddress
Returns the physical address. This is the address at which the section should be loaded into memory. For linked executables, this is the absolute address within the program space. For unlinked objects, this address is relative to the object's address space (i.e. the first section is always at offset zero).- Returns:
- the physical address
-
getVirtualAddress
public int getVirtualAddress()Returns the virtual address. This value is always the same as s_paddr.- Returns:
- the virtual address
-
isExplicitlyByteAligned
public boolean isExplicitlyByteAligned()Returns true if this section is byte oriented and aligned and should assume an addressable unit size of 1.- Returns:
- true if byte aligned, false if word aligned
-
getSize
Returns the number of bytes of data stored in the file for this section. NOTE: This value does not strictly indicate size in bytes. For word-oriented machines, this value is represents size in words.- Returns:
- the number of bytes of data stored in the file for this section
-
getPointerToRawData
public int getPointerToRawData()Returns the file offset to the section data.- Returns:
- the file offset to the section data
-
getPointerToRelocations
public int getPointerToRelocations()Returns the file offset to the relocations for this section.- Returns:
- the file offset to the relocations for this section
-
getPointerToLineNumbers
public int getPointerToLineNumbers()Returns the file offset to the line numbers for this section.- Returns:
- the file offset to the line numbers for this section
-
getRelocationCount
public int getRelocationCount()Returns the number of relocations for this section.- Returns:
- the number of relocations for this section
-
getLineNumberCount
public int getLineNumberCount()Returns the number of line number entries for this section.- Returns:
- the number of line number entries for this section
-
getFlags
public int getFlags()Returns the flags for this section.- Returns:
- the flags for this section
-
getReserved
public short getReserved() -
getPage
public short getPage() -
getRawDataStream
Returns an input stream that will supply the bytes for this section.- Returns:
- the input stream
- Throws:
IOException
- if an I/O error occurs
-
isProcessedBytes
-
toDataType
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 existsIOException
- if an IO-related error occurs- See Also:
-
isUninitializedData
public boolean isUninitializedData() -
isInitializedData
public boolean isInitializedData() -
isData
public boolean isData() -
isReadable
public boolean isReadable() -
isGroup
public boolean isGroup() -
isWritable
public boolean isWritable() -
isExecutable
public boolean isExecutable() -
isAllocated
public boolean isAllocated() -
getRelocations
-
getLineNumbers
-
toString
-
getAddress
Convert address offset to an Address object. The default data space (defined by pspec) will be used if section is null or corresponds to a data section. The language default space (defined by slaspec) will be used for all non-data sections. If pspec does not specify a default data space, the default language space is used.- Parameters:
language
-offset
- address offset (byte offset assumed if section is null or is not explicitly byte aligned, otherwise word offset assumed).section
- section which contains the specified offset or null (data space assumed)- Returns:
- address object
-
getAddress
Convert address offset to an Address in the specified space (defined by pspec). If pspec does not specify a default data space, the default language space is used.- Parameters:
language
-offset
- address offset (word offset assumed).space
- address space- Returns:
- address object
-