|
decompiler 1.0.0
|
A class for reading structured data from a stream. More...
#include <marshal.hh>
Public Member Functions | |
| Decoder (const AddrSpaceManager *spc) | |
| Base constructor. | |
| const AddrSpaceManager * | getAddrSpaceManager (void) const |
| Get the manager used for address space decoding. | |
| virtual | ~Decoder (void) |
| Destructor. | |
| virtual void | ingestStream (istream &s)=0 |
| Prepare to decode a given stream. More... | |
| virtual uint4 | peekElement (void)=0 |
| Peek at the next child element of the current parent, without traversing in (opening) it. More... | |
| virtual uint4 | openElement (void)=0 |
| Open (traverse into) the next child element of the current parent. More... | |
| virtual uint4 | openElement (const ElementId &elemId)=0 |
| Open (traverse into) the next child element, which must be of a specific type. More... | |
| virtual void | closeElement (uint4 id)=0 |
| Close the current element. More... | |
| virtual void | closeElementSkipping (uint4 id)=0 |
| Close the current element, skipping any child elements that have not yet been parsed. More... | |
| virtual uint4 | getNextAttributeId (void)=0 |
| Get the next attribute id for the current element. More... | |
| virtual void | rewindAttributes (void)=0 |
| Reset attribute traversal for the current element. More... | |
| virtual bool | readBool (void)=0 |
| Parse the current attribute as a boolean value. More... | |
| virtual bool | readBool (const AttributeId &attribId)=0 |
| Find and parse a specific attribute in the current element as a boolean value. More... | |
| virtual intb | readSignedInteger (void)=0 |
| Parse the current attribute as a signed integer value. More... | |
| virtual intb | readSignedInteger (const AttributeId &attribId)=0 |
| Find and parse a specific attribute in the current element as a signed integer. More... | |
| virtual uintb | readUnsignedInteger (void)=0 |
| Parse the current attribute as an unsigned integer value. More... | |
| virtual uintb | readUnsignedInteger (const AttributeId &attribId)=0 |
| Find and parse a specific attribute in the current element as an unsigned integer. More... | |
| virtual string | readString (void)=0 |
| Parse the current attribute as a string. More... | |
| virtual string | readString (const AttributeId &attribId)=0 |
| Find the specific attribute in the current element and return it as a string. More... | |
| virtual AddrSpace * | readSpace (void)=0 |
| Parse the current attribute as an address space. More... | |
| virtual AddrSpace * | readSpace (const AttributeId &attribId)=0 |
| Find the specific attribute in the current element and return it as an address space. More... | |
| void | skipElement (void) |
| Skip parsing of the next element. More... | |
Protected Attributes | |
| const AddrSpaceManager * | spcManager |
| Manager for decoding address space attributes. | |
A class for reading structured data from a stream.
All data is loosely structured as with an XML document. A document contains a nested set of elements, with labels corresponding to the ElementId class. A single element can hold zero or more attributes and zero or more child elements. An attribute holds a primitive data element (bool, integer, string) and is labeled by an AttributeId. The document is traversed using a sequence of openElement() and closeElement() calls, intermixed with read*() calls to extract the data. The elements are traversed in a depth first order. Attributes within an element can be traversed in order using repeated calls to the getNextAttributeId() method, followed by a calls to one of the read*(void) methods to extract the data. Alternately a read*(AttributeId) call can be used to extract data for an attribute known to be in the element. There is a special content attribute whose data can be extracted using a read*(AttributeId) call that is passed the special ATTRIB_CONTENT id. This attribute will not be traversed by getNextAttribute().
|
pure virtual |
Close the current element.
The data for the current element is considered fully processed. If the element has additional children, an exception is thrown. The stream must indicate the end of the element in some way.
| id | is the id of the element to close (which must be the current element) |
Implemented in XmlDecode, and PackedDecode.
Referenced by Scope::addMapSym(), SeqNum::decode(), Range::decode(), RangeProperties::decode(), RangeList::decode(), Comment::decode(), CommentDatabaseInternal::decode(), ConstantPoolInternal::CheapSorter::decode(), SymbolEntry::decode(), Symbol::decode(), FunctionSymbol::decode(), EquateSymbol::decode(), UnionFacetSymbol::decode(), LabSymbol::decode(), ExternRefSymbol::decode(), ScopeInternal::decode(), Database::decode(), ProtoModel::decode(), ProtoModelMerged::decode(), Funcdata::decode(), GhidraTranslate::decode(), TrackedContext::decode(), ContextInternal::decode(), InjectCallotherGhidra::decode(), LoadTable::decode(), JumpBasicOverride::decode(), JumpTable::decode(), OptionDatabase::decode(), VarnodeData::decode(), CompilerTag::decode(), LanguageDescription::decode(), AddrSpace::decode(), OverlaySpace::decode(), StringManager::decode(), LanedRegister::decode(), TruncationTag::decode(), SpacebaseSpace::decode(), TypeFactory::decode(), SegmentOp::decode(), JumpAssistOp::decode(), Override::decode(), BlockEdge::decode(), FlowBlock::decode(), ParamEntry::decode(), PcodeOpRaw::decode(), ProtoStoreInternal::decode(), CPoolRecord::decode(), ConstantPoolInternal::decode(), TypeEnum::decode(), TypePointerRel::decode(), ParamListStandard::decode(), Architecture::decodeAggressiveTrim(), BlockGraph::decodeBody(), ScopeInternal::decodeCollision(), ContextInternal::decodeContext(), TypeFactory::decodeCoreTypes(), TypeFactory::decodeDataOrganization(), Architecture::decodeDeadcodeDelay(), Architecture::decodeDefaultProto(), Architecture::decodeDynamicRule(), Architecture::decodeFlowOverride(), ContextInternal::decodeFromSpec(), Architecture::decodeFuncPtrAlign(), Architecture::decodeGlobal(), ScopeInternal::decodeHole(), ScopeGhidra::decodeHole(), Architecture::decodeIncidentalCopy(), Architecture::decodeInferPtrBounds(), Funcdata::decodeJumpTable(), Architecture::decodeLaneSizes(), Architecture::decodeNoHighPtr(), OptionDatabase::decodeOne(), PcodeEmit::decodeOp(), InjectPayload::decodeParameter(), Architecture::decodePreferSplit(), Architecture::decodeProtoEval(), Architecture::decodeReadOnly(), Architecture::decodeReturnAddress(), Database::decodeScope(), Architecture::decodeSpacebase(), AddrSpaceManager::decodeSpaces(), Architecture::decodeStackPointer(), TypeFactory::decodeType(), TypeFactory::decodeTypeNoRef(), TypeFactory::decodeTypeWithCodeFlags(), Architecture::decodeVolatile(), ScopeGhidra::dump2Cache(), TypeFactory::parseEnumConfig(), ParamListStandard::parseGroup(), Database::parseParentTag(), and TypeField::TypeField().
|
pure virtual |
Close the current element, skipping any child elements that have not yet been parsed.
This closes the given element, which must be current. If there are child elements that have not been parsed, this is not considered an error, and they are skipped over in the parse.
| id | is the id of the element to close (which must be the current element) |
Implemented in XmlDecode, and PackedDecode.
Referenced by InjectPayloadGhidra::decode(), InjectCallfixupGhidra::decode(), InjectCallotherGhidra::decode(), ExecutablePcodeGhidra::decode(), LanguageDescription::decode(), TypeFactory::decodeDataOrganization(), and skipElement().
|
pure virtual |
Get the next attribute id for the current element.
Attributes are automatically set up for traversal using this method, when the element is opened. If all attributes have been traversed (or there are no attributes), 0 is returned.
Implemented in XmlDecode, and PackedDecode.
Referenced by SeqNum::decode(), RangeProperties::decode(), FunctionSymbol::decode(), ExternRefSymbol::decode(), Database::decode(), ProtoModel::decode(), Funcdata::decode(), ContextInternal::decode(), JumpTable::decode(), LanguageDescription::decode(), LanedRegister::decode(), SegmentOp::decode(), FuncProto::decode(), ParamEntry::decode(), ProtoStoreInternal::decode(), CPoolRecord::decode(), TypePointer::decode(), TypeArray::decode(), TypeEnum::decode(), TypePointerRel::decode(), ParamListStandard::decode(), Architecture::decodeAggressiveTrim(), AddrSpace::decodeAttributes(), JoinSpace::decodeAttributes(), Datatype::decodeBasic(), AddrSpace::decodeBasicAttributes(), Architecture::decodeDynamicRule(), Range::decodeFromAttributes(), VarnodeData::decodeFromAttributes(), Symbol::decodeHeader(), ScopeInternal::decodeHole(), ScopeGhidra::decodeHole(), InjectPayload::decodeParameter(), InjectPayload::decodePayloadAttributes(), Architecture::decodeStackPointer(), TypeFactory::decodeType(), TypeFactory::decodeTypedef(), TypeFactory::decodeTypeNoRef(), TypeFactory::decodeTypeWithCodeFlags(), UserOpManage::decodeVolatile(), and TypeField::TypeField().
|
pure virtual |
Prepare to decode a given stream.
Called once before any decoding. Currently this is assumed to make an internal copy of the stream data, i.e. the input stream is cleared before any decoding takes place.
| s | is the given input stream to be decode |
Implemented in XmlDecode, and PackedDecode.
Referenced by ArchitectureGhidra::readStringStream().
|
pure virtual |
Open (traverse into) the next child element, which must be of a specific type.
The child becomes the current parent, and its attributes are initialized for use with getNextAttributeId. The child must match the given element id or an exception is thrown.
| elemId | is the given element id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Open (traverse into) the next child element of the current parent.
The child becomes the current parent. The list of attributes is initialized for use with getNextAttributeId.
Implemented in XmlDecode, and PackedDecode.
Referenced by Scope::addMapSym(), SeqNum::decode(), Range::decode(), RangeProperties::decode(), RangeList::decode(), Comment::decode(), CommentDatabaseInternal::decode(), ConstantPoolInternal::CheapSorter::decode(), SymbolEntry::decode(), Symbol::decode(), FunctionSymbol::decode(), EquateSymbol::decode(), UnionFacetSymbol::decode(), LabSymbol::decode(), ExternRefSymbol::decode(), ScopeInternal::decode(), Database::decode(), ProtoModel::decode(), ProtoModelMerged::decode(), Funcdata::decode(), GhidraTranslate::decode(), TrackedContext::decode(), ContextInternal::decode(), InjectPayloadGhidra::decode(), InjectCallfixupGhidra::decode(), InjectCallotherGhidra::decode(), ExecutablePcodeGhidra::decode(), LoadTable::decode(), JumpBasicOverride::decode(), JumpTable::decode(), OptionDatabase::decode(), VarnodeData::decode(), CompilerTag::decode(), LanguageDescription::decode(), AddrSpace::decode(), OverlaySpace::decode(), StringManager::decode(), LanedRegister::decode(), TruncationTag::decode(), SpacebaseSpace::decode(), TypeFactory::decode(), SegmentOp::decode(), JumpAssistOp::decode(), FuncProto::decode(), Override::decode(), BlockEdge::decode(), FlowBlock::decode(), ParamEntry::decode(), PcodeOpRaw::decode(), ProtoStoreInternal::decode(), CPoolRecord::decode(), ConstantPoolInternal::decode(), TypeEnum::decode(), TypePointerRel::decode(), ParamListStandard::decode(), Architecture::decodeAggressiveTrim(), BlockGraph::decodeBody(), ScopeInternal::decodeCollision(), ContextInternal::decodeContext(), TypeFactory::decodeCoreTypes(), TypeFactory::decodeDataOrganization(), Architecture::decodeDeadcodeDelay(), Architecture::decodeDefaultProto(), Architecture::decodeDynamicRule(), Architecture::decodeFlowOverride(), ContextInternal::decodeFromSpec(), Architecture::decodeFuncPtrAlign(), Architecture::decodeGlobal(), ScopeInternal::decodeHole(), ScopeGhidra::decodeHole(), Architecture::decodeIncidentalCopy(), Architecture::decodeInferPtrBounds(), Funcdata::decodeJumpTable(), Architecture::decodeLaneSizes(), Architecture::decodeNoHighPtr(), OptionDatabase::decodeOne(), PcodeEmit::decodeOp(), InjectPayload::decodeParameter(), Architecture::decodePreferSplit(), Architecture::decodeProtoEval(), Architecture::decodeReadOnly(), Architecture::decodeReturnAddress(), Database::decodeScope(), Architecture::decodeSpacebase(), AddrSpaceManager::decodeSpaces(), Architecture::decodeStackPointer(), TypeFactory::decodeType(), TypeFactory::decodeTypeNoRef(), TypeFactory::decodeTypeWithCodeFlags(), Architecture::decodeVolatile(), ScopeGhidra::dump2Cache(), TypeFactory::parseEnumConfig(), ParamListStandard::parseGroup(), Database::parseParentTag(), skipElement(), and TypeField::TypeField().
|
pure virtual |
Peek at the next child element of the current parent, without traversing in (opening) it.
The element id is returned, which can be compared to ElementId labels. If there are no remaining child elements to traverse, 0 is returned.
Implemented in XmlDecode, and PackedDecode.
Referenced by Scope::addMapSym(), RangeList::decode(), Comment::decode(), CommentDatabaseInternal::decode(), SymbolEntry::decode(), FunctionSymbol::decode(), ScopeInternal::decode(), Database::decode(), ProtoModel::decode(), Funcdata::decode(), GhidraTranslate::decode(), JumpTable::decode(), OptionDatabase::decode(), LanguageDescription::decode(), TypeFactory::decode(), SegmentOp::decode(), JumpAssistOp::decode(), PcodeOpRaw::decode(), ConstantPoolInternal::decode(), ParamListStandard::decode(), BlockGraph::decodeBody(), TypeFactory::decodeCoreTypes(), Architecture::decodeDefaultProto(), FlowBlock::decodeEdges(), TypeStruct::decodeFields(), TypeUnion::decodeFields(), Architecture::decodeGlobal(), Architecture::decodeIncidentalCopy(), Architecture::decodeInferPtrBounds(), Funcdata::decodeJumpTable(), Architecture::decodeLaneSizes(), Architecture::decodeNoHighPtr(), InjectPayload::decodePayloadParams(), Architecture::decodePreferSplit(), Architecture::decodeProto(), TypeCode::decodePrototype(), Architecture::decodeReadOnly(), Architecture::decodeReturnAddress(), AddrSpaceManager::decodeSpace(), AddrSpaceManager::decodeSpaces(), TypeCode::decodeStub(), ContextDatabase::decodeTracked(), TypeFactory::decodeType(), Architecture::decodeVolatile(), ScopeGhidra::dump2Cache(), and ParamListStandard::parseGroup().
|
pure virtual |
Find and parse a specific attribute in the current element as a boolean value.
The set of attributes for the current element is searched for a match to the given attribute id. This attribute is then parsed as a boolean and its value returned. If there is no attribute matching the id, an exception is thrown. Parsing via getNextAttributeId is reset.
| attribId | is the specific attribute id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Parse the current attribute as a boolean value.
The last attribute, as returned by getNextAttributeId, is treated as a boolean, and its value is returned.
Implemented in XmlDecode, and PackedDecode.
Referenced by Database::decode(), ProtoModel::decode(), Funcdata::decode(), GhidraTranslate::decode(), LanguageDescription::decode(), StringManager::decode(), TypeFactory::decode(), FuncProto::decode(), ProtoStoreInternal::decode(), CPoolRecord::decode(), ParamListStandard::decode(), Architecture::decodeAggressiveTrim(), Datatype::decodeBasic(), AddrSpace::decodeBasicAttributes(), Architecture::decodeDynamicRule(), Symbol::decodeHeader(), ScopeInternal::decodeHole(), ScopeGhidra::decodeHole(), InjectPayload::decodePayloadAttributes(), Architecture::decodeStackPointer(), TypeFactory::decodeTypeNoRef(), ScopeLocal::decodeWrappingAttributes(), and TypeFactory::parseEnumConfig().
|
pure virtual |
Find and parse a specific attribute in the current element as a signed integer.
The set of attributes for the current element is searched for a match to the given attribute id. This attribute is then parsed as a signed integer and its value returned. If there is no attribute matching the id, an exception is thrown. Parsing via getNextAttributeId is reset.
| attribId | is the specific attribute id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Parse the current attribute as a signed integer value.
The last attribute, as returned by getNextAttributeId, is treated as a signed integer, and its value is returned.
Implemented in XmlDecode, and PackedDecode.
Referenced by UnionFacetSymbol::decode(), Funcdata::decode(), LoadTable::decode(), LanguageDescription::decode(), OverlaySpace::decode(), TypeFactory::decode(), FuncProto::decode(), Override::decode(), BlockEdge::decode(), ParamEntry::decode(), PcodeOpRaw::decode(), CPoolRecord::decode(), TypeArray::decode(), TypeEnum::decode(), TypePointerRel::decode(), ParamListStandard::decode(), AddrSpace::decodeAttributes(), Datatype::decodeBasic(), AddrSpace::decodeBasicAttributes(), BlockGraph::decodeBody(), TypeFactory::decodeDataOrganization(), Architecture::decodeDeadcodeDelay(), Architecture::decodeFuncPtrAlign(), FlowBlock::decodeHeader(), Symbol::decodeHeader(), PcodeEmit::decodeOp(), InjectPayload::decodePayloadAttributes(), TypeFactory::decodeType(), TypeFactory::parseEnumConfig(), and TypeField::TypeField().
|
pure virtual |
Find the specific attribute in the current element and return it as an address space.
Search attributes from the current element for a match to the given attribute id. Return this attribute as an address space. If there is no attribute matching the id, an exception is thrown. Parse via getNextAttributeId is reset.
| attribId | is the specific attribute id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Parse the current attribute as an address space.
The last attribute, as returned by getNextAttributeId, is returned as an address space.
Implemented in XmlDecode, and PackedDecode.
Referenced by OverlaySpace::decode(), SpacebaseSpace::decode(), SegmentOp::decode(), Override::decode(), PcodeOpRaw::decode(), TypePointer::decode(), TypePointerRel::decode(), TypeSpacebase::decode(), Architecture::decodeDeadcodeDelay(), Range::decodeFromAttributes(), VarnodeData::decodeFromAttributes(), Architecture::decodeSpacebase(), Architecture::decodeStackPointer(), and ScopeLocal::decodeWrappingAttributes().
|
pure virtual |
Find the specific attribute in the current element and return it as a string.
The set of attributes for the current element is searched for a match to the given attribute id. This attribute is then returned as a string. If there is no attribute matching the id, and exception is thrown. Parse via getNextAttributeId is reset.
| attribId | is the specific attribute id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Parse the current attribute as a string.
The last attribute, as returned by getNextAttributeId, is returned as a string.
Implemented in XmlDecode, and PackedDecode.
Referenced by RangeProperties::decode(), Comment::decode(), FunctionSymbol::decode(), ExternRefSymbol::decode(), Database::decode(), ProtoModel::decode(), ProtoModelMerged::decode(), Funcdata::decode(), InjectCallfixupGhidra::decode(), InjectCallotherGhidra::decode(), CompilerTag::decode(), LanguageDescription::decode(), OverlaySpace::decode(), StringManager::decode(), LanedRegister::decode(), TruncationTag::decode(), SegmentOp::decode(), JumpAssistOp::decode(), FuncProto::decode(), Override::decode(), ParamEntry::decode(), ProtoStoreInternal::decode(), CPoolRecord::decode(), TypeEnum::decode(), JoinSpace::decodeAttributes(), Datatype::decodeBasic(), AddrSpace::decodeBasicAttributes(), BlockGraph::decodeBody(), ScopeInternal::decodeCollision(), ContextInternal::decodeContext(), Architecture::decodeDynamicRule(), Architecture::decodeFlowOverride(), Range::decodeFromAttributes(), VarnodeData::decodeFromAttributes(), Symbol::decodeHeader(), OptionDatabase::decodeOne(), InjectPayload::decodeParameter(), InjectPayload::decodePayloadAttributes(), Architecture::decodePreferSplit(), Architecture::decodeProtoEval(), Architecture::decodeSpacebase(), AddrSpaceManager::decodeSpaces(), Architecture::decodeStackPointer(), TypeFactory::decodeType(), TypeFactory::decodeTypedef(), TypeFactory::decodeTypeNoRef(), UserOpManage::decodeVolatile(), and TypeField::TypeField().
|
pure virtual |
Find and parse a specific attribute in the current element as an unsigned integer.
The set of attributes for the current element is searched for a match to the given attribute id. This attribute is then parsed as an unsigned integer and its value returned. If there is no attribute matching the id, an exception is thrown. Parsing via getNextAttributeId is reset.
| attribId | is the specific attribute id to match |
Implemented in XmlDecode, and PackedDecode.
|
pure virtual |
Parse the current attribute as an unsigned integer value.
The last attribute, as returned by getNextAttributeId, is treated as an unsigned integer, and its value is returned.
Implemented in XmlDecode, and PackedDecode.
Referenced by SeqNum::decode(), RangeProperties::decode(), ConstantPoolInternal::CheapSorter::decode(), SymbolEntry::decode(), FunctionSymbol::decode(), EquateSymbol::decode(), Database::decode(), Funcdata::decode(), GhidraTranslate::decode(), TrackedContext::decode(), JumpBasicOverride::decode(), JumpTable::decode(), TruncationTag::decode(), CPoolRecord::decode(), TypePointer::decode(), TypePointerRel::decode(), AddrSpace::decodeAttributes(), JoinSpace::decodeAttributes(), Datatype::decodeBasic(), AddrSpace::decodeBasicAttributes(), ContextInternal::decodeContext(), Range::decodeFromAttributes(), Symbol::decodeHeader(), InjectPayload::decodeParameter(), TypeFactory::decodeType(), TypeFactory::decodeTypedef(), TypeFactory::decodeTypeWithCodeFlags(), ScopeGhidra::dump2Cache(), and Database::parseParentTag().
|
pure virtual |
Reset attribute traversal for the current element.
Attributes for a single element can be traversed more than once using the getNextAttributeId method.
Implemented in XmlDecode, and PackedDecode.
Referenced by ContextInternal::decode(), LanedRegister::decode(), TypePointer::decode(), TypeArray::decode(), TypePointerRel::decode(), VarnodeData::decodeFromAttributes(), ScopeInternal::decodeHole(), ScopeGhidra::decodeHole(), and TypeFactory::decodeTypeNoRef().
|
inline |
Skip parsing of the next element.
The element skipped is the one that would be opened by the next call to openElement.
References closeElementSkipping(), and openElement().
Referenced by ScopeInternal::decode(), ContextGhidra::decode(), and ContextGhidra::decodeFromSpec().