|
| ArchitectureGhidra (const string &pspec, const string &cspec, const string &tspec, const string &corespec, istream &i, ostream &o) |
| Construct given specification files and i/o streams. More...
|
|
Document * | getRegister (const string ®name) |
| Retrieve a register description given a name. More...
|
|
string | getRegisterName (const VarnodeData &vndata) |
| Retrieve a register name given its storage location. More...
|
|
Document * | getTrackedRegisters (const Address &addr) |
| Retrieve tracked register values at the given address. More...
|
|
string | getUserOpName (int4 index) |
| Get the name of a user-defined p-code op. More...
|
|
uint1 * | getPcodePacked (const Address &addr) |
| Get p-code for a single instruction. More...
|
|
Document * | getMappedSymbolsXML (const Address &addr) |
| Get symbols associated with the given address. More...
|
|
Document * | getExternalRefXML (const Address &addr) |
| Retrieve a description of an external function. More...
|
|
Document * | getNamespacePath (uint8 id) |
| Get a description of a namespace path. More...
|
|
bool | isNameUsed (const string &nm, uint8 startId, uint8 stopId) |
| Is given name used along namespace path.
|
|
string | getCodeLabel (const Address &addr) |
| Retrieve a label at the given address. More...
|
|
Document * | getType (const string &name, uint8 id) |
| Retrieve a data-type description for the given name and id. More...
|
|
Document * | getComments (const Address &fad, uint4 flags) |
| Retrieve comments for a particular function. More...
|
|
void | getBytes (uint1 *buf, int4 size, const Address &inaddr) |
| Retrieve bytes in the LoadImage at the given address. More...
|
|
Document * | getPcodeInject (const string &name, int4 type, const InjectContext &con) |
| Retrieve p-code to inject for a specific context. More...
|
|
Document * | getCPoolRef (const vector< uintb > &refs) |
| Resolve a constant pool reference. More...
|
|
void | setSendSyntaxTree (bool val) |
| Toggle whether the data-flow and control-flow is emitted as part of the main decompile action. More...
|
|
void | setSendCCode (bool val) |
| Toggle whether the recovered source code is emitted as part of the main decompile action. More...
|
|
void | setSendParamMeasures (bool val) |
| Toggle whether recovered parameter information is emitted as part of the main decompile action. More...
|
|
void | getStringData (vector< uint1 > &buffer, const Address &addr, Datatype *ct, int4 maxBytes, bool &isTrunc) |
| Get string data at a specific address. More...
|
|
virtual void | printMessage (const string &message) const |
| Print an error message to console. More...
|
|
| 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 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...
|
|
| 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...
|
|
|
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)
|
|
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 * | print |
| 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.
|
|
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 void | buildInstructions (DocumentStorage &store) |
| Register the p-code operations. More...
|
|
virtual void | buildAction (DocumentStorage &store) |
| Build the Action framework. More...
|
|
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...
|
|
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...
|
|
An implementation of the Architecture interface and connection to a Ghidra client.
In addition to managing the major pieces of the architecture (LoadImage, Translate, Database, TypeFactory, ContextDatbase, CommentDatabase etc.), this class manages a communication channel between the decompiler and a Ghidra client for a single executable. The protocol supports a simple query/response format with exceptions. On top of the low level protocol, this class manages a higher level interface that performs specific queries, providing addresses, names, and other info as input, and returning an XML document or other structure as a result.
This class overrides the build* methods to produce Architecture components that are also backed by the Ghidra client. These all use this same object to do their communication.
This class acts as a main control point for what information gets sent back to the Ghidra client when it requests the main decompilation action. Generally the decompiler sends back the recovered source representation of the function but optionally it can send back:
- Recovered source code (with mark up)
- Data-flow and control-flow structures
- Local symbol and jump-table information
- Parameter identification information