Class OmfSegmentHeader
java.lang.Object
ghidra.app.util.bin.format.omf.OmfRecord
ghidra.app.util.bin.format.omf.omf.OmfSegmentHeader
- All Implemented Interfaces:
StructConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
An InputStream that produces the bytes for the dataBlocks in this segment. -
Field Summary
Fields inherited from class ghidra.app.util.bin.format.omf.OmfRecord
checkSum, data, dataEnd, dataReader, recordLength, recordOffset, recordType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add an explicit data-block to this segment.protected void
Add a compressed-form data-block to this segmentprotected void
Add an explicit data-block to this segment that might extend the length of this segment.getAddress
(Language language) int
int
int
getName()
getRawDataStream
(BinaryReader reader, MessageLog log) Get an InputStream that reads in the raw data for this segmentlong
long
boolean
boolean
is16Bit()
boolean
isCode()
boolean
boolean
boolean
void
Parses thisOmfRecord
's type-spefic dataprotected long
relocateSegment
(long firstValidAddress, int alignOverride) Given the first possible address where this segment can reside, relocate the segment based on this address and alignment considerations.protected void
resolveNames
(List<String> nameList) Resolve special names from the name list such as: segment, class, overlay, names.protected void
sortData()
Sort the data-blocks within this segmentReturns a structure datatype representing the contents of the implementor of this interface.Methods inherited from class ghidra.app.util.bin.format.omf.OmfRecord
calcCheckSum, getData, getRecordChecksum, getRecordLength, getRecordOffset, getRecordType, hasBigFields, toString, validCheckSum
-
Constructor Details
-
OmfSegmentHeader
- Throws:
IOException
-
-
Method Details
-
parseData
Description copied from class:OmfRecord
Parses thisOmfRecord
's type-spefic data- Specified by:
parseData
in classOmfRecord
- Throws:
IOException
- if there was an IO-related errorOmfException
- if there was a problem with the OMF specification
-
isCode
public boolean isCode()- Returns:
- true if this is a code segment
-
isReadable
public boolean isReadable()- Returns:
- true if this segment is readable
-
isWritable
public boolean isWritable()- Returns:
- true if this segment is writable
-
isExecutable
public boolean isExecutable()- Returns:
- true if this segment is executable
-
getFrameDatum
public int getFrameDatum()- Returns:
- the segment selector needed for this object
-
getAddress
- Parameters:
language
- is the Program language for this binary- Returns:
- the starting Address for this segment
-
getName
- Returns:
- the name of this segment
-
getClassName
- Returns:
- the class name of this segment
-
getOverlayName
- Returns:
- the name of the overlay, or the empty string
-
getStartAddress
public long getStartAddress()- Returns:
- the load image address for this segment
-
getSegmentLength
public long getSegmentLength()- Returns:
- the length of the segment in bytes
-
getAlignment
public int getAlignment()- Returns:
- the alignment required for this segment
-
getCombine
public int getCombine()- Returns:
- special combining rules for this segment
-
is16Bit
public boolean is16Bit()- Returns:
- if 16 or 32 bit segments are used
-
hasNonZeroData
public boolean hasNonZeroData()- Returns:
- true if this block uses filler other than zero bytes
-
sortData
protected void sortData()Sort the data-blocks within this segment -
getRawDataStream
Get an InputStream that reads in the raw data for this segment- Parameters:
reader
- is the image file readerlog
- the log- Returns:
- the InputStream
- Throws:
IOException
- for problems reading from the image file
-
relocateSegment
Given the first possible address where this segment can reside, relocate the segment based on this address and alignment considerations.- Parameters:
firstValidAddress
- is the first possible Address for the segmentalignOverride
- if non-negative, overrides alignment info from the segment header- Returns:
- the next possible address for following segments
- Throws:
OmfException
- for bad alignment information
-
resolveNames
Resolve special names from the name list such as: segment, class, overlay, names. This routine also determines the read/write/execute permissions for the segment based on the class name.- Parameters:
nameList
- is the array of names associated with the file- Throws:
OmfException
- for improper name indices
-
addEnumeratedData
Add an explicit data-block to this segment.- Parameters:
rec
- is the data-block
-
appendEnumeratedData
Add an explicit data-block to this segment that might extend the length of this segment. Borland compilers in particular produce data-blocks that can extend the segment in this way.- Parameters:
rec
- is the data-block
-
addIteratedData
Add a compressed-form data-block to this segment- Parameters:
rec
- is the data-block
-
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
- Specified by:
toDataType
in classOmfRecord
- 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:
-