Package ghidra.app.util.bin.format.omf
Class OmfRecord
java.lang.Object
ghidra.app.util.bin.format.omf.OmfRecord
- All Implemented Interfaces:
StructConverter
- Direct Known Subclasses:
Omf166DepList,Omf51Content,Omf51ExternalDefsRecord,Omf51FixupRecord,Omf51LibraryDictionaryRecord,Omf51LibraryHeaderRecord,Omf51LibraryModuleLocationsRecord,Omf51LibraryModuleNamesRecord,Omf51ModuleEnd,Omf51ModuleHeader,Omf51PublicDefsRecord,Omf51SegmentDefs,OmfCommentRecord,OmfData,OmfExternalSymbol,OmfFileHeader,OmfFixupRecord,OmfGroupRecord,OmfModuleEnd,OmfNamesRecord,OmfObsoleteRecord,OmfSegmentHeader,OmfSymbolRecord,OmfUnknownRecord,OmfUnsupportedRecord
A generic OMF record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byteprotected byte[]protected longprotected BinaryReaderprotected intprotected longprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteComputes the record's checksumbyte[]getData()Returns the record data.byteReturns the record checksum.intReturns the record length.longReturns the record offset.intReturns the record type.booleanReturns true if this record has big fields; otherwise, false.abstract voidParses thisOmfRecord's type-spefic dataabstract DataTypeReturns a structure datatype representing the contents of the implementor of this interface.toString()booleanValidates the record's checksum
-
Field Details
-
recordType
protected int recordType -
recordLength
protected int recordLength -
data
protected byte[] data -
checkSum
protected byte checkSum -
recordOffset
protected long recordOffset -
dataReader
-
dataEnd
protected long dataEnd
-
-
Constructor Details
-
OmfRecord
public OmfRecord() -
OmfRecord
Creates a newOmfRecord- Parameters:
reader- ABinaryReaderpositioned at the start of the record- Throws:
IOException- if there was an IO-related error
-
-
Method Details
-
parseData
Parses thisOmfRecord's type-spefic data- Throws:
IOException- if there was an IO-related errorOmfException- if there was a problem with the OMF specification
-
toDataType
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 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:
-
getRecordType
public int getRecordType()Returns the record type.- Returns:
- the record type
-
getRecordLength
public int getRecordLength()Returns the record length.- Returns:
- the record length
-
getRecordOffset
public long getRecordOffset()Returns the record offset.- Returns:
- the record offset
-
getRecordChecksum
public byte getRecordChecksum()Returns the record checksum.- Returns:
- the record checksum
-
getData
public byte[] getData()Returns the record data.- Returns:
- the record data
-
calcCheckSum
Computes the record's checksum- Returns:
- The record's checksum
- Throws:
IOException- if an IO-related error occurred
-
validCheckSum
Validates the record's checksum- Returns:
- True if the checksum is valid; otherwise, false
- Throws:
IOException- if an IO-related error occurred
-
hasBigFields
public boolean hasBigFields()Returns true if this record has big fields; otherwise, false.- Returns:
- true if this record has big fields; otherwise, false
-
toString
-