Package ghidra.app.util.bin.format.omf
Class OmfSegmentHeader
- java.lang.Object
-
- ghidra.app.util.bin.format.omf.OmfRecord
-
- ghidra.app.util.bin.format.omf.OmfSegmentHeader
-
public class OmfSegmentHeader extends OmfRecord
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classOmfSegmentHeader.SectionStreamAn InputStream that produces the bytes for the dataBlocks in this segment.
-
Constructor Summary
Constructors Constructor Description OmfSegmentHeader(BinaryReader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddEnumeratedData(OmfEnumeratedData rec)Add an explicit data-block to this segment.protected voidaddIteratedData(OmfIteratedData rec)Add a compressed-form data-block to this segmentprotected voidappendEnumeratedData(OmfEnumeratedData rec)Add an explicit data-block to this segment that might extend the length of this segment.AddressgetAddress(Language language)intgetAlignment()java.lang.StringgetClassName()intgetCombine()intgetFrameDatum()java.lang.StringgetName()java.lang.StringgetOverlayName()java.io.InputStreamgetRawDataStream(BinaryReader reader)Get an InputStream that reads in the raw data for this segmentlonggetSegmentLength()longgetStartAddress()booleanhasNonZeroData()booleanisCode()booleanisExecutable()booleanisReadable()booleanisWritable()protected longrelocateSegment(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 voidresolveNames(java.util.ArrayList<java.lang.String> nameList)Resolve special names from the name list such as: segment, class, overlay, names.protected voidsortData()Sort the data-blocks within this segment-
Methods inherited from class ghidra.app.util.bin.format.omf.OmfRecord
calcCheckSum, getRecordLength, getRecordType, hasBigFields, readCheckSumByte, readIndex, readInt1Or2, readInt2Or4, readRecord, readRecordHeader, readString, validCheckSum
-
-
-
-
Constructor Detail
-
OmfSegmentHeader
public OmfSegmentHeader(BinaryReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
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
public Address getAddress(Language language)
- Parameters:
language- is the Program language for this binary- Returns:
- the starting Address for this segment
-
getName
public java.lang.String getName()
- Returns:
- the name of this segment
-
getClassName
public java.lang.String getClassName()
- Returns:
- the class name of this segment
-
getOverlayName
public java.lang.String 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
-
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
public java.io.InputStream getRawDataStream(BinaryReader reader) throws java.io.IOException
Get an InputStream that reads in the raw data for this segment- Parameters:
reader- is the image file reader- Returns:
- the InputStream
- Throws:
java.io.IOException- for problems reading from the image file
-
relocateSegment
protected long relocateSegment(long firstValidAddress, int alignOverride) throws OmfExceptionGiven 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
protected void resolveNames(java.util.ArrayList<java.lang.String> nameList) throws OmfExceptionResolve 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
protected void addEnumeratedData(OmfEnumeratedData rec)
Add an explicit data-block to this segment.- Parameters:
rec- is the data-block
-
appendEnumeratedData
protected void appendEnumeratedData(OmfEnumeratedData rec)
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
protected void addIteratedData(OmfIteratedData rec)
Add a compressed-form data-block to this segment- Parameters:
rec- is the data-block
-
-