decompiler
1.0.0
|
Manager for all the major decompiler subsystems. More...
#include <architecture.hh>
Public Member Functions | |
Architecture (void) | |
Construct an uninitialized Architecture. More... | |
void | init (DocumentStorage &store) |
Load the image and configure architecture. More... | |
void | resetDefaultsInternal (void) |
Reset default values for options specific to Architecture. | |
void | resetDefaults (void) |
Reset defaults values for options owned by this. More... | |
ProtoModel * | getModel (const string &nm) const |
Get a specific PrototypeModel. More... | |
bool | hasModel (const string &nm) const |
Does this Architecture have a specific PrototypeModel. More... | |
bool | highPtrPossible (const Address &loc, int4 size) const |
Are pointers possible to the given location? More... | |
AddrSpace * | getSpaceBySpacebase (const Address &loc, int4 size) const |
Get space associated with a spacebase register. More... | |
const LanedRegister * | getLanedRegister (const Address &loc, int4 size) const |
Get LanedRegister associated with storage. More... | |
int4 | getMinimumLanedRegisterSize (void) const |
Get the minimum size of a laned register in bytes. More... | |
void | setDefaultModel (const string &nm) |
Set the default PrototypeModel. More... | |
void | clearAnalysis (Funcdata *fd) |
Clear analysis specific to a function. More... | |
void | readLoaderSymbols (const string &delim) |
Read any symbols from loader into database. More... | |
void | collectBehaviors (vector< OpBehavior * > &behave) const |
Provide a list of OpBehavior objects. More... | |
SegmentOp * | getSegmentOp (AddrSpace *spc) const |
Retrieve the segment op for the given space if any. More... | |
void | setPrototype (const PrototypePieces &pieces) |
Set the prototype for a particular function. More... | |
void | setPrintLanguage (const string &nm) |
Establish a particular output language. More... | |
void | globalify (void) |
Mark all spaces as global. More... | |
void | restoreFlowOverride (const Element *el) |
Set flow overrides from XML. More... | |
virtual | ~Architecture (void) |
Destructor. More... | |
virtual string | getDescription (void) const |
Get a string describing this architecture. | |
virtual void | printMessage (const string &message) const =0 |
Print an error message to console. More... | |
virtual void | saveXml (ostream &s) const |
Serialize this architecture to XML. More... | |
virtual void | restoreXml (DocumentStorage &store) |
Restore the Architecture state from an XML stream. More... | |
virtual void | nameFunction (const Address &addr, string &name) const |
Pick a default name for a function. More... | |
Public Member Functions inherited from AddrSpaceManager | |
AddrSpaceManager (void) | |
Construct an empty address space manager. More... | |
virtual | ~AddrSpaceManager (void) |
Destroy the manager. More... | |
int4 | getDefaultSize (void) const |
Get size of addresses for the default space. More... | |
AddrSpace * | getSpaceByName (const string &nm) const |
Get address space by name. More... | |
AddrSpace * | getSpaceByShortcut (char sc) const |
Get address space from its shortcut. More... | |
AddrSpace * | getIopSpace (void) const |
Get the internal pcode op space. More... | |
AddrSpace * | getFspecSpace (void) const |
Get the internal callspec space. More... | |
AddrSpace * | getJoinSpace (void) const |
Get the joining space. More... | |
AddrSpace * | getStackSpace (void) const |
Get the stack space for this processor. More... | |
AddrSpace * | getUniqueSpace (void) const |
Get the temporary register space for this processor. More... | |
AddrSpace * | getDefaultCodeSpace (void) const |
Get the default address space of this processor. More... | |
AddrSpace * | getDefaultDataSpace (void) const |
Get the default address space where data is stored. More... | |
AddrSpace * | getConstantSpace (void) const |
Get the constant space. More... | |
Address | getConstant (uintb val) const |
Get a constant encoded as an Address. More... | |
Address | createConstFromSpace (AddrSpace *spc) const |
Create a constant address encoding an address space. More... | |
Address | resolveConstant (AddrSpace *spc, uintb val, int4 sz, const Address &point, uintb &fullEncoding) const |
Resolve a native constant into an Address. More... | |
int4 | numSpaces (void) const |
Get the number of address spaces for this processor. More... | |
AddrSpace * | getSpace (int4 i) const |
Get an address space via its index. More... | |
AddrSpace * | getNextSpaceInOrder (AddrSpace *spc) const |
Get the next contiguous address space. More... | |
JoinRecord * | findAddJoin (const vector< VarnodeData > &pieces, uint4 logicalsize) |
Get (or create) JoinRecord for pieces. More... | |
JoinRecord * | findJoin (uintb offset) const |
Find JoinRecord for offset in the join space. More... | |
void | setDeadcodeDelay (AddrSpace *spc, int4 delaydelta) |
Set the deadcodedelay for a specific space. More... | |
void | truncateSpace (const TruncationTag &tag) |
Mark a space as truncated from its original size. More... | |
Address | constructFloatExtensionAddress (const Address &realaddr, int4 realsize, int4 logicalsize) |
Build a logically lower precision storage location for a bigger floating point register. More... | |
Address | constructJoinAddress (const Translate *translate, const Address &hiaddr, int4 hisz, const Address &loaddr, int4 losz) |
Build a logical whole from register pairs. More... | |
void | renormalizeJoinAddress (Address &addr, int4 size) |
Make sure a possibly offset join address has a proper JoinRecord. More... | |
Public Attributes | |
string | archid |
ID string uniquely describing this architecture. | |
int4 | trim_recurse_max |
How many levels to let parameter trims recurse. | |
int4 | max_implied_ref |
Maximum number of references to an implied var. | |
int4 | max_term_duplication |
Max terms duplicated without a new variable. | |
int4 | max_basetype_size |
Maximum size of an "integer" type before creating an array type. | |
int4 | min_funcsymbol_size |
Minimum size of a function symbol. | |
bool | aggressive_ext_trim |
Aggressively trim inputs that look like they are sign extended. | |
bool | readonlypropagate |
true if readonly values should be treated as constants | |
bool | infer_pointers |
True if we should infer pointers from constants that are likely addresses. | |
vector< AddrSpace * > | inferPtrSpaces |
Set of address spaces in which a pointer constant is inferable. | |
int4 | funcptr_align |
How many bits of alignment a function ptr has. | |
uint4 | flowoptions |
options passed to flow following engine | |
uint4 | max_instructions |
Maximum instructions that can be processed in one function. | |
int4 | alias_block_level |
Aliases blocked by 0=none, 1=struct, 2=array, 3=all. | |
vector< Rule * > | extra_pool_rules |
Extra rules that go in the main pool (cpu specific, experimental) | |
Database * | symboltab |
Memory map of global variables and functions. | |
ContextDatabase * | context |
Map from addresses to context settings. | |
map< string, ProtoModel * > | protoModels |
Parsed forms of possible prototypes. | |
ProtoModel * | defaultfp |
Parsed form of default prototype. | |
VarnodeData | defaultReturnAddr |
Default storage location of return address (for current function) | |
ProtoModel * | evalfp_current |
Function proto to use when evaluating current function. | |
ProtoModel * | evalfp_called |
Function proto to use when evaluating called functions. | |
TypeFactory * | types |
List of types for this binary. | |
const Translate * | translate |
Translation method for this binary. | |
LoadImage * | loader |
Method for loading portions of binary. | |
PcodeInjectLibrary * | pcodeinjectlib |
Pcode injection manager. | |
RangeList | nohighptr |
Ranges for which high-level pointers are not possible. | |
CommentDatabase * | commentdb |
Comments for this architecture. | |
StringManager * | stringManager |
Manager of decoded strings. | |
ConstantPool * | cpool |
Deferred constant values. | |
PrintLanguage * | |
Current high-level language printer. | |
vector< PrintLanguage * > | printlist |
List of high-level language printers supported. | |
OptionDatabase * | options |
Options that can be configured. | |
vector< TypeOp * > | inst |
Registered p-code instructions. | |
UserOpManage | userops |
Specifically registered user-defined p-code ops. | |
vector< PreferSplitRecord > | splitrecords |
registers that we would prefer to see split for this processor | |
vector< LanedRegister > | lanerecords |
Vector registers that have preferred lane sizes. | |
ActionDatabase | allacts |
Actions that can be applied in this architecture. | |
bool | loadersymbols_parsed |
True if loader symbols have been read. | |
Protected Member Functions | |
void | addSpacebase (AddrSpace *basespace, const string &nm, const VarnodeData &ptrdata, int4 truncSize, bool isreversejustified, bool stackGrowth) |
Create a new space and associated pointer. More... | |
void | addNoHighPtr (const Range &rng) |
Add a new region where pointers do not exist. More... | |
virtual Scope * | buildDatabase (DocumentStorage &store) |
Build the database and global scope for this executable. More... | |
virtual Translate * | buildTranslator (DocumentStorage &store)=0 |
Build the Translator object. More... | |
virtual void | buildLoader (DocumentStorage &store)=0 |
Build the LoadImage object and load the executable image. More... | |
virtual PcodeInjectLibrary * | buildPcodeInjectLibrary (void)=0 |
Build the injection library. More... | |
virtual void | buildTypegrp (DocumentStorage &store) |
Build the data-type factory/container. More... | |
virtual void | buildCommentDB (DocumentStorage &store) |
Build the comment database. More... | |
virtual void | buildStringManager (DocumentStorage &store) |
Build the string manager. More... | |
virtual void | buildConstantPool (DocumentStorage &store) |
Build the constant pool. More... | |
virtual void | buildInstructions (DocumentStorage &store) |
Register the p-code operations. More... | |
virtual void | buildAction (DocumentStorage &store) |
Build the Action framework. More... | |
virtual void | buildContext (DocumentStorage &store) |
Build the Context database. More... | |
virtual void | buildSpecFile (DocumentStorage &store)=0 |
Load any relevant specification files. More... | |
virtual void | modifySpaces (Translate *trans)=0 |
Modify address spaces as required by this Architecture. More... | |
virtual void | postSpecFile (void) |
Let components initialize after Translate is built. | |
virtual void | resolveArchitecture (void)=0 |
Figure out the processor and compiler of the target executable. | |
void | restoreFromSpec (DocumentStorage &store) |
Fully initialize the Translate object. More... | |
void | fillinReadOnlyFromLoader (void) |
Load info about read-only sections. More... | |
void | initializeSegments () |
Set up segment resolvers. More... | |
void | cacheAddrSpaceProperties (void) |
Calculate some frequently used space properties and cache them. More... | |
void | parseProcessorConfig (DocumentStorage &store) |
Apply processor specific configuration. More... | |
void | parseCompilerConfig (DocumentStorage &store) |
Apply compiler specific configuration. More... | |
void | parseExtraRules (DocumentStorage &store) |
Apply any Rule tags. More... | |
void | parseDynamicRule (const Element *el) |
Apply details of a dynamic Rule object. More... | |
ProtoModel * | parseProto (const Element *el) |
Build a proto-type model from an XML tag. More... | |
void | parseProtoEval (const Element *el) |
Apply prototype evaluation configuration. More... | |
void | parseDefaultProto (const Element *el) |
Apply default prototype model configuration. More... | |
void | parseGlobal (const Element *el) |
Apply global space configuration. More... | |
void | addOtherSpace (void) |
Add OTHER space and all of its overlays to the symboltab. | |
void | parseReadOnly (const Element *el) |
Apply read-only region configuration. More... | |
void | parseVolatile (const Element *el) |
Apply volatile region configuration. More... | |
void | parseReturnAddress (const Element *el) |
Apply return address configuration. More... | |
void | parseIncidentalCopy (const Element *el) |
Apply incidental copy configuration. More... | |
void | parseLaneSizes (const Element *el) |
Apply lane size configuration. More... | |
void | parseStackPointer (const Element *el) |
Apply stack pointer configuration. More... | |
void | parseDeadcodeDelay (const Element *el) |
Apply dead-code delay configuration. More... | |
void | parseInferPtrBounds (const Element *el) |
Apply pointer inference bounds. More... | |
void | parseFuncPtrAlign (const Element *el) |
Apply function pointer alignment configuration. More... | |
void | parseSpacebase (const Element *el) |
Create an additional indexed space. More... | |
void | parseNoHighPtr (const Element *el) |
Apply memory alias configuration. More... | |
void | parsePreferSplit (const Element *el) |
Designate registers to be split. More... | |
void | parseAggressiveTrim (const Element *el) |
Designate how to trim extension p-code ops. More... | |
Protected Member Functions inherited from AddrSpaceManager | |
AddrSpace * | restoreXmlSpace (const Element *el, const Translate *trans) |
Add a space to the model based an on XML tag. More... | |
void | restoreXmlSpaces (const Element *el, const Translate *trans) |
Restore address spaces in the model from an XML tag. More... | |
void | setDefaultCodeSpace (int4 index) |
Set the default address space (for code) More... | |
void | setDefaultDataSpace (int4 index) |
Set the default address space for data. More... | |
void | setReverseJustified (AddrSpace *spc) |
Set reverse justified property on this space. More... | |
void | assignShortcut (AddrSpace *spc) |
Select a shortcut character for a new space. More... | |
void | markNearPointers (AddrSpace *spc, int4 size) |
Mark that given space can be accessed with near pointers. More... | |
void | insertSpace (AddrSpace *spc) |
Add a new address space to the model. More... | |
void | copySpaces (const AddrSpaceManager *op2) |
Copy spaces from another manager. More... | |
void | addSpacebasePointer (SpacebaseSpace *basespace, const VarnodeData &ptrdata, int4 truncSize, bool stackGrowth) |
Set the base register of a spacebase space. More... | |
void | insertResolver (AddrSpace *spc, AddressResolver *rsolv) |
Override the base resolver for a space. More... | |
void | setInferPtrBounds (const Range &range) |
Set the range of addresses that can be inferred as pointers. More... | |
JoinRecord * | findJoinInternal (uintb offset) const |
Find JoinRecord for offset in the join space. More... | |
Manager for all the major decompiler subsystems.
An instantiation is tailored to a specific LoadImage, processor, and compiler spec. This class is the owner of the LoadImage, Translate, symbols (Database), PrintLanguage, etc. This class also holds numerous configuration parameters for the analysis process
Architecture::Architecture | ( | void | ) |
Construct an uninitialized Architecture.
Set most sub-components to null pointers. Provide reasonable defaults for the configurable options
References PrintLanguageCapability::buildLanguage(), and PrintLanguageCapability::getDefault().
|
virtual |
Destructor.
Release resources for all sub-components.
|
protected |
Add a new region where pointers do not exist.
This routine is used by the initialization process to add address ranges to which there is never an (indirect) pointer Should only be called during initialization
rng | is the new range with no aliases to be added |
References Range::getFirst(), Range::getLast(), and Range::getSpace().
|
protected |
Create a new space and associated pointer.
This process sets up a "register relative" space for this architecture If the name is "stack", this space takes on the role of an "official" stack space Should only be called once during initialization
basespace | is the address space underlying the stack |
nm | is the name of the new space |
ptrdata | is the register location acting as a pointer into the new space |
truncSize | is the (possibly truncated) size of the register that fits the space |
isreversejustified | is true if small variables are justified opposite of endianness |
stackGrowth | is true if a stack implemented in this space grows in the negative direction |
References AddrSpace::getDelay(), and VarnodeData::space.
|
protectedvirtual |
|
protectedvirtual |
Build the comment database.
Build the container that holds comments for executable in this Architecture.
store | may hold configuration information |
Reimplemented in ArchitectureGhidra.
|
protectedvirtual |
Build the constant pool.
Some processor models (Java byte-code) need a database of constants. The database is always built, but may remain empty.
store | may hold configuration information |
Reimplemented in ArchitectureGhidra.
|
protectedvirtual |
Build the Context database.
This builds the database which holds the status registers setings and other information that can affect disassembly depending on context.
store | may hold configuration information |
Reimplemented in ArchitectureGhidra.
|
protectedvirtual |
Build the database and global scope for this executable.
Create the database object, which currently doesn't not depend on any configuration data. Then create the root (global) scope and attach it to the database.
store | is the storage for any configuration data |
Reimplemented in ArchitectureGhidra.
|
protectedvirtual |
Register the p-code operations.
This registers the OpBehavior objects for all known p-code OpCodes. The Translate and TypeFactory object should already be built.
store | may hold configuration information |
References TypeOp::registerInstructions().
|
protectedpure virtual |
Build the LoadImage object and load the executable image.
store | may hold configuration information |
Implemented in ArchitectureGhidra, BfdArchitecture, RawBinaryArchitecture, and XmlArchitecture.
|
protectedpure virtual |
Build the injection library.
This creates the container for p-code injections. It is initially empty.
Implemented in SleighArchitecture, and ArchitectureGhidra.
|
protectedpure virtual |
Load any relevant specification files.
Processor/architecture specific configuration files are loaded into the XML store
store | is the document store that will hold the configuration |
Implemented in SleighArchitecture, and ArchitectureGhidra.
|
protectedvirtual |
Build the string manager.
Build container that holds decoded strings
store | may hold configuration information |
Reimplemented in ArchitectureGhidra.
|
protectedpure virtual |
Build the Translator object.
This builds the main disassembly component for the Architecture This does not initially the engine for a specific processor.
store | may hold configuration information |
Implemented in SleighArchitecture, and ArchitectureGhidra.
|
protectedvirtual |
Build the data-type factory/container.
This builds the TypeFactory object specific to this architecture and prepopulates it with the core types. Core types may be pulled from the configuration information, or default core types are used.
store | contains possible configuration information |
Reimplemented in ArchitectureGhidra.
References DocumentStorage::getTag(), TYPE_BOOL, TYPE_CODE, TYPE_FLOAT, TYPE_INT, TYPE_UINT, TYPE_UNKNOWN, and TYPE_VOID.
|
protected |
Calculate some frequently used space properties and cache them.
Determine the minimum pointer size for the space and whether or not there are near pointers. Set up an ordered list of inferable spaces (where constant pointers can be infered). Inferable spaces include the default space and anything explicitly listed in the cspec <global> tag that is not a register space. An initial list of potential spaces is passed in that needs to be ordered, filtered, and deduplicated.
References AddrSpace::compareByIndex(), AddrSpace::getDelay(), SegmentOp::getInnerSize(), AddrSpace::getType(), IPTR_SPACEBASE, AddrSpace::isOtherSpace(), and AddrSpace::isOverlay().
void Architecture::clearAnalysis | ( | Funcdata * | fd | ) |
Clear analysis specific to a function.
Throw out the syntax tree, (unlocked) symbols, comments, and other derived information about a single function.
fd | is the function to clear |
References Funcdata::clear(), Funcdata::getAddress(), Comment::warning, and Comment::warningheader.
Referenced by ActionRestartGroup::apply(), and Funcdata::inlineFlow().
void Architecture::collectBehaviors | ( | vector< OpBehavior * > & | behave | ) | const |
Provide a list of OpBehavior objects.
For all registered p-code opcodes, return the corresponding OpBehavior object. The object pointers are provided in a list indexed by OpCode.
behave | is the list to be populated |
References TypeOp::getBehavior().
Referenced by PcodeInjectLibraryGhidra::getBehaviors().
|
protected |
Load info about read-only sections.
The LoadImage may have access information about the executables sections. Query for any read-only ranges and store this information in the property database
References RangeList::begin(), RangeList::end(), and Varnode::readonly.
const LanedRegister * Architecture::getLanedRegister | ( | const Address & | loc, |
int4 | size | ||
) | const |
Get LanedRegister associated with storage.
Look-up the laned register record associated with a specific storage location. Currently, the record is only associated with the size of the storage, not its address. If there is no associated record, null is returned.
loc | is the starting address of the storage location |
size | is the size of the storage in bytes |
References LanedRegister::getWholeSize().
Referenced by Funcdata::checkForLanedRegister().
int4 Architecture::getMinimumLanedRegisterSize | ( | void | ) | const |
Get the minimum size of a laned register in bytes.
Return a size intended for comparison with a Varnode size to immediately determine if the Varnode is a potential laned register. If there are no laned registers for the architecture, -1 is returned.
Referenced by Funcdata::clear(), and Funcdata::Funcdata().
ProtoModel * Architecture::getModel | ( | const string & | nm | ) | const |
Get a specific PrototypeModel.
The Architecture maintains the set of prototype models that can be applied for this particular executable. Retrieve one by name. The model must exist or an exception is thrown.
nm | is the name |
Referenced by FuncProto::restoreXml().
Retrieve the segment op for the given space if any.
This method searches for a user-defined segment op registered for the given space.
spc | is the address space to check |
References AddrSpace::getIndex(), SegmentOp::getResolve(), and VarnodeData::space.
Get space associated with a spacebase register.
Get the address space associated with the indicated spacebase register. I.e. if the location of the stack pointer is passed in, this routine would return a pointer to the stack space. An exception is thrown if no corresponding space is found.
loc | is the location of the spacebase register |
size | is the size of the register in bytes |
References Address::getOffset(), Address::getSpace(), and AddrSpace::getSpacebase().
Referenced by RuleLoadVarnode::correctSpacebase().
void Architecture::globalify | ( | void | ) |
Mark all spaces as global.
Set all IPTR_PROCESSOR and IPTR_SPACEBASE spaces to be global.
References AddrSpace::getHighest(), AddrSpace::getType(), IPTR_PROCESSOR, and IPTR_SPACEBASE.
bool Architecture::hasModel | ( | const string & | nm | ) | const |
Does this Architecture have a specific PrototypeModel.
nm | is the name of the model |
|
inline |
Are pointers possible to the given location?
The Translate object keeps track of address ranges for which it is effectively impossible to have a pointer into. This is used for pointer aliasing calculations. This routine returns true if it is possible to have pointers into the indicated range.
loc | is the starting address of the range |
size | is the size of the range in bytes |
References Address::getSpace(), AddrSpace::getType(), and IPTR_INTERNAL.
void Architecture::init | ( | DocumentStorage & | store | ) |
Load the image and configure architecture.
Create the LoadImage and load the executable to be analyzed. Using this and possibly other initialization information, create all the sub-components necessary for a complete Architecture The DocumentStore may hold previously gleaned configuration information and is used to read in other configuration files while initializing.
store | is the XML document store |
Referenced by RegisterProgram::rawAction(), XmlArchitecture::restoreXml(), RawBinaryArchitecture::restoreXml(), and BfdArchitecture::restoreXml().
|
protected |
Set up segment resolvers.
If any address space supports near pointers and segment operators, setup SegmentedResolver objects that can be used to recover full pointers in context.
References SegmentOp::getSpace().
|
protectedpure virtual |
Modify address spaces as required by this Architecture.
If spaces need to be truncated or otherwise changed from processor defaults, this routine performs the modification.
trans | is the processor disassembly object |
Implemented in SleighArchitecture, and ArchitectureGhidra.
|
virtual |
Pick a default name for a function.
If no better name is available, this method can be used to generate a function name based on its address
addr | is the address of the function |
name | will hold the constructed name |
References Address::printRaw().
|
protected |
Designate how to trim extension p-code ops.
Configure based on the <aggressivetrim> tag, how aggressively the decompiler will remove extension operations.
el | is the XML element |
References Element::getAttributeName(), Element::getAttributeValue(), Element::getNumAttributes(), and xml_readbool().
|
protected |
Apply compiler specific configuration.
This looks for the <compiler_spec> tag and sets configuration parameters based on it.
store | is the document store holding the tag |
References InjectPayload::CALLFIXUP_TYPE, Element::getChildren(), and DocumentStorage::getTag().
|
protected |
Apply dead-code delay configuration.
Manually alter the dead-code delay for a specific address space, based on a <deadcodedelay> tag.
el | is the XML element |
References Element::getAttributeValue().
|
protected |
Apply default prototype model configuration.
There should be exactly one <default_proto> tag that specifies what the default prototype model is. This builds the ProtoModel object and sets it as the default.
el | is the XML element |
References Element::getChildren().
|
protected |
Apply details of a dynamic Rule object.
Recover information out of a <rule> tag and build the new Rule object.
el | is the XML element |
References Element::getAttributeName(), Element::getAttributeValue(), Element::getContent(), and Element::getNumAttributes().
|
protected |
Apply any Rule tags.
Look for the <experimental_rules> tag and create any dynamic Rule objects it specifies.
store | is the document store containing the tag |
References Element::getChildren(), and DocumentStorage::getTag().
|
protected |
Apply function pointer alignment configuration.
Pull information from a <funcptr> tag. Turn on alignment analysis of function pointers, some architectures have aligned function pointers and encode extra information in the unused bits.
el | is the XML element |
References Element::getAttributeValue().
|
protected |
Apply global space configuration.
This handles the <global> tag adding an address space (or part of the space) to the global scope. Varnodes in this region will be assumed to be global variables.
el | is the XML element |
References OverlaySpace::getBaseSpace(), Element::getChildren(), Range::getFirst(), Range::getLast(), Range::getSpace(), AddrSpace::isOverlay(), AddrSpace::isOverlayBase(), and Range::restoreXml().
|
protected |
Apply incidental copy configuration.
Apply information from an <incidentalcopy> tag, which marks a set of addresses as being copied to incidentally. This allows the decompiler to ignore certain side-effects.
el | is the XML element |
References Element::getChildren(), Varnode::incidental_copy, VarnodeData::offset, VarnodeData::restoreXml(), VarnodeData::size, and VarnodeData::space.
|
protected |
Apply pointer inference bounds.
Alter the range of addresses for which a pointer is allowed to be inferred.
References Element::getChildren(), and Range::restoreXml().
|
protected |
Apply lane size configuration.
Look for <register> tags that have a vector_lane_size attribute. Record these so that the decompiler can split large registers into appropriate lane size pieces.
el | is the XML element |
References Element::getChildren(), LanedRegister::getSizeBitMask(), LanedRegister::getWholeSize(), and LanedRegister::restoreXml().
|
protected |
Apply memory alias configuration.
Configure memory based on a <nohighptr> tag. Mark specific address ranges to indicate the decompiler will not encounter pointers (aliases) into the range.
el | is the XML element |
References Element::getChildren(), and Range::restoreXml().
|
protected |
Designate registers to be split.
Configure registers based on a <prefersplit> tag. Mark specific varnodes that the decompiler should automatically split when it first sees them.
el | is the XML element |
References Element::getAttributeValue(), Element::getChildren(), and VarnodeData::restoreXml().
|
protected |
Apply processor specific configuration.
This looks for the <processor_spec> tag and and sets configuration parameters based on it.
store | is the document store holding the tag |
References Element::getChildren(), and DocumentStorage::getTag().
|
protected |
Build a proto-type model from an XML tag.
This handles the <prototype> and <resolveprototype> tags. It builds the ProtoModel object based on the tag and makes it available generally to the decompiler.
el | is the XML tag element |
References Element::getName(), ProtoModel::getName(), and ProtoModel::restoreXml().
|
protected |
Apply prototype evaluation configuration.
This supports the <eval_called_prototype> and <eval_current_prototype> tag. This determines which prototype model to assume when recovering the prototype for a called function and the current function respectively.
el | is the XML element |
References Element::getAttributeValue(), and Element::getName().
|
protected |
Apply read-only region configuration.
This applies info from a <readonly> tag marking a specific region of the executable as read-only.
el | is the XML element |
References Element::getChildren(), Varnode::readonly, and Range::restoreXml().
|
protected |
Apply return address configuration.
This applies info from <returnaddress> tag and sets the default storage location for the return address of a function.
el | is the XML element |
References Element::getChildren().
|
protected |
Create an additional indexed space.
Designate a new index register and create a new address space associated with it, based on a <spacebase> tag.
el | is the XML element |
References Element::getAttributeValue().
|
protected |
Apply stack pointer configuration.
Create a stack space and a stack-pointer register from this <stackpointer> element
el | is the XML element |
References AddrSpace::getAddrSize(), Element::getAttributeName(), Element::getAttributeValue(), Element::getNumAttributes(), AddrSpace::isTruncated(), VarnodeData::size, and xml_readbool().
|
protected |
Apply volatile region configuration.
This applies info from a <volatile> tag marking specific regions of the executable as holding volatile memory or registers.
el | is the XML element |
References Element::getChildren(), Range::restoreXml(), and Varnode::volatil.
|
pure virtual |
Print an error message to console.
Write the given message to whatever the registered error stream is
message | is the error message |
Implemented in ArchitectureGhidra, and SleighArchitecture.
Referenced by ActionReturnSplit::apply(), Action::issueWarning(), Rule::issueWarning(), and ActionPool::processOp().
void Architecture::readLoaderSymbols | ( | const string & | delim | ) |
Read any symbols from loader into database.
Symbols do not necessarily need to be available for the decompiler. This routine loads all the load image knows about into the symbol table
delim | is the delimiter separating namespaces from symbol base names |
References Scope::addFunction(), LoadImageFunc::address, and LoadImageFunc::name.
void Architecture::resetDefaults | ( | void | ) |
Reset defaults values for options owned by this.
Reset options that can be modified by the OptionDatabase. This includes options specific to this class and options under PrintLanguage and ActionDatabase
Referenced by SetOptions::rawAction().
void Architecture::restoreFlowOverride | ( | const Element * | el | ) |
Set flow overrides from XML.
Insert a series of out-of-band flow overrides based on a <flowoverridelist> tag.
el | is the XML element |
References Element::getAttributeValue(), Element::getChildren(), Funcdata::getOverride(), Override::insertFlowOverride(), Address::restoreXml(), and Override::stringToType().
|
protected |
Fully initialize the Translate object.
Once the processor is known, the Translate object can be built and fully initialized. Processor and compiler specific configuration is performed
store | will hold parsed configuration information |
References Translate::initialize(), and Translate::setDefaultFloatFormats().
|
virtual |
Restore the Architecture state from an XML stream.
Read in all the sub-component state from a <save_state> XML tag When adding stuff to this BEWARE: The spec file has already initialized stuff
store | is document store containing the parsed root tag |
Reimplemented in BfdArchitecture, RawBinaryArchitecture, and XmlArchitecture.
References Element::getAttributeValue(), Element::getChildren(), Element::getName(), Element::getNumAttributes(), DocumentStorage::getTag(), and xml_readbool().
Referenced by XmlArchitecture::restoreXml(), RawBinaryArchitecture::restoreXml(), and BfdArchitecture::restoreXml().
|
virtual |
Serialize this architecture to XML.
Write the current state of all types, symbols, functions, etc. an XML stream
s | is the output stream |
Reimplemented in BfdArchitecture, RawBinaryArchitecture, and XmlArchitecture.
References a_v_b().
Referenced by XmlArchitecture::saveXml(), RawBinaryArchitecture::saveXml(), and BfdArchitecture::saveXml().
void Architecture::setDefaultModel | ( | const string & | nm | ) |
Set the default PrototypeModel.
The default model is used whenever an explicit model is not known or can't be determined.
nm | is the name of the model to set |
Referenced by OptionDefaultPrototype::apply().
void Architecture::setPrintLanguage | ( | const string & | nm | ) |
Establish a particular output language.
The decompiler supports one or more output languages (C, Java). This method does the main work of selecting one of the supported languages. In addition to selecting the main PrintLanguage object, this triggers configuration of the cast strategy and p-code op behaviors.
nm | is the name of the language |
References PrintLanguageCapability::buildLanguage(), PrintLanguageCapability::findCapability(), and ArchitectureCapability::getName().
Referenced by OptionSetLanguage::apply().
void Architecture::setPrototype | ( | const PrototypePieces & | pieces | ) |
Set the prototype for a particular function.
Establish details of the prototype for a given function symbol
pieces | holds the raw prototype information and the symbol name |
References Funcdata::getFuncProto(), PrototypePieces::name, Scope::queryFunction(), and FuncProto::setPieces().