Ghidra Decompiler Analysis Engine
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Architecture Class Referenceabstract

Manager for all the major decompiler subsystems. More...

#include <architecture.hh>

Inheritance diagram for Architecture:
Inheritance graph
[legend]
Collaboration diagram for Architecture:
Collaboration graph
[legend]

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...
 
ProtoModelgetModel (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...
 
AddrSpacegetSpaceBySpacebase (const Address &loc, int4 size) const
 Get space associated with a spacebase register. More...
 
const LanedRegistergetLanedRegister (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...
 
SegmentOpgetSegmentOp (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 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...
 
AddrSpacegetSpaceByName (const string &nm) const
 Get address space by name. More...
 
AddrSpacegetSpaceByShortcut (char sc) const
 Get address space from its shortcut. More...
 
AddrSpacegetIopSpace (void) const
 Get the internal pcode op space. More...
 
AddrSpacegetFspecSpace (void) const
 Get the internal callspec space. More...
 
AddrSpacegetJoinSpace (void) const
 Get the joining space. More...
 
AddrSpacegetStackSpace (void) const
 Get the stack space for this processor. More...
 
AddrSpacegetUniqueSpace (void) const
 Get the temporary register space for this processor. More...
 
AddrSpacegetDefaultCodeSpace (void) const
 Get the default address space of this processor. More...
 
AddrSpacegetDefaultDataSpace (void) const
 Get the default address space where data is stored. More...
 
AddrSpacegetConstantSpace (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...
 
AddrSpacegetSpace (int4 i) const
 Get an address space via its index. More...
 
AddrSpacegetNextSpaceInOrder (AddrSpace *spc) const
 Get the next contiguous address space. More...
 
JoinRecordfindAddJoin (const vector< VarnodeData > &pieces, uint4 logicalsize)
 Get (or create) JoinRecord for pieces. More...
 
JoinRecordfindJoin (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.
 
bool analyze_for_loops
 True if we should attempt conversion of whiledo loops to for loops.
 
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)
 
Databasesymboltab
 Memory map of global variables and functions.
 
ContextDatabasecontext
 Map from addresses to context settings.
 
map< string, ProtoModel * > protoModels
 Parsed forms of possible prototypes.
 
ProtoModeldefaultfp
 Parsed form of default prototype.
 
VarnodeData defaultReturnAddr
 Default storage location of return address (for current function)
 
ProtoModelevalfp_current
 Function proto to use when evaluating current function.
 
ProtoModelevalfp_called
 Function proto to use when evaluating called functions.
 
TypeFactorytypes
 List of types for this binary.
 
const Translatetranslate
 Translation method for this binary.
 
LoadImageloader
 Method for loading portions of binary.
 
PcodeInjectLibrarypcodeinjectlib
 Pcode injection manager.
 
RangeList nohighptr
 Ranges for which high-level pointers are not possible.
 
CommentDatabasecommentdb
 Comments for this architecture.
 
StringManagerstringManager
 Manager of decoded strings.
 
ConstantPoolcpool
 Deferred constant values.
 
PrintLanguageprint
 Current high-level language printer.
 
vector< PrintLanguage * > printlist
 List of high-level language printers supported.
 
OptionDatabaseoptions
 Options that can be configured.
 
vector< TypeOp * > inst
 Registered p-code instructions.
 
UserOpManage userops
 Specifically registered user-defined p-code ops.
 
vector< PreferSplitRecordsplitrecords
 registers that we would prefer to see split for this processor
 
vector< LanedRegisterlanerecords
 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 ScopebuildDatabase (DocumentStorage &store)
 Build the database and global scope for this executable. More...
 
virtual TranslatebuildTranslator (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 PcodeInjectLibrarybuildPcodeInjectLibrary (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...
 
ProtoModelparseProto (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
AddrSpacerestoreXmlSpace (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...
 
JoinRecordfindJoinInternal (uintb offset) const
 Find JoinRecord for offset in the join space. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Architecture()

Architecture::Architecture ( void  )

Construct an uninitialized Architecture.

Set most sub-components to null pointers. Provide reasonable defaults for the configurable options

◆ ~Architecture()

Architecture::~Architecture ( void  )
virtual

Destructor.

Release resources for all sub-components.

Member Function Documentation

◆ addNoHighPtr()

void Architecture::addNoHighPtr ( const Range rng)
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

Parameters
rngis the new range with no aliases to be added

◆ addSpacebase()

void Architecture::addSpacebase ( AddrSpace basespace,
const string &  nm,
const VarnodeData ptrdata,
int4  truncSize,
bool  isreversejustified,
bool  stackGrowth 
)
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

Parameters
basespaceis the address space underlying the stack
nmis the name of the new space
ptrdatais the register location acting as a pointer into the new space
truncSizeis the (possibly truncated) size of the register that fits the space
isreversejustifiedis true if small variables are justified opposite of endianness
stackGrowthis true if a stack implemented in this space grows in the negative direction

◆ buildAction()

void Architecture::buildAction ( DocumentStorage store)
protectedvirtual

Build the Action framework.

This builds the universal Action for function transformation and instantiates the "decompile" root Action

Parameters
storemay hold configuration information

◆ buildCommentDB()

void Architecture::buildCommentDB ( DocumentStorage store)
protectedvirtual

Build the comment database.

Build the container that holds comments for executable in this Architecture.

Parameters
storemay hold configuration information

◆ buildConstantPool()

void Architecture::buildConstantPool ( DocumentStorage store)
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.

Parameters
storemay hold configuration information

◆ buildContext()

void Architecture::buildContext ( DocumentStorage store)
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.

Parameters
storemay hold configuration information

◆ buildDatabase()

Scope * Architecture::buildDatabase ( DocumentStorage store)
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.

Parameters
storeis the storage for any configuration data
Returns
the global Scope object

◆ buildInstructions()

void Architecture::buildInstructions ( DocumentStorage store)
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.

Parameters
storemay hold configuration information

◆ buildLoader()

virtual void Architecture::buildLoader ( DocumentStorage store)
protectedpure virtual

Build the LoadImage object and load the executable image.

Parameters
storemay hold configuration information

◆ buildPcodeInjectLibrary()

virtual PcodeInjectLibrary* Architecture::buildPcodeInjectLibrary ( void  )
protectedpure virtual

Build the injection library.

This creates the container for p-code injections. It is initially empty.

Returns
the PcodeInjectLibrary object

Implemented in SleighArchitecture.

◆ buildSpecFile()

virtual void Architecture::buildSpecFile ( DocumentStorage store)
protectedpure virtual

Load any relevant specification files.

Processor/architecture specific configuration files are loaded into the XML store

Parameters
storeis the document store that will hold the configuration

Implemented in SleighArchitecture.

◆ buildStringManager()

void Architecture::buildStringManager ( DocumentStorage store)
protectedvirtual

Build the string manager.

Build container that holds decoded strings

Parameters
storemay hold configuration information

◆ buildTranslator()

virtual Translate* Architecture::buildTranslator ( DocumentStorage store)
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.

Parameters
storemay hold configuration information
Returns
the Translate object

Implemented in SleighArchitecture.

◆ buildTypegrp()

void Architecture::buildTypegrp ( DocumentStorage store)
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.

Parameters
storecontains possible configuration information

◆ cacheAddrSpaceProperties()

void Architecture::cacheAddrSpaceProperties ( 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.

◆ clearAnalysis()

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.

Parameters
fdis the function to clear

◆ collectBehaviors()

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.

Parameters
behaveis the list to be populated

◆ fillinReadOnlyFromLoader()

void Architecture::fillinReadOnlyFromLoader ( void  )
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

◆ getLanedRegister()

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.

Parameters
locis the starting address of the storage location
sizeis the size of the storage in bytes
Returns
the matching LanedRegister record or null

◆ getMinimumLanedRegisterSize()

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.

Returns
the size in bytes of the smallest laned register or -1.

◆ getModel()

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.

Parameters
nmis the name
Returns
the matching model

◆ getSegmentOp()

SegmentOp * Architecture::getSegmentOp ( AddrSpace spc) const

Retrieve the segment op for the given space if any.

This method searches for a user-defined segment op registered for the given space.

Parameters
spcis the address space to check
Returns
the SegmentOp object or null

◆ getSpaceBySpacebase()

AddrSpace * Architecture::getSpaceBySpacebase ( const Address loc,
int4  size 
) const

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.

Parameters
locis the location of the spacebase register
sizeis the size of the register in bytes
Returns
a pointer to the address space

◆ globalify()

void Architecture::globalify ( void  )

Mark all spaces as global.

Set all IPTR_PROCESSOR and IPTR_SPACEBASE spaces to be global.

◆ hasModel()

bool Architecture::hasModel ( const string &  nm) const

Does this Architecture have a specific PrototypeModel.

Parameters
nmis the name of the model
Returns
true if this Architecture supports a model with that name

◆ highPtrPossible()

bool Architecture::highPtrPossible ( const Address loc,
int4  size 
) const
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.

Parameters
locis the starting address of the range
sizeis the size of the range in bytes
Returns
true if pointers are possible

◆ init()

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.

Parameters
storeis the XML document store

◆ initializeSegments()

void Architecture::initializeSegments ( )
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.

◆ modifySpaces()

virtual void Architecture::modifySpaces ( Translate trans)
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.

Parameters
transis the processor disassembly object

Implemented in SleighArchitecture.

◆ nameFunction()

void Architecture::nameFunction ( const Address addr,
string &  name 
) const
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

Parameters
addris the address of the function
namewill hold the constructed name

◆ parseAggressiveTrim()

void Architecture::parseAggressiveTrim ( const Element el)
protected

Designate how to trim extension p-code ops.

Configure based on the <aggressivetrim> tag, how aggressively the decompiler will remove extension operations.

Parameters
elis the XML element

◆ parseCompilerConfig()

void Architecture::parseCompilerConfig ( DocumentStorage store)
protected

Apply compiler specific configuration.

This looks for the <compiler_spec> tag and sets configuration parameters based on it.

Parameters
storeis the document store holding the tag

◆ parseDeadcodeDelay()

void Architecture::parseDeadcodeDelay ( const Element el)
protected

Apply dead-code delay configuration.

Manually alter the dead-code delay for a specific address space, based on a <deadcodedelay> tag.

Parameters
elis the XML element

◆ parseDefaultProto()

void Architecture::parseDefaultProto ( const Element el)
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.

Parameters
elis the XML element

◆ parseDynamicRule()

void Architecture::parseDynamicRule ( const Element el)
protected

Apply details of a dynamic Rule object.

Recover information out of a <rule> tag and build the new Rule object.

Parameters
elis the XML element

◆ parseExtraRules()

void Architecture::parseExtraRules ( DocumentStorage store)
protected

Apply any Rule tags.

Look for the <experimental_rules> tag and create any dynamic Rule objects it specifies.

Parameters
storeis the document store containing the tag

◆ parseFuncPtrAlign()

void Architecture::parseFuncPtrAlign ( const Element el)
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.

Parameters
elis the XML element

◆ parseGlobal()

void Architecture::parseGlobal ( const Element el)
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.

Parameters
elis the XML element

◆ parseIncidentalCopy()

void Architecture::parseIncidentalCopy ( const Element el)
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.

Parameters
elis the XML element

◆ parseInferPtrBounds()

void Architecture::parseInferPtrBounds ( const Element el)
protected

Apply pointer inference bounds.

Alter the range of addresses for which a pointer is allowed to be inferred.

◆ parseLaneSizes()

void Architecture::parseLaneSizes ( const Element el)
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.

Parameters
elis the XML element

◆ parseNoHighPtr()

void Architecture::parseNoHighPtr ( const Element el)
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.

Parameters
elis the XML element

◆ parsePreferSplit()

void Architecture::parsePreferSplit ( const Element el)
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.

Parameters
elis the XML element

◆ parseProcessorConfig()

void Architecture::parseProcessorConfig ( DocumentStorage store)
protected

Apply processor specific configuration.

This looks for the <processor_spec> tag and and sets configuration parameters based on it.

Parameters
storeis the document store holding the tag

◆ parseProto()

ProtoModel * Architecture::parseProto ( const Element el)
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.

Parameters
elis the XML tag element

◆ parseProtoEval()

void Architecture::parseProtoEval ( const Element el)
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.

Parameters
elis the XML element

◆ parseReadOnly()

void Architecture::parseReadOnly ( const Element el)
protected

Apply read-only region configuration.

This applies info from a <readonly> tag marking a specific region of the executable as read-only.

Parameters
elis the XML element

◆ parseReturnAddress()

void Architecture::parseReturnAddress ( const Element el)
protected

Apply return address configuration.

This applies info from <returnaddress> tag and sets the default storage location for the return address of a function.

Parameters
elis the XML element

◆ parseSpacebase()

void Architecture::parseSpacebase ( const Element el)
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.

Parameters
elis the XML element

◆ parseStackPointer()

void Architecture::parseStackPointer ( const Element el)
protected

Apply stack pointer configuration.

Create a stack space and a stack-pointer register from this <stackpointer> element

Parameters
elis the XML element

◆ parseVolatile()

void Architecture::parseVolatile ( const Element el)
protected

Apply volatile region configuration.

This applies info from a <volatile> tag marking specific regions of the executable as holding volatile memory or registers.

Parameters
elis the XML element

◆ printMessage()

virtual void Architecture::printMessage ( const string &  message) const
pure virtual

Print an error message to console.

Write the given message to whatever the registered error stream is

Parameters
messageis the error message

Implemented in ArchitectureGhidra, and SleighArchitecture.

◆ readLoaderSymbols()

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

Parameters
delimis the delimiter separating namespaces from symbol base names

◆ resetDefaults()

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

◆ restoreFlowOverride()

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.

Parameters
elis the XML element

◆ restoreFromSpec()

void Architecture::restoreFromSpec ( DocumentStorage store)
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

Parameters
storewill hold parsed configuration information

◆ restoreXml()

void Architecture::restoreXml ( DocumentStorage store)
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

Parameters
storeis document store containing the parsed root tag

Reimplemented in BfdArchitecture, RawBinaryArchitecture, and XmlArchitecture.

◆ saveXml()

void Architecture::saveXml ( ostream &  s) const
virtual

Serialize this architecture to XML.

Write the current state of all types, symbols, functions, etc. an XML stream

Parameters
sis the output stream

Reimplemented in BfdArchitecture, RawBinaryArchitecture, and XmlArchitecture.

◆ setDefaultModel()

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.

Parameters
nmis the name of the model to set

◆ setPrintLanguage()

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.

Parameters
nmis the name of the language

◆ setPrototype()

void Architecture::setPrototype ( const PrototypePieces pieces)

Set the prototype for a particular function.

Establish details of the prototype for a given function symbol

Parameters
piecesholds the raw prototype information and the symbol name

The documentation for this class was generated from the following files: