Action, Rule, and other associates classes supporting transformations on function data-flow.
More...
Action, Rule, and other associates classes supporting transformations on function data-flow.
@ bloc_e
End of a control-flow section.
Definition: prettyprint.hh:300
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3437
virtual void endDocument(int4 id)
End a whole document of output.
Definition: prettyprint.cc:856
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: inject_ghidra.cc:83
bool option_inplace_ops
Set to true if we should use '+=' '&=' etc.
Definition: printc.hh:116
bool inheritsSign(void) const
Return true if the op-code inherits it signedness from its inputs.
Definition: typeop.hh:107
bool convertToBoolean(void)
Convert this to boolean.
Definition: rangeutil.cc:61
bool infer_pointers
True if we should infer pointers from constants that are likely addresses.
Definition: architecture.hh:129
void spacebase(void)
Mark registers that map to a virtual address space.
Definition: funcdata.cc:202
JumpTable * recoverJumpTable(PcodeOp *op, FlowInfo *flow, int4 &failuremode)
Recover destinations for a BRANCHIND by analyzing nearby data and control-flow.
Definition: funcdata_block.cc:559
const Varnode * vn
The implied Varnode.
Definition: printlanguage.hh:180
const Scope * mapScope(const Scope *qpoint, const Address &addr, const Address &usepoint) const
Determine the lowest-level Scope which might contain the given address as a Symbol.
Definition: database.cc:2962
bool lateRestriction(const FuncProto &restrictedProto, vector< Varnode * > &newinput, Varnode *&newoutput)
Update this prototype to match a given (more specialized) prototype.
Definition: fspec.cc:4443
virtual void endVarDecl(int4 id)
End a variable declaration.
Definition: prettyprint.hh:234
An external that can be applied to a ValueSet.
Definition: rangeutil.hh:119
CPUI_FLOAT_NOTEQUAL behavior.
Definition: opbehavior.hh:356
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: action.hh:243
virtual void clearUnlocked(void)=0
Clear all unlocked symbols from this scope.
bool collectCorrectable(const vector< Varnode * > &vlist, list< PcodeOp * > &oplist, vector< int4 > &slotlist, PcodeOp *op)
Check for for p-code op intersections that are correctable.
Definition: merge.cc:690
Information about the INT_AND op-code.
Definition: typeop.hh:431
void spliceBlock(FlowBlock *bl)
Splice given FlowBlock together with its output.
Definition: block.cc:1497
const AddrSpaceManager * manage
Manager of addresses.
Definition: loadimage_xml.hh:31
GhidraDecompCapability(const GhidraDecompCapability &op2)
Not implemented.
int4 power2Divide(int4 n, uint8 divisor, uint8 &q, uint8 &r)
Unsigned division of a power of 2 (upto 2^127) by a 64-bit divisor.
Definition: address.cc:870
void createNewOut(ReplaceOp *rop, uintb mask)
Create a new, non-shadowing, subgraph variable node as an operation output.
Definition: subflow.cc:1028
CPUI_INT_RIGHT behavior.
Definition: opbehavior.hh:269
Datatype * outtype
Return data-type.
Definition: fspec.hh:1130
int4 getPageSize(void) const
Get the number of bytes in a page for this memory bank.
Definition: memstate.hh:74
void buildVnDown(const Varnode *vn)
Add in edges between the given Varnode and any PcodeOp that reads it.
Definition: dynamic.cc:122
Varnode * vn
Varnode input to op, along path.
Definition: funcdata.hh:576
TransformVar * setReplacement(Varnode *vn)
Create and return a placeholder associated with the given Varnode.
Definition: subflow.cc:1719
uintb getTempValue(uintb offset) const
Retrieve a temporary register value directly.
Definition: emulateutil.cc:386
Eliminate ARM/THUMB style masking of the low order bits on function pointers.
Definition: ruleaction.hh:1399
@ rule_oneactperfunc
Makes a change only once per function.
Definition: action.hh:56
void orderBlocks(void)
Definition: block.hh:332
CPUI_INT_ZEXT behavior.
Definition: opbehavior.hh:173
bool hasLocalAlias(Varnode *vn) const
Return true if it looks like the given Varnode is aliased by a pointer.
Definition: varmap.cc:553
void addInEdge(FlowBlock *b, uint4 lab)
Add an edge coming into this.
Definition: block.cc:62
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:978
void clear(void)
Clear this to be an empty container.
Definition: jumptable.cc:914
void markIncidentalCopy(PcodeOp *firstop, PcodeOp *lastop)
Mark any COPY ops in the given range as incidental.
Definition: op.cc:806
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:341
vector< InjectParameter > output
List of output parameters.
Definition: pcodeinject.hh:93
int4 delay
How many passes to delay heritage of this space.
Definition: heritage.hh:88
Symbol * symbol
The Symbol this HighVariable is tied to.
Definition: variable.hh:66
virtual void opFloatMult(const PcodeOp *op)=0
Emit a FLOAT_MULT operator.
int4 trim_recurse_max
How many levels to let parameter trims recurse.
Definition: architecture.hh:122
vector< ProtoModel * > modellist
Constituent models being merged.
Definition: fspec.hh:881
vector< ToOpEdge > opedge
The edges in the sub-graph.
Definition: dynamic.hh:68
An injection payload that uses a Ghidra client to generate the p-code ops.
Definition: inject_ghidra.hh:39
virtual string getRegisterName(AddrSpace *base, uintb off, int4 size) const =0
Get the name of a register given its location.
ParamTrial * trial
Current trial being analyzed for suitability.
Definition: funcdata.hh:604
vector< PcodeOpRaw * > & opcache
The cache of current p-code ops.
Definition: emulate.hh:279
AddrSpaceManager(void)
Construct an empty address space manager.
Definition: translate.cc:178
int4 numParams
Number of input parameters to defining operation.
Definition: rangeutil.hh:130
string id
Unique id for this compiler.
Definition: sleigh_arch.hh:32
A circular buffer template.
Definition: prettyprint.hh:605
Information about the INT_LESS op-code.
Definition: typeop.hh:333
PcodeOp * getEarliestOp(int4 pos) const
Find earliest PcodeOp that has a specific common Varnode as input.
Definition: jumptable.cc:981
virtual void saveXml(ostream &s) const =0
Save any parameters that are not backed by symbols to an XML stream.
MapIterator & operator++(void)
Pre-increment the iterator.
Definition: database.cc:757
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:720
void setupTrivial(void)
Convert this to a trivial model.
Definition: jumptable.cc:1754
const CoverBlock & getCoverBlock(int4 i) const
Get the CoverBlock corresponding to the i-th block.
Definition: cover.cc:251
Perform SubvariableFlow analysis triggered by INT_SEXT.
Definition: ruleaction.hh:1314
virtual void executeBinary(void)=0
Execute a binary arithmetic/logical operation.
virtual void opFloatLess(const PcodeOp *op)
Emit a FLOAT_LESS operator.
Definition: printc.hh:266
uint4 create_index
A unique one-up index assigned to Varnode at its creation.
Definition: varnode.hh:125
virtual void opIntScarry(const PcodeOp *op)
Emit a INT_SCARRY operator.
Definition: printc.hh:245
bool usesSpacebasePtr(void) const
Return true if this LOADs or STOREs from a dynamic spacebase pointer.
Definition: op.hh:209
static int4 readToAnyBurst(istream &s)
Read the next message protocol marker.
Definition: ghidra_arch.cc:62
Varnode * newVarnodeOut(int4 s, const Address &m, PcodeOp *op)
Create a new output Varnode.
Definition: funcdata_varnode.cc:99
void moveCbranch(void)
Remove the other CBRANCH.
Definition: blockaction.cc:2023
Remove PTRSUB operations with mismatched data-type information.
Definition: ruleaction.hh:1038
int4 typeCode
0=pure constant 1=stack relative
Definition: rangeutil.hh:129
@ fixed
A data-type with a fixed size.
Definition: varmap.hh:75
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7336
@ unmerged
Set if part of a multi-entry Symbol but did not get merged with other SymbolEntrys.
Definition: variable.hh:54
Information about the FLOAT_MULT op-code.
Definition: typeop.hh:594
ostream & sout
The output stream to the Ghidra client.
Definition: ghidra_process.hh:74
Scope * scope
The Scope owning this address range.
Definition: database.hh:810
Class for iterating over possible lane sizes.
Definition: transform.hh:92
bool testHardInlineRestrictions(Funcdata *inlinefd, PcodeOp *op, Address &retaddr)
For in-lining using the hard model, make sure some restrictions are met.
Definition: flow.cc:1106
void intersectLikelyTrash(const vector< VarnodeData > &trashlist)
Fold likelytrash locations into this model.
Definition: fspec.cc:2150
Command to flush all symbols associated with a Program (executable)
Definition: ghidra_process.hh:135
Information about the INT_CARRY op-code.
Definition: typeop.hh:383
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:927
BranchPoint * derivedbp
BranchPoint blocker this traces into.
Definition: blockaction.hh:133
OpBehavior * behave
The opcode for this operation.
Definition: pcoderaw.hh:95
virtual Symbol * getCategorySymbol(int4 cat, int4 ind) const
Retrieve a Symbol by index within a specific category.
Definition: database.cc:2672
SymbolEntry * queryByAddr(const Address &addr, const Address &usepoint) const
Get Symbol with matching address.
Definition: database.cc:1153
virtual const string & getName(void) const =0
Get the name of the parameter ("" for return value)
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1501
_valuetype & getValue(const _linetype &pnt)
Get the value object at a point.
Definition: partmap.hh:81
Commute PIECE with INT_AND, INT_OR, and INT_XOR.
Definition: ruleaction.hh:764
Varnode * getNewMulti(PcodeOp *op, BlockBasic *bl)
Create a MULTIEQUAL in the given block that will hold data-flow from the given PcodeOp.
Definition: condexe.cc:557
static SeqNum restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore a SeqNum from parsed XML.
Definition: address.cc:56
AddrSpace(AddrSpaceManager *m, const Translate *t, spacetype tp, const string &nm, uint4 size, uint4 ws, int4 ind, uint4 fl, int4 dl)
Definition: space.cc:39
@ tokenstring
A token representing actual content.
Definition: prettyprint.hh:284
virtual void executeCallother(void)
Standard behavior for a user-defined p-code op.
Definition: emulateutil.cc:246
virtual void findByName(const string &name, vector< Symbol * > &res) const =0
Find a Symbol by name within this Scope.
BfdArchitecture(const string &fname, const string &targ, ostream *estream)
Constructor.
Definition: bfd_arch.cc:122
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1380
string actionstring
The root Action to switch to.
Definition: ghidra_process.hh:204
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1201
SymbolNameTree nametree
The set of Symbol objects, sorted by name.
Definition: database.hh:730
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:330
FlowBlock * getCurrentBounds(FlowBlock **top, FlowBlock *graph)
Return current loop bounds (head and bottom).
Definition: blockaction.cc:90
virtual void resetSizeLockType(TypeFactory *factory)
Clear this parameter's data-type preserving any size-lock.
Definition: fspec.cc:2295
virtual void executeMultiequal(void)
Standard behavior for a MULTIEQUAL (phi-node)
Definition: emulate.cc:296
@ CPUI_FLOAT_ROUND
Round towards nearest.
Definition: opcodes.hh:106
AddrSpace * constantspace
Quick reference to constant space.
Definition: translate.hh:223
virtual const CPoolRecord * getRecord(const vector< uintb > &refs) const
Retrieve a constant pool record (CPoolRecord) given a reference to it.
Definition: cpool.cc:209
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2362
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:351
Documentation for the CircleRange class.
FlowBlock(void)
Construct a block with no edges.
Definition: block.cc:50
uintm getTime(void) const
Get the time field of a sequence number.
Definition: address.hh:129
void xml_escape(ostream &s, const char *str)
Send the given character array to a stream, escaping characters with special XML meaning.
bool operator<(const Range &op2) const
Sorting operator for Ranges.
Definition: address.hh:189
int4 size
Number of content characters or other size information.
Definition: prettyprint.hh:343
uintb switchVarConsume
Bits of the switch variable being consumed.
Definition: jumptable.hh:517
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:144
static PrintCCapability printCCapability
The singleton instance.
Definition: printc.hh:33
list< ReplaceOp > oplist
Storage for subgraph op nodes.
Definition: subflow.hh:88
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:736
void clearInfoList(void)
Reset heritage status for all address spaces.
Definition: heritage.cc:143
int4 rule_index
Iterator over Rules for one OpCode.
Definition: action.hh:263
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4589
@ parameter_patch
Convert a CALL/CALLIND/RETURN/BRANCHIND parameter into logical value.
Definition: subflow.hh:69
virtual int4 getNumVariableTerms(void) const
Get the number of input Varnodes expected.
Definition: userop.hh:213
static void saveTracked(ostream &s, const Address &addr, const TrackedSet &vec)
Save all tracked register values for a specific address to an XML stream.
Definition: globalcontext.cc:69
void clearSymbolLinks(HighVariable *high)
Clear Symbols attached to Varnodes in the given HighVariable.
Definition: funcdata_varnode.cc:927
void printCover(ostream &s) const
Print details of the cover for this (for debug purposes)
Definition: variable.hh:99
virtual void getRegionToChangePoint(vector< uintm * > &res, const Address &addr, int4 num, uintm mask)=0
Grab the context blob(s) starting at the given address up to the first point of change.
TypeArray(int4 n, Datatype *ao)
Construct given an array size and element data-type.
Definition: type.hh:257
@ SIGNED_EXTENSION
The value is promoted using signed extension.
Definition: cast.hh:50
virtual string genericFunctionName(const Address &addr)
Create a generic function name base on the entry point address.
Definition: printc.cc:2874
virtual void getAllRegisters(map< VarnodeData, string > ®list) const =0
Get a list of all register names and the corresponding location.
virtual OpCode assumedExtension(const Address &addr, int4 size, VarnodeData &res) const =0
Get the type of extension and containing parameter for the given storage.
Action(uint4 f, const string &nm, const string &g)
Base constructor for an Action.
Definition: action.cc:25
virtual void endPrefixMapping(const string &prefix)
Finish the current prefix.
Definition: xml.hh:228
partmap< Address, uint4 > flagbaseDefault
Default boolean properties on memory.
Definition: database_ghidra.hh:40
AddrSpace * restoreXmlSpace(const Element *el, const Translate *trans)
Add a space to the model based an on XML tag.
Definition: translate.cc:200
virtual void buildAddresses(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable, vector< LoadTable > *loadpoints) const =0
Construct the explicit list of target addresses (the Address Table) from this model.
bool deadRemovalAllowed(AddrSpace *spc) const
Return true if it is safe to remove dead code.
Definition: heritage.cc:2394
Exception thrown when a prototype can't be modeled properly.
Definition: fspec.hh:28
PcodeOp * cbranch1
CBRANCH at bottom of block1.
Definition: blockaction.hh:249
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore this from an XML stream.
Definition: globalcontext.cc:47
A collection parameter descriptions making up a function prototype.
Definition: fspec.hh:995
const Datatype * ct
A type associated with the token.
Definition: printlanguage.hh:202
BlockBasic * iblock
The block where flow is (unnecessarily) coming together.
Definition: condexe.hh:135
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:830
int4 lcount
Changes not including last call to apply()
Definition: action.hh:78
bool buildStore(PcodeOp *op, int4 numLanes, int4 skipLanes)
Split a given CPUI_STORE operation into a sequence of STOREs of individual lanes.
Definition: subflow.cc:2161
PcodeOp * fallthru(const PcodeOp *op) const
Find the PcodeOp considered a fallthru of the given PcodeOp.
Definition: op.cc:845
void emitCommentFuncHeader(const Funcdata *fd)
Emit comments in the given function's header.
Definition: printc.cc:2788
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3848
virtual void stopComment(int4 id)
End a comment block.
Definition: prettyprint.cc:1121
virtual Symbol * getCategorySymbol(int4 cat, int4 ind) const =0
Retrieve a Symbol by index within a specific category.
static OpToken type_expr_nospace
Type declaration with no space.
Definition: printc.hh:111
void emitPrototypeOutput(const FuncProto *proto, const Funcdata *fd)
Emit the output data-type of a function prototype.
Definition: printc.cc:1807
void processJoins(void)
Split join-space Varnodes up into their real components.
Definition: heritage.cc:1838
FlowBlock * newBlock(void)
Build a new plain FlowBlock.
Definition: block.cc:1559
void setAddresses(const vector< Address > &adtable)
Manually set the address table for this model.
Definition: jumptable.cc:1651
void generateTrueEquation(Varnode *vn, PcodeOp *op, int4 slot, int4 type, const CircleRange &range)
Generate an equation given a true constraint and the input/output Varnodes it affects.
Definition: rangeutil.cc:2052
map< Address, BreakCallBack * > addresscallback
a container of pcode based breakpoints
Definition: emulate.hh:140
The SAX interface for parsing XML documents.
Definition: xml.hh:77
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1402
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6263
Architecture * glb
The underlying Architecture for the program being emulated.
Definition: emulateutil.hh:43
@ namelock
The Name of the Varnode is locked.
Definition: varnode.hh:83
uint4 flags
Varnode-like properties of the symbol.
Definition: database.hh:162
static int4 readUtf16(const uint1 *buf, bool bigend)
Read a 2-byte UTF16 element from a byte array.
Definition: printlanguage.cc:528
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:52
@ p_standard
Standard input parameter model.
Definition: fspec.hh:342
static bool isPossibleAlias(Varnode *vn1, Varnode *vn2, int4 depth)
Check for possible duplicate value.
Definition: coreaction.cc:2814
const CPoolRecord * restoreXmlRecord(const vector< uintb > &refs, const Element *el, TypeFactory &typegrp)
Restore a CPoolRecord given a reference and an XML stream.
Definition: cpool.cc:166
int4 index
An integer identifier for the space.
Definition: space.hh:107
ProtoModel * getModel(const string &nm) const
Get a specific PrototypeModel.
Definition: architecture.cc:171
void setValue(AddrSpace *spc, uintb off, int4 size, uintb cval)
Set a value on the memory state.
Definition: memstate.cc:650
virtual bool checkJoin(const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const
Check if the given two storage locations can represent a single logical parameter.
Definition: fspec.cc:887
void reset(int4 sz)
Resize the context blob, preserving old values.
Definition: globalcontext.cc:261
bool setNZMask(uintb nzmask, int4 size)
Set the range based on a putative mask.
Definition: rangeutil.cc:670
Simplify boolean expressions of the form zext(V) * -1.
Definition: ruleaction.hh:508
@ only_branch
Print only the branch instruction.
Definition: printlanguage.hh:146
Helper class for subsorting on position.
Definition: fspec.hh:120
bool finalJudgement(Varnode *vn)
Determine if the two boolean expressions always produce the same or complementary values.
Definition: condexe.cc:293
vector< Varnode * > inrefs
The ordered list of input Varnodes for this op.
Definition: op.hh:122
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: action.cc:489
void addChild(Element *child)
Add a new child Element to the model, with this as the parent.
Definition: xml.hh:175
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:321
static uint4 lookupEffect(const vector< EffectRecord > &efflist, const Address &addr, int4 size)
Look up an effect from the given EffectRecord list.
Definition: fspec.cc:1854
uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering a constant input value.
Definition: typeop.hh:101
virtual void setTypeLock(bool val)
Toggle the lock on the data-type.
Definition: fspec.cc:2262
virtual void saveXml(ostream &s) const
Serialize this architecture to XML.
Definition: bfd_arch.cc:129
The base class API for emitting a high-level language.
Definition: printlanguage.hh:134
virtual void overrideSizeLockType(Datatype *ct)=0
Change (override) the data-type of a size-locked parameter.
Establish a new root Action for the decompiler.
Definition: options.hh:195
static bool compareJustLoc(const Varnode *a, const Varnode *b)
Compare based on storage location.
Definition: variable.cc:184
void markIndirectCreation(PcodeOp *indop, bool possibleOutput)
Convert CPUI_INDIRECT into an indirect creation.
Definition: funcdata_op.cc:686
void opSetAllInput(PcodeOp *op, const vector< Varnode * > &vvec)
Set all input Varnodes for the given PcodeOp simultaneously.
Definition: funcdata_op.cc:240
The internal sub-range object for the interval map.
Definition: rangemap.hh:75
@ commutative
Order of input parameters does not matter.
Definition: op.hh:83
vector< VarnodeData * > in
Raw varnode inputs to this op.
Definition: pcoderaw.hh:98
MemoryHashOverlay(AddrSpace *spc, int4 ws, int4 ps, int4 hashsize, MemoryBank *ul)
Constructor for hash overlay.
Definition: memstate.cc:600
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1635
void restoreXmlOp(const Element *el, const AddrSpaceManager *trans)
Emit pcode directly from an XML tag.
Definition: translate.cc:884
static int4 doesAndClear(PcodeOp *andop, uintb mask)
Return slot of constant if INT_AND op clears all bits in mask, otherwise -1.
Definition: subflow.cc:40
virtual int4 getBytesConsumed(void) const
Get number of bytes consumed within the address->symbol map.
Definition: database.hh:262
EmulatePcodeCache(Translate *t, MemoryState *s, BreakTable *b)
Pcode cache emulator constructor.
Definition: emulate.cc:329
virtual int4 beginStatement(const PcodeOp *op)
Begin a source code statement.
Definition: prettyprint.cc:122
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8095
void insertNameTree(Symbol *sym)
Insert a Symbol into the nametree.
Definition: database.cc:2571
@ seen_solid1
Indicates a solid movement into anything other than slot 0 occurred.
Definition: funcdata.hh:572
virtual int4 printAssembly(AssemblyEmit &emit, const Address &baseaddr) const =0
Disassemble a single machine instruction.
bool findDups(void)
Search for duplicate conditional expressions.
Definition: blockaction.cc:1892
void addEquation(int4 slot, int4 type, const CircleRange &constraint)
Insert an equation restricting this value set.
Definition: rangeutil.cc:1535
map< MergePair, Varnode * > mergeneed
Map from the MergePair of Varnodes to the merged Varnode.
Definition: blockaction.hh:252
int4 equationTypeCode
Type code of the associated equation.
Definition: rangeutil.hh:183
void setRange(Scope *scope, const RangeList &rlist)
Set the ownership range for a Scope.
Definition: database.cc:2859
void reregisterContext(void)
Reregister context fields for a new executable.
Definition: sleighbase.cc:67
uint4 type
The type of effect.
Definition: fspec.hh:315
PcodeOpTree::const_iterator begin(const Address &addr) const
Start of all PcodeOps at one Address.
Definition: op.cc:881
uint4 count_apply
Number of times apply() made changes.
Definition: action.hh:84
void uniqueHash(const Varnode *root, Funcdata *fd)
Select a unique hash for the given Varnode.
Definition: dynamic.cc:330
Perform final organization of the control-flow structure.
Definition: blockaction.hh:309
~Database(void)
Destructor.
Definition: database.cc:2776
@ returns
This instruction returns to caller.
Definition: op.hh:70
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: coreaction.hh:125
vector< JumpTable * > jumpvec
List of jump-tables for this function.
Definition: funcdata.hh:74
static void findSingleCopy(HighVariable *high, vector< Varnode * > &singlelist)
Find instance Varnodes that copied to from outside the given HighVariable.
Definition: merge.cc:919
TypeOpFloatAdd(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1391
@ outofbounds_present
Indicate we have encountered flow out of the specified range.
Definition: flow.hh:66
int4 getDeadcodeDelay(void) const
Get number of passes before deadcode removal is allowed.
Definition: space.hh:310
virtual void tagType(const char *ptr, syntax_highlight hl, const Datatype *ct)
Emit a data-type identifier.
Definition: prettyprint.cc:1026
const Datatype * getSwitchType(void) const
Get the data-type of the switch variable.
Definition: block.cc:3122
const HeritageInfo * getInfo(AddrSpace *spc) const
Get the heriage status for the given address space.
Definition: heritage.hh:223
@ custom_storage
Parameter storage is custom (not derived from ProtoModel)
Definition: fspec.hh:1157
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:817
virtual ~PrintLanguage(void)
Destructor.
Definition: printlanguage.cc:73
@ call
This instruction calls a subroutine.
Definition: op.hh:69
bool merge(HighVariable *high1, HighVariable *high2, bool isspeculative)
Perform low-level details of merging two HighVariables if possible.
Definition: merge.cc:1377
bool possibleInputParam(const Address &loc, int4 size) const
Does the given storage location make sense as an input parameter.
Definition: fspec.hh:727
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1316
virtual JumpValues * clone(void) const
Clone this iterator.
Definition: jumptable.cc:312
Document * getCPoolRef(const vector< uintb > &refs)
Resolve a constant pool reference.
Definition: ghidra_arch.cc:661
@ mark
Used by many algorithms that need to detect loops or avoid repeats.
Definition: op.hh:82
@ programspecific
Space is specific to a particular loadimage.
Definition: space.hh:80
static int4 oneOffMatch(PcodeOp *op1, PcodeOp *op2)
Return 1 if the two given PcodeOps produce exactly the same value, 0 if otherwise.
Definition: jumptable.cc:640
@ cinv_t
End of an arbitrary (invisible) grouping.
Definition: prettyprint.hh:320
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2854
void restoreXmlHeader(const Element *el)
Restore from XML basic attributes of an executable.
Definition: sleigh_arch.cc:322
virtual void opIntSrem(const PcodeOp *op)=0
Emit a INT_SREM operator.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4859
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6006
virtual void opIntAnd(const PcodeOp *op)=0
Emit a INT_AND operator.
Simplify two sequential INT_SRIGHT: (x s>> #c) s>> #d => x s>> saturate(#c + #d)
Definition: ruleaction.hh:368
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:768
@ persist
Persists after (and before) function.
Definition: varnode.hh:91
virtual void setEmulate(Emulate *emu)
Associate an emulator with all breakpoints in the table.
Definition: emulate.cc:52
Architecture objects that use a Translate object derived from Sleigh.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: double.cc:2865
Abstract class for emitting pcode to an application.
Definition: translate.hh:76
virtual ProtoStore * clone(void) const =0
Clone the entire collection of parameter descriptions.
void switchEdge(FlowBlock *inblock, BlockBasic *outbefore, FlowBlock *outafter)
Switch an outgoing edge from the given source block to flow into another block.
Definition: funcdata_block.cc:960
Varnode * getReplacementRead(PcodeOp *op, BlockBasic *bl)
Find a replacement Varnode for the output of the given PcodeOp that is read in the given block.
Definition: condexe.cc:588
static bool compareByIndex(const AddrSpace *a, const AddrSpace *b)
Compare two spaces by their index.
Definition: space.hh:522
ProtoModel * model
(Optional) model on which prototype is based
Definition: fspec.hh:1128
bool updateType(Datatype *ct, bool lock, bool override)
(Possibly) set the Datatype given various restrictions
Definition: varnode.cc:419
AddrSpace * iopspace
Space for internal pcode op pointers.
Definition: translate.hh:226
map< Address, VisitStat > visited
Map of machine instructions that have been visited so far.
Definition: flow.hh:89
void insertResolver(AddrSpace *spc, AddressResolver *rsolv)
Override the base resolver for a space.
Definition: translate.cc:413
bool isGuarded(const Address &addr) const
Does this guard apply to the given address.
Definition: heritage.cc:666
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1952
virtual void opIntScarry(const PcodeOp *op)=0
Emit a INT_SCARRY operator.
static uintb byteToAddress(uintb val, uint4 ws)
Scale from byte units to addressable units.
Definition: space.hh:496
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)=0
Establish name, data-type, storage of a specific input parameter.
ParamTrial(const Address &ad, int4 sz, int4 sl)
Construct from components.
Definition: fspec.hh:179
bool extension(int4 numLanes, int4 skipLanes, int4 bytePos, int4 size, int4 &resNumLanes, int4 &resSkipLanes) const
Decide if a given subset of lanes can be extended naturally for this description.
Definition: transform.cc:154
Varnode * bool2vn
If the first param to binaryop is defined by BOOL_NEGATE, this is the unnegated Varnode.
Definition: condexe.hh:37
virtual void opPiece(const PcodeOp *op)
Emit a PIECE operator.
Definition: printc.hh:284
int4 origIndex
Original index of trial.
Definition: fspec.hh:847
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1280
virtual void getPage(uintb addr, uint1 *res, int4 skip, int4 size) const
Retrieve data from a memory page.
Definition: memstate.cc:91
virtual PcodeInjectLibrary * buildPcodeInjectLibrary(void)
Build the injection library.
Definition: sleigh_arch.cc:162
A (putative) switch variable Varnode and a constraint imposed by a CBRANCH.
Definition: jumptable.hh:130
Architecture * glb
Architecture associated with the injection.
Definition: pcodeinject.hh:58
int4 index
Unique index assigned (for cross referencing associated Varnode in the InjectContext)
Definition: pcodeinject.hh:36
void refineWrite(Varnode *vn, const Address &addr, const vector< int4 > &refine, vector< Varnode * > &newvn)
Split up an output Varnode based on the given refinement.
Definition: heritage.cc:1396
void pushPrototypeInputs(const FuncProto *proto)
Push input parameters.
Definition: printc.cc:146
virtual void spaces(int4 num, int4 bump=0)
Emit a sequence of space characters as part of source code.
Definition: prettyprint.cc:1145
virtual void setExecuteAddress(const Address &addr)
Set the address of the next instruction to emulate.
Definition: jumptable.cc:131
static bool isArrayType(const Datatype *ct)
Does the given data-type reference a java array.
Definition: printjava.cc:113
virtual PcodeInjectLibrary * buildPcodeInjectLibrary(void)=0
Build the injection library.
ParamActive activeinput
Info for recovering input parameters.
Definition: fspec.hh:1446
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:639
A register or memory register that may be used to pass a parameter or return value.
Definition: fspec.hh:157
virtual void clearAttribute(Symbol *sym, uint4 attr)=0
Clear boolean Varnode properties on a Symbol.
@ modellock
Set if the PrototypeModel is locked for this prototype.
Definition: fspec.hh:1151
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:124
string filename
Name of the loadimage.
Definition: loadimage.hh:73
int4 findStartOp(Varnode *vn)
Return the PcodeOp (within the PathMeld set) that takes the given Varnode as input.
Definition: jumptable.cc:1663
TypeOpCast(TypeFactory *t)
Constructor.
Definition: typeop.cc:1595
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:111
void buildDomSubTree(vector< FlowBlock * > &res, FlowBlock *root) const
Collect nodes from a dominator sub-tree.
Definition: block.cc:1973
void printInfo(ostream &s) const
Print raw attribute info about the Varnode.
Definition: varnode.cc:255
Propagate the input of a COPY to all the places that read the output.
Definition: ruleaction.hh:639
uintb getHighest(void) const
Get the highest byte-scaled address.
Definition: space.hh:339
Toggle whether the disassembly engine is allowed to modify context.
Definition: options.hh:207
void bumpDeadcodeDelay(Varnode *vn)
Increase the heritage delay for the given Varnode and request a restart.
Definition: heritage.cc:2128
Cleanup: Set-up to print string constants.
Definition: ruleaction.hh:1094
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4806
JoinRecord * findJoin(uintb offset) const
Find JoinRecord for offset in the join space.
Definition: translate.cc:679
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:361
map< Address, SizePass > themap
Heritaged addresses mapped to range size and pass number.
Definition: heritage.hh:47
Command to set the root Action used by the decompiler or toggle output components.
Definition: ghidra_process.hh:203
int4 slot
Slot assigned to this trial.
Definition: fspec.hh:174
ExternRefSymbol(Scope *sc, const Address &ref, const string &nm)
Construct given a placeholder address.
Definition: database.cc:722
virtual void setExecuteAddress(const Address &addr)
Set current execution address.
Definition: emulate.cc:432
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:847
virtual void tagOp(const char *ptr, syntax_highlight hl, const PcodeOp *op)
Emit an operation token.
Definition: prettyprint.cc:1008
@ check_cast
Pointer to object, new name in token, new data-type in type.
Definition: cpool.hh:55
TypePointer(void)
Internal constructor for use with restoreXml.
Definition: type.hh:226
A control-flow block built out of sub-components.
Definition: block.hh:270
virtual int4 flipInPlaceTest(vector< PcodeOp * > &fliplist) const
Test normalizing the conditional branch in this.
Definition: block.cc:2254
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:420
JumpTable * findJumpTable(const PcodeOp *op) const
Find a jump-table associated with a given BRANCHIND.
Definition: funcdata_block.cc:440
uint1 * byteData
For string literals, the raw byte data of the string.
Definition: cpool.hh:69
Funcdata & data
The function being analyzed.
Definition: blockaction.hh:240
void clearExitMarks(FlowBlock *graph)
Clear the mark on all the exits to this loop.
Definition: blockaction.cc:423
void setFuncdata(Funcdata *f)
Set the Funcdata object associated with the called function.
Definition: fspec.cc:4016
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:188
@ field_t
A field name for a structured data-type.
Definition: prettyprint.hh:313
Simplify INT_RIGHT canceling PIECE: concat(V,W) >> c => zext(V)
Definition: ruleaction.hh:378
void tagField(const char *ptr, EmitXml::syntax_highlight h, const Datatype *ct, int4 o)
Create an identifier for a field within a structured data-type.
Definition: prettyprint.hh:482
Partition orderPartition
Value sets in iteration order.
Definition: rangeutil.hh:291
A record for caching a Cover intersection test between two HighVariable objects.
Definition: merge.hh:29
void refineRead(Varnode *vn, const Address &addr, const vector< int4 > &refine, vector< Varnode * > &newvn)
Split up a free Varnode based on the given refinement.
Definition: heritage.cc:1362
uintb mask
Bit mask defining the size (modulus) and stop of the range.
Definition: rangeutil.hh:51
Architecture * glb
Owner of the function.
Definition: flow.hh:79
AddrSpace * getBaseSpace(void) const
Get the address space being overlayed.
Definition: space.cc:656
bool tryCallPull(PcodeOp *op, ReplaceVarnode *rvn, int4 slot)
Determine if the given subgraph variable can act as a parameter to the given CALL op.
Definition: subflow.cc:205
bool supportsfarpointer
Is true if the joined pair base:near acts as a far pointer.
Definition: userop.hh:204
CPUI_FLOAT_SQRT behavior.
Definition: opbehavior.hh:436
bool discoverIndexedStackPointers(AddrSpace *spc, vector< PcodeOp * > &freeStores, bool checkFreeStores)
Trace input stack-pointer to any indexed loads.
Definition: heritage.cc:829
virtual void emitBlockGoto(const BlockGoto *bl)
Emit a block ending with a goto statement.
Definition: printc.cc:2379
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:407
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1686
void parseDefaultProto(const Element *el)
Apply default prototype model configuration.
Definition: architecture.cc:770
virtual void opIntNotEqual(const PcodeOp *op)
Emit a INT_NOTEQUAL operator.
Definition: printc.hh:235
RawLoadImage(const string &f)
RawLoadImage constructor.
Definition: loadimage.cc:37
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:667
LoopBody * immed_container
Immediately containing loop body, or NULL.
Definition: blockaction.hh:51
PcodeOp * indirect
CPUI_BRANCHIND linked to this jump-table.
Definition: jumptable.hh:516
void execute(void)
Execute the merge.
Definition: blockaction.cc:2082
void clearInput(void)
Clear all input parameters regardless of lock.
Definition: fspec.cc:3162
TypeOp(TypeFactory *t, OpCode opc, const string &n)
Constructor.
Definition: typeop.cc:150
virtual bool isNameLocked(void) const =0
Is the parameter name locked.
FlowBlock * gototarget
The target FlowBlock of the unstructured edge (if present)
Definition: block.hh:555
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1306
PcodeOp * op
Base MULTIEQUAL op.
Definition: condexe.hh:214
virtual void clearInput(int4 i)=0
Clear the input parameter at the specified slot.
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:241
const LanedRegister * getLanedRegister(const Address &loc, int4 size) const
Get LanedRegister associated with storage.
Definition: architecture.cc:228
TypeOpSegment(TypeFactory *t)
Constructor.
Definition: typeop.cc:1718
static bool newStride(uintb mask, int4 step, int4 oldStep, uint4 rem, uintb &myleft, uintb &myright)
Recalculate range based on new stride.
Definition: rangeutil.cc:101
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3762
bool forceGoto(const Address &pcop, const Address &pcdest)
Force a specific control-flow edge to be marked as unstructured.
Definition: funcdata_block.cc:658
uintb longestFit(const Address &addr, uintb maxsize) const
Find size of biggest Range containing given address.
Definition: address.cc:446
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:501
static void gatherAdditiveBase(Varnode *startvn, vector< AddBase > &addbase)
Gather result Varnodes for all sums that the given starting Varnode is involved in.
Definition: varmap.cc:583
virtual int4 getTableSize(void) const
Return the number of entries in the address table.
Definition: jumptable.hh:444
virtual void opReturn(const PcodeOp *op)
Emit a RETURN operator.
Definition: printc.cc:562
void generateBlocks(void)
Generate basic blocks from the raw control-flow.
Definition: flow.cc:797
virtual void endVarDecl(int4 id)
End a variable declaration.
Definition: prettyprint.cc:115
uint4 count_tests
Number of times this Rule has attempted to apply.
Definition: action.hh:207
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7725
string name
Unique identifier for language capability.
Definition: printlanguage.hh:42
static OpToken dereference
The pointer dereference operator.
Definition: printc.hh:76
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7206
int4 injectid
(If non-negative) id of p-code snippet that should replace this function
Definition: fspec.hh:1170
bool matchflip
True if the compared CBRANCH keys on the opposite boolean value of the root.
Definition: condexe.hh:41
virtual void opFloatAbs(const PcodeOp *op)=0
Emit a FLOAT_ABS operator.
virtual void tagLabel(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a code label identifier.
Definition: prettyprint.cc:1053
Ghidra specific architecture information and connection to a Ghidra client.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6269
void setOutput(VarnodeData *o)
Set the output varnode for this op.
Definition: pcoderaw.hh:174
const Range * getLastSignedRange(AddrSpace *spaceid) const
Get the last Range viewing offsets as signed.
Definition: address.cc:496
Information about the INT_LEFT op-code.
Definition: typeop.hh:447
virtual int4 manualCallFixup(const string &name, const string &snippetstring)=0
Manually add a call-fixup payload given a compilable snippet of p-code source.
~OptionDatabase(void)
Destructor.
Definition: options.cc:84
An in-memory implementation of the ContextDatabase interface.
Definition: globalcontext.hh:256
virtual void buildLabels(Funcdata *fd, vector< Address > &addresstable, vector< uintb > &label, const JumpModel *orig) const
Recover case labels associated with the Address table.
Definition: jumptable.cc:399
A p-code injection library that uses a Ghidra client to generate/compile the injection p-code.
Definition: inject_ghidra.hh:80
bool isOverride(void) const
Return true if this table was manually overridden.
Definition: jumptable.cc:2273
Utilities for merging low-level Varnodes into high-level variables.
virtual void printStatistics(ostream &s) const
Dump statistics to stream.
Definition: action.cc:91
int4 intersect(const CoverBlock &op2) const
Compute intersection with another CoverBlock.
Definition: cover.cc:57
TypePointer(int4 s, Datatype *pt, uint4 ws)
Construct from a size, pointed-to type, and wordsize.
Definition: type.hh:231
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:634
vector< TransformVar * > worklist
Current list of placeholders that still need to be traced.
Definition: subflow.hh:154
~ActionDatabase(void)
Destructor.
Definition: action.cc:950
HighVariable * getHigh(void) const
Get the high-level variable associated with this Varnode.
Definition: varnode.cc:80
Information about the INT_SREM op-code.
Definition: typeop.hh:509
virtual void restoreXml(DocumentStorage &store)
Restore the Architecture state from an XML stream.
Definition: xml_arch.cc:107
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6929
string name
Name of this space.
Definition: space.hh:103
MapIterator(const vector< EntryMap * > *m, vector< EntryMap * >::const_iterator cm, list< SymbolEntry >::const_iterator ci)
Construct iterator at a specific position.
Definition: database.hh:342
bool processNextWork(void)
Extend the subgraph from the next node in the worklist.
Definition: subflow.cc:1243
string target
The language id of the active load-image.
Definition: sleigh_arch.hh:95
OptionDatabase(Architecture *g)
Construct given the owning Architecture.
Definition: options.cc:48
TypeEnum(int4 s, type_metatype m)
Construct from a size and meta-type (TYPE_INT or TYPE_UINT)
Definition: type.hh:288
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:386
A region where processor data is stored.
Definition: space.hh:73
virtual void executeCallother(void)
Standard behavior for a user-defined p-code op.
Definition: jumptable.cc:116
int4 count_leading_zeros(uintb val)
Return the number of leading zero bits in the given value.
Definition: address.cc:743
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:437
void clearBlocks(void)
Clear all basic blocks.
Definition: funcdata_block.cc:32
bool isReadOnly(const Address &addr, int4 size, const Address &usepoint) const
Is the given memory range marked as read-only.
Definition: database.cc:1691
@ typetoken
Emit atom as operator.
Definition: printlanguage.hh:160
CPUI_INT_SDIV behavior.
Definition: opbehavior.hh:299
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1096
CPUI_INT_SREM behavior.
Definition: opbehavior.hh:313
ArchitectureGhidra * ghidra
The connection with the Ghidra client.
Definition: cpool_ghidra.hh:32
vector< Address > addresstable
Raw addresses in the jump-table.
Definition: jumptable.hh:511
type_metatype metain
The metatype of the inputs.
Definition: typeop.hh:157
string name
The local name of the symbol.
Definition: database.hh:159
bool addOp(PcodeOp *op, TransformVar *rvn, int4 slot)
Split given op into its lanes.
Definition: subflow.cc:1466
LoadImageGhidra(ArchitectureGhidra *g)
Constructor.
Definition: loadimage_ghidra.cc:18
Document * openDocument(const string &filename)
Open and parse an XML file.
void assignParameterStorage(const vector< Datatype * > &typelist, vector< ParameterPieces > &res, bool ignoreOutputError)
Calculate input and output storage locations given a function prototype.
Definition: fspec.cc:1825
int4 nonfloatgroup
Group of first entry which is not marked float.
Definition: fspec.hh:497
FlowBlock * getCurrentEdge(int4 &outedge, FlowBlock *graph)
Get the current form of the edge.
Definition: blockaction.cc:25
bool restructure(MapState &state)
Merge hints into a formal Symbol layout of the address space.
Definition: varmap.cc:1042
void fallthru(void)
Process (the next) sequence of instructions in fall-thru order.
Definition: flow.cc:531
virtual MapIterator end(void) const
Ending iterator to mapped SymbolEntrys.
Definition: database.cc:1801
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3652
Address normaddress
Dynamic info for recovering normalized switch variable.
Definition: jumptable.hh:430
int4 bit_transitions(uintb val, int4 sz)
Calculate the number of bit transitions in the sized value.
Definition: address.cc:788
virtual void restoreXml(const Element *el)
Restore this Symbol from an XML stream.
Definition: database.cc:648
int4 bitsize
Number of bits in logical variable.
Definition: subflow.hh:81
VarnodeData baseloc
location data of the base register
Definition: translate.hh:175
The formal commands that can be issued to the decompiler by the Ghidra client.
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:76
RangeList rangetree
Range of data addresses owned by this scope.
Definition: database.hh:416
bool ruleBlockOr(FlowBlock *bl)
Attempt to apply a BlockCondition structure.
Definition: blockaction.cc:1301
void pushBranches(void)
Push the trace through, removing edges as necessary.
Definition: blockaction.cc:976
OpToken * negate
The token representing the negation of this token.
Definition: printlanguage.hh:99
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7657
void emitLocalVarDecls(const Funcdata *fd)
Emit variable declarations for a function.
Definition: printc.cc:1869
Varnode * vn
Varnode being traversed.
Definition: heritage.hh:184
ArchitectureGhidra * glb
Architecture and connection to the Ghidra client.
Definition: ghidra_context.hh:32
Simplify chained SUBPIECE: sub( sub(V,c), d) => sub(V, c+d)
Definition: ruleaction.hh:348
@ CPUI_FLOAT_NAN
Not-a-number test (NaN)
Definition: opcodes.hh:91
void guardStores(const Address &addr, int4 size, vector< Varnode * > &write)
Guard STORE ops in preparation for the renaming algorithm.
Definition: heritage.cc:1169
void setBehavior(OpBehavior *be)
Set the opcode for this op.
Definition: pcoderaw.hh:117
@ insert
Definition: varnode.hh:76
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3079
static void gatherReturnGotos(FlowBlock *parent, vector< FlowBlock * > &vec)
Gather all blocks that have goto edge to a RETURN.
Definition: blockaction.cc:2186
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:837
Address(void)
Create an invalid address.
Definition: address.hh:234
type_metatype enumtype
Default enumeration meta-type (when parsing C)
Definition: type.hh:384
int4 numInput(void) const
Get the number of input varnodes to this op.
Definition: pcoderaw.hh:206
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7731
@ f_whiledo_overflow
Set if the conditional block of a whiledo is too big to print as while(cond) { ...
Definition: block.hh:89
uint4 getWordSize(void) const
Get the addressable unit size.
Definition: space.hh:325
virtual void executeMultiequal(void)=0
Standard behavior for a MULTIEQUAL (phi-node)
Undo distributed operations through INT_AND, INT_OR, and INT_XOR.
Definition: ruleaction.hh:488
uint4 addressSize
Size of an address into this space in bytes.
Definition: space.hh:104
Datatype object representing a pointer.
Definition: type.hh:219
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:328
void opInsert(PcodeOp *op, BlockBasic *bl, list< PcodeOp * >::iterator iter)
Insert the given PcodeOp at specific point in a basic block.
Definition: funcdata_op.cc:148
virtual void executeMultiequal(void)
Standard behavior for a MULTIEQUAL (phi-node)
Definition: emulateutil.cc:94
AddrSpace * space
The address space.
Definition: pcoderaw.hh:34
@ space
No explicitly printed token.
Definition: printlanguage.hh:89
FlowBlock * top
Starting FlowBlock of the edge.
Definition: blockaction.hh:30
VarnodeData unified
Special entry representing entire symbol in one chunk.
Definition: translate.hh:198
virtual bool empty(void) const
Is the container empty of records.
Definition: cpool_ghidra.hh:38
@ CPUI_PIECE
Concatenate.
Definition: opcodes.hh:114
virtual void emitFunctionDeclaration(const Funcdata *fd)
Emit a function declaration.
Definition: printc.cc:2186
Address getAddrBySlot(int4 &slot, int4 sz) const
Calculate the storage address assigned when allocating a parameter of a given size.
Definition: fspec.cc:257
int4 visit(ValueSet *vertex, Partition &part)
Recursively walk the data-flow graph finding partitions.
Definition: rangeutil.cc:1977
An implementation of ConstantPool using a Ghidra client as the backing storage.
Definition: cpool_ghidra.hh:31
virtual void loadFill(uint1 *ptr, int4 size, const Address &addr)
Get data from the LoadImage.
Definition: loadimage_xml.cc:192
bool checkNormalDominance(void) const
Check if the block that defines the normalized switch variable dominates the block containing the swi...
Definition: jumptable.cc:1590
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:369
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:654
virtual const vector< OpBehavior * > & getBehaviors(void)=0
Get the array of op-code behaviors for initializing and emulator.
const vector< OpBehavior * > & inst
Array of behaviors for translating OpCode.
Definition: emulate.hh:281
virtual int4 getMaxLineSize(void) const
Get the current maximum line size.
Definition: prettyprint.hh:185
Simplify expressions associated with optimized division expressions.
Definition: ruleaction.hh:1139
TypeOpFloatSub(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1412
virtual bool isOverride(void) const
Return true if this model was manually overridden.
Definition: jumptable.hh:326
@ nocollapse
This op cannot be collapsed further.
Definition: op.hh:71
Commute PIECE with INT_ZEXT: concat(zext(V),W) => zext(concat(V,W))
Definition: ruleaction.hh:784
int4 getMinimumPtrSize(void) const
Get the minimum pointer size for this space.
Definition: space.hh:352
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4395
static OpToken unary_minus
The unary minus operator.
Definition: printc.hh:73
virtual void clearAllInputs(void)=0
Clear all input parameters (and any backing symbols)
Description of a control-flow block containing PcodeOps.
Definition: block.hh:60
void adjustInputVarnodes(const Address &addr, int4 size)
Adjust input Varnodes contained in the given range.
Definition: funcdata_varnode.cc:370
int4 freezeIteration
The iteration at which all change ceases.
Definition: rangeutil.hh:253
A standard model for passing back return values from a function.
Definition: fspec.hh:541
virtual void postSpecFile(void)
Let components initialize after Translate is built.
Definition: architecture.cc:601
uintb left
Left boundary of the open range [left,right)
Definition: rangeutil.hh:49
void orderRecurse(vector< Datatype * > &deporder, DatatypeSet &mark, Datatype *ct) const
Write out dependency list.
Definition: type.cc:1595
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:495
static void segvHandler(int4 sig)
Handler for a segment violation (SIGSEGV) signal.
Definition: ghidra_arch.cc:27
RawBinaryArchitecture(const string &fname, const string &targ, ostream *estream)
Constructor.
Definition: raw_arch.cc:78
PcodeOpBank & obank
Container for generated p-code.
Definition: flow.hh:81
@ f_goto_goto
(Block ends in) non-structured branch
Definition: block.hh:76
bool emu_halted
Set to true if the emulator is halted.
Definition: emulate.hh:170
static OpToken less_than
The less than operator.
Definition: printc.hh:85
@ docu_b
Start of a document.
Definition: prettyprint.hh:295
void trimOpInput(PcodeOp *op, int4 slot)
Trim the input HighVariable of the given PcodeOp so that its Cover is tiny.
Definition: merge.cc:581
Symbol * dump2Cache(Document *doc) const
Parse a response into the cache.
Definition: database_ghidra.cc:117
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:605
list< PcodeOp * > useroplist
List of user-defined PcodeOps.
Definition: op.hh:251
Varnode * find(int4 s, const Address &loc, const Address &pc, uintm uniq=~((uintm) 0)) const
Find a Varnode.
Definition: varnode.cc:1064
The partmap<> template mapping a linear space to value objects.
static PrintLanguageCapability * getDefault(void)
Retrieve the default language capability.
Definition: printlanguage.cc:25
vector< SegmentOp * > segmentop
Segment operations supported by this Architecture.
Definition: userop.hh:253
Information about the FLOAT_DIV op-code.
Definition: typeop.hh:587
virtual void restoreXml(const Element *el)=0
Restore this Scope from a <scope> XML tag.
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:1011
bool iblock2posta_true
Does true branch go to path post a.
Definition: condexe.hh:138
void copySpaces(const AddrSpaceManager *op2)
Copy spaces from another manager.
Definition: translate.cc:387
Varnode * newUnique(int4 s, Datatype *ct=(Datatype *) 0)
Create a new temporary Varnode.
Definition: funcdata_varnode.cc:81
Search for and remove various forms of redundant CBRANCH operations.
Definition: condexe.hh:172
virtual uintm * getDefaultValue(void)
Retrieve the memory region holding all default context values.
Definition: globalcontext.hh:284
Definition: paramid.hh:21
static void collectSpecFiles(ostream &errs)
Gather specification files in normal locations.
Definition: sleigh_arch.cc:301
tag_type tagtype
Type of token.
Definition: prettyprint.hh:326
static OpToken array_expr
Array adornment for a type declaration.
Definition: printc.hh:113
static OpToken addressof
The address of operator.
Definition: printc.hh:75
virtual void emitBlockCopy(const BlockCopy *bl)=0
Emit a basic block (with any labels)
@ synt_t
Other unspecified syntax.
Definition: prettyprint.hh:316
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:584
virtual void executeCallother(void)=0
Standard behavior for a user-defined p-code op.
void cutDownMultiequals(BlockBasic *exit, int4 in1, int4 in2)
Substitute new joined Varnode in the given exit block.
Definition: blockaction.cc:1961
int4 compareOrder(const PcodeOp *bop) const
Compare the control-flow order of this and bop.
Definition: op.cc:606
bool hasUnimplemented(void) const
Does this function have instructions marked as unimplemented.
Definition: funcdata.hh:196
static void processMultiplier(Varnode *vn, int4 max)
For a given multi-descendant Varnode, decide if it should be explicit.
Definition: coreaction.cc:2677
int4 instanceIndex(const Varnode *vn) const
Find the index of a specific Varnode member.
Definition: variable.cc:440
void processHighDominantCopy(HighVariable *high)
Try to replace COPYs into the given HighVariable with a single dominant COPY.
Definition: merge.cc:1206
Memory storage/state for a single AddressSpace.
Definition: memstate.hh:36
uintb first
Starting offset of the current valid range.
Definition: globalcontext.hh:313
AddrSpace * space
The address space this record describes.
Definition: heritage.hh:87
@ opar_t
Open parenthesis.
Definition: prettyprint.hh:317
void execute(void)
Eliminate the unnecessary path join at iblock.
Definition: condexe.cc:824
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1819
virtual void opFloatRound(const PcodeOp *op)
Emit a FLOAT_ROUND operator.
Definition: printc.hh:281
void opSetOutput(PcodeOp *op, Varnode *vn)
Set a specific output Varnode for the given PcodeOp.
Definition: funcdata_op.cc:68
void setSeqNum(const Address &a, uintm b)
Set the sequence number.
Definition: pcoderaw.hh:147
void calcMultiequals(const vector< Varnode * > &write)
Calculate blocks that should contain MULTIEQUALs for one address range.
Definition: heritage.cc:1996
@ break_action
Break if a change has been made.
Definition: action.hh:74
virtual void endReturnType(int4 id)
End a return type declaration.
Definition: prettyprint.hh:232
Action which checks if restart (sub)actions have been generated and restarts itself.
Definition: action.hh:171
long adjustvma
The amount to adjust the virtual memory address.
Definition: xml_arch.hh:35
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7006
virtual void opFloatEqual(const PcodeOp *op)=0
Emit a FLOAT_EQUAL operator.
virtual int4 startIndent(void)
Start a new indent level.
Definition: prettyprint.cc:1154
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:74
Simplify trivial shifts: V << 0 => V, V << #64 => 0
Definition: ruleaction.hh:558
bool ruleBlockCat(FlowBlock *bl)
Attempt to apply a BlockList structure.
Definition: blockaction.cc:1264
ProtoModel * evalfp_current
Function proto to use when evaluating current function.
Definition: architecture.hh:140
void setJumptableRecovery(bool val)
Toggle whether this is being used for jump-table recovery.
Definition: funcdata.hh:141
CircleRange range
The range constraint.
Definition: rangeutil.hh:123
void saveXml(ostream &s) const
Save this to an XML stream as a <prototype> tag.
Definition: fspec.cc:3640
const _valuetype & bounds(const _linetype &pnt, _linetype &before, _linetype &after, int &valid) const
Get the value object for a given point and return the range over which the value object applies.
Definition: partmap.hh:172
Pull-back SUBPIECE through INDIRECT.
Definition: ruleaction.hh:237
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1154
A key for looking up child symbol scopes within a parent, based on name.
Definition: database.hh:383
BlockMultiGoto * newBlockMultiGoto(FlowBlock *bl, int4 outedge)
Build a new BlockMultiGoto.
Definition: block.cc:1620
CPUI_INT_2COMP behavior.
Definition: opbehavior.hh:226
Architecture * glb
The underlying Architecture for the program being emulated.
Definition: emulateutil.hh:112
bool isexit
Does this case flow to the exit block.
Definition: block.hh:641
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1743
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:269
@ CPUI_CPOOLREF
Recover a value from the constant pool.
Definition: opcodes.hh:121
uintb pcode_left(uintb val, int4 sa)
Definition: address.hh:482
bool printCharacterConstant(ostream &s, const Address &addr, int4 charsize) const
Print a quoted (unicode) string at the given address.
Definition: printc.cc:1248
virtual int4 oneInstruction(PcodeEmit &emit, const Address &baseaddr) const =0
Transform a single machine instruction into pcode.
bool restrictedByConditional(const FlowBlock *cond) const
Check if the condition from the given block holds for this block.
Definition: block.cc:381
void buildTypeStack(const Datatype *ct, vector< const Datatype * > &typestack)
Prepare to push components of a data-type declaration.
Definition: printc.cc:120
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:586
virtual void getRangeList(AddrSpace *spc, RangeList &res) const =0
For a given address space, collect all the parameter locations within that space.
string name
Low-level name of p-code operator.
Definition: userop.hh:38
virtual int4 getMaxLineSize(void) const
Get the current maximum line size.
Definition: prettyprint.hh:768
Varnode * setInput(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: varnode.cc:982
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1368
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: action.cc:860
Collapse constants in logical expressions: (V & c) & d => V & (c & d)
Definition: ruleaction.hh:151
virtual void tagComment(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a comment string as part of the generated source code.
Definition: prettyprint.cc:259
bool isLoopDAGIn(int4 i) const
Is the i-th incoming edge part of the DAG sub-graph.
Definition: block.hh:252
OverlaySpace(AddrSpaceManager *m, const Translate *t)
Constructor.
Definition: space.cc:648
@ status_end
getFuncdata has completed once (for onceperfunc)
Definition: action.hh:67
uintb a
The first integer in a reference.
Definition: cpool.hh:167
int4 collapseInternal(FlowBlock *targetbl)
The main collapsing loop.
Definition: blockaction.cc:1748
int4 maxrestarts
Maximum number of restarts allowed.
Definition: action.hh:172
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:559
vector< TruncationTag > truncations
Address space truncations required by this processor.
Definition: sleigh_arch.hh:61
void tagLine(int4 indent)
Create a line break token with special indentation.
Definition: prettyprint.hh:582
Table and function for computing a CRC32.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7290
virtual Funcdata * resolveExternalRefFunction(ExternRefSymbol *sym) const =0
Convert an external reference to the referenced function.
@ compare_patch
Turn compare op inputs into logical values.
Definition: subflow.hh:68
virtual void buildSpecFile(DocumentStorage &store)
Load any relevant specification files.
Definition: ghidra_arch.cc:248
uint4 wordsize
What size unit does the pointer address.
Definition: type.hh:223
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely input prototype.
Definition: fspec.hh:653
@ no_branch
Do not print branch instruction.
Definition: printlanguage.hh:145
@ rule_debug
Print debug messages specifically for this action.
Definition: action.hh:57
uintb getSize(void) const
Get the size of this range.
Definition: rangeutil.cc:254
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: coreaction.hh:92
virtual int4 getNumInputs(void) const
Get the number of input parameters for this prototype.
Definition: fspec.cc:2656
static void findDups(const vector< BlockEdge > &ref, vector< FlowBlock * > &duplist)
Find blocks that are at the end of multiple edges.
Definition: block.cc:477
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:250
vector< Varnode * > vnlist
The indexed set of variables, one for each reference to the stack-pointer.
Definition: coreaction.cc:33
vector< ProtoParameter * > inparam
Cache of allocated input parameters.
Definition: fspec.hh:1083
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore this RangeList from an XML stream.
Definition: address.cc:554
virtual Datatype * findById(const string &n, uint8 id)
Search by name and id.
Definition: typegrp_ghidra.cc:19
SeqNum(Address::mach_extreme ex)
Create an extremal sequence number.
Definition: address.cc:41
virtual bool isSubpieceCast(Datatype *outtype, Datatype *intype, uint4 offset) const =0
Is truncating an input data-type, producing an output data-type, considered a cast.
virtual bool isNameUsed(const string &name) const =0
Check if the given name is used within this scope.
static BfdArchitectureCapability bfdArchitectureCapability
The singleton instance.
Definition: bfd_arch.hh:26
int4 delay
Delay in heritaging this space.
Definition: space.hh:108
void setSendParamMeasures(bool val)
Toggle whether recovered parameter information is emitted as part of the main decompile action.
Definition: ghidra_arch.hh:123
void printInfo(ostream &s) const
Print information about this HighVariable to stream.
Definition: variable.cc:410
virtual bool checkFreeze(const ValueSet &valueSet)=0
Check if the given value set has been frozen for the remainder of the iteration process.
map< VarnodeData, string > varnode_xref
A map from Varnodes in the register space to register names.
Definition: sleighbase.hh:32
PcodeOpTree::const_iterator beginOpAll(void) const
Start of all (alive) PcodeOp objects sorted by sequence number.
Definition: funcdata.hh:467
PcodeOp * target(const Address &addr) const
Return first p-code op for instruction at given address.
Definition: flow.cc:113
union TokenSplit::@22 ptr_second
Additional markup associated with the token.
virtual const VarnodeData & getSpacebase(int4 i) const
Get a base register that creates this virtual space.
Definition: space.hh:455
int4 overlap(int4 skip, const Address &op, int4 size) const
Determine how two address ranges overlap.
Definition: address.cc:147
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7677
void parseDeadcodeDelay(const Element *el)
Apply dead-code delay configuration.
Definition: architecture.cc:955
A special form of ValueSet associated with the read point of a Varnode.
Definition: rangeutil.hh:176
static void registerInstructions(vector< OpBehavior * > &inst, const Translate *trans)
Build all pcode behaviors.
Definition: opbehavior.cc:22
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely return value for this prototype.
Definition: fspec.hh:1304
virtual void setTypeLock(bool val)=0
Toggle the lock on the data-type.
virtual bool emitScopeVarDecls(const Scope *scope, int4 cat)=0
Emit all the variable declarations for a given scope.
int4 alignment
Byte modulo on which instructions are aligned.
Definition: translate.hh:297
JumpTable * jump
Definition: block.hh:631
const Datatype * parent
The parent data-type owning the field.
Definition: printc.hh:48
@ defnouse
Trial is definitely not used.
Definition: fspec.hh:162
void restoreXml(const Element *el, Architecture *glb)
Read in override commands from XML.
Definition: override.cc:349
@ CPUI_INT_NEGATE
Logical/bitwise negation (~)
Definition: opcodes.hh:66
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:174
virtual void findUnnormalized(uint4 maxaddsub, uint4 maxleftright, uint4 maxext)
Recover the unnormalized switch variable.
Definition: jumptable.cc:1605
Split the epilog code of the function.
Definition: blockaction.hh:322
virtual void getAllRegisters(map< VarnodeData, string > ®list) const
Get a list of all register names and the corresponding location.
Definition: ghidra_translate.hh:48
virtual const uintm * getContext(const Address &addr) const =0
Get the context blob of values associated with a given address.
The lowest level error generated by the decompiler.
Definition: error.hh:44
virtual void opFloatNan(const PcodeOp *op)
Emit a FLOAT_NAN operator.
Definition: printc.hh:268
int4 numCurrentOps(void) const
Return number of pcode ops in translation of current instruction.
Definition: emulate.hh:338
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:672
int4 minsize
Minimum bytes allowed for the logical value.
Definition: fspec.hh:69
Document * getRegister(const string ®name)
Retrieve a register description given a name.
Definition: ghidra_arch.cc:372
Exception for encountering unimplemented pcode.
Definition: translate.hh:35
virtual int4 allocateInject(const string &sourceName, const string &name, int4 type)
Allocate a new InjectPayload object.
Definition: inject_ghidra.cc:149
Space for storing internal PcodeOp pointers as addresses.
Definition: op.hh:32
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6013
@ CPUI_FLOAT_LESS
Floating-point comparison, less-than (<)
Definition: opcodes.hh:88
virtual bool sanityCheck(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable)
Perform a sanity check on recovered addresses.
Definition: jumptable.hh:488
virtual JumpModel * clone(JumpTable *jt) const
Clone this model.
Definition: jumptable.cc:2074
void queryCall(FuncCallSpecs &fspecs)
Try to recover the Funcdata object corresponding to a given call.
Definition: flow.cc:642
static string normalizeEndian(const string &nm)
Try to recover a language id endianess field.
Definition: sleigh_arch.cc:345
int4 numpasses
Number of attempts at evaluating parameters.
Definition: fspec.hh:227
@ ptrcheck
The Varnode value is NOT a pointer.
Definition: varnode.hh:116
int4 intersect(const Cover &op2) const
Characterize the intersection between this and another Cover.
Definition: cover.cc:267
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:445
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:471
int4 getInIndex(const FlowBlock *bl) const
Get the incoming edge index for the given FlowBlock.
Definition: block.cc:549
Assign initial high-level HighVariable objects to each Varnode.
Definition: coreaction.hh:327
int4 numgroup
Number of groups in this parameter convention.
Definition: fspec.hh:493
XmlArchitectureCapability & operator=(const XmlArchitectureCapability &op2)
Not implemented.
virtual void opBranch(const PcodeOp *op)
Emit a BRANCH operator.
Definition: printc.cc:378
void metatype2string(type_metatype metatype, string &res)
Convert type meta-type to name.
Definition: type.cc:129
const ParamTrial & getTrialForInputVarnode(int4 slot) const
Get trial corresponding to the given input Varnode.
Definition: fspec.hh:1536
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:518
virtual void resolveArchitecture(void)=0
Figure out the processor and compiler of the target executable.
TypeEnum(int4 s, type_metatype m, const string &nm)
Construct from a size, meta-type, and name.
Definition: type.hh:290
void switchOver(const FlowInfo &flow)
Convert absolute addresses to block indices.
Definition: jumptable.cc:2354
virtual void opIntRight(const PcodeOp *op)=0
Emit a INT_RIGHT operator.
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2601
@ CPUI_FLOAT_LESSEQUAL
Floating-point comparison, less-than-or-equal (<=)
Definition: opcodes.hh:89
PriorityQueue pq
Priority queue for phi-node placement.
Definition: heritage.hh:211
bool deadRemovalAllowedSeen(AddrSpace *spc)
Check if dead code removal is safe and mark that removal has happened.
Definition: heritage.cc:2408
int4 paramshift
Number of parameters shifted in the original call.
Definition: pcodeinject.hh:91
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:442
virtual void executeCallother(void)
Execute breakpoint for this user-defined op.
Definition: emulate.cc:421
void detachScope(ScopeMap::iterator iter)
Detach a child Scope from this.
Definition: database.cc:821
uint4 extraflags
Varnode flags specific to the storage location.
Definition: database.hh:71
ParamEntry(type_metatype t, int4 grp, int4 grpsize, const Address &loc, int4 sz, int4 mnsz, int4 align, bool normalstack)
Construct entry from components.
Definition: fspec.cc:38
virtual void opInt2Comp(const PcodeOp *op)=0
Emit a INT_2COMP operator.
int4 read(const string &s)
Read in the address from a string.
Definition: address.hh:288
static void sortCapabilities(void)
Sort extensions.
Definition: architecture.cc:69
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:507
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7593
virtual void closeParen(char c, int4 id)
Emit a close parenthesis.
Definition: prettyprint.hh:260
virtual void emitBlockWhileDo(const BlockWhileDo *bl)
Emit a loop structure, check at top.
Definition: printc.cc:2542
static Sleigh * last_sleigh
Last Translate object used by a SleighArchitecture.
Definition: sleigh_arch.hh:90
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2681
ostream & sout
Output stream for interfacing with Ghidra.
Definition: ghidra_arch.hh:62
string commentfill
Used to fill comments if line breaks are forced.
Definition: prettyprint.hh:712
static void lookForFuncParamNames(Funcdata &data, const vector< Varnode * > &varlist)
Collect potential variable names from sub-function parameters.
Definition: coreaction.cc:2388
Compare two Varnode pointers by location then definition.
Definition: varnode.hh:34
OptionDatabase * options
Options that can be configured.
Definition: architecture.hh:151
@ hiddenretparm
Does this varnode point to the return value storage location.
Definition: varnode.hh:106
ProtoStore * store
Storage interface for parameters.
Definition: fspec.hh:1165
VarnodeLocSet::const_iterator beginLoc(int4 s, const Address &addr) const
Start of Varnodes with given storage.
Definition: funcdata.hh:316
map< uintb, BreakCallBack * > pcodecallback
a container of addressed based breakpoints
Definition: emulate.hh:141
void getNameSegments(vector< string > &vec) const
Get the fullname of this in segments.
Definition: database.cc:1361
list< PcodeOp * >::const_iterator beginOpAlive(void) const
Start of PcodeOp objects in the alive list.
Definition: funcdata.hh:455
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:629
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1391
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.hh:765
Casting strategies that are specific to the Java language.
Definition: cast.hh:178
@ chartype
ASCII character data.
Definition: type.hh:72
Datatype * defaultType
The default data-type to use for RangeHints.
Definition: varmap.hh:150
list< PcodeOp * >::const_iterator iter
Iterator to current descendant being enumerated.
Definition: coreaction.hh:1028
void buildVnUp(const Varnode *vn)
Add in the edge between the given Varnode and its defining PcodeOp.
Definition: dynamic.cc:106
@ ignore
Mark-up that doesn't affect pretty printing.
Definition: prettyprint.hh:290
Classes related to basic blocks and control-flow structuring.
map< string, VarnodeData > nm2addr
Mapping from register name to Varnode.
Definition: ghidra_translate.hh:36
uint4 getAddrSize(void) const
Get the size of the space.
Definition: space.hh:333
Address constructJoinAddress(const Translate *translate, const Address &hiaddr, int4 hisz, const Address &loaddr, int4 losz)
Build a logical whole from register pairs.
Definition: translate.cc:750
ProtoStoreInternal(Datatype *vt)
Constructor.
Definition: fspec.cc:2596
virtual void opCbranch(const PcodeOp *op)
Definition: printc.cc:394
@ CPUI_INT_DIV
Integer division, unsigned (/)
Definition: opcodes.hh:74
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:369
void setThisPointer(bool val)
Toggle the this-call setting for this prototype.
Definition: fspec.hh:1246
TypePointer * getTypePointer(int4 s, Datatype *pt, uint4 ws)
Construct a pointer data-type.
Definition: type.cc:1756
@ inherits_sign_zero
Only inherits sign from first operand, not the second.
Definition: typeop.hh:41
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:896
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1514
bool operator<(const PEntry &op2) const
Compare PEntry objects by slot.
Definition: fspec.hh:854
string buildDefaultName(Symbol *sym, int4 &base, Varnode *vn) const
Create a default name for the given Symbol.
Definition: database.cc:1651
ParamList * input
Resource model for input parameters.
Definition: fspec.hh:620
const string & getFileName(void) const
Get the name of the LoadImage.
Definition: loadimage.hh:125
int4 processOp(PcodeOp *op, Funcdata &data)
Apply the next possible Rule to a PcodeOp.
Definition: action.cc:805
void emitPrototypeInputs(const FuncProto *proto)
Emit the input data-types of a function prototype.
Definition: printc.cc:1835
virtual Translate * buildTranslator(DocumentStorage &store)
Build the Translator object.
Definition: ghidra_arch.cc:293
void setFull(int4 size)
Set a completely full range.
Definition: rangeutil.cc:243
Perform SubfloatFlow analysis triggered by FLOAT_FLOAT2FLOAT.
Definition: ruleaction.hh:1327
void setBaseRegister(const VarnodeData &data, int4 origSize, bool stackGrowth)
Set the base register at time space is created.
Definition: translate.cc:65
TypeOpIntMult(TypeFactory *t)
Constructor.
Definition: typeop.cc:1234
const Range * getLastRange(void) const
Get the last Range.
Definition: address.cc:482
virtual void overrideSizeLockType(Datatype *ct)
Change (override) the data-type of a size-locked parameter.
Definition: fspec.cc:2283
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:646
Base class for a command to the decompiler as issued by a Ghidra client.
Definition: ghidra_process.hh:71
vector< string > value
a (corresponding) list of attribute values for this element
Definition: xml.hh:154
void setInputErrors(bool val)
Toggle the input error setting for this prototype.
Definition: fspec.hh:1273
int4 matchCallCount
Number of calls to this sub-function within the calling function.
Definition: fspec.hh:1445
void sortAlias(void) const
Sort the alias starting offsets.
Definition: varmap.cc:568
VarnodeLocSet::const_iterator endLoc(AddrSpace *spaceid) const
Ending of Varnodes in given address space sorted by location.
Definition: varnode.cc:1172
virtual ProtoParameter * getInput(int4 i)
Get the i-th input parameter (or NULL if it doesn't exist)
Definition: fspec.cc:2535
A class for uniquely labelling and comparing PcodeOps.
Definition: address.hh:111
ContextDatabase * context
Map from addresses to context settings.
Definition: architecture.hh:136
@ CPUI_FLOAT_NEG
Floating-point negation (-)
Definition: opcodes.hh:97
CPUI_BOOL_OR behavior.
Definition: opbehavior.hh:341
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7651
Datatype * getBase(int4 s, type_metatype m)
Get atomic type.
Definition: type.cc:1679
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2606
@ mark
Prevents infinite loops.
Definition: varnode.hh:71
int4 fillinExtrapop(void)
Recover and return the extrapop for this function.
Definition: funcdata.cc:490
list< PcodeOp * >::const_iterator endDead(void) const
End of all PcodeOps marked as dead.
Definition: op.hh:300
XmlArchitecture(const string &fname, const string &targ, ostream *estream)
Constructor.
Definition: xml_arch.cc:85
virtual string getArchType(void) const
Get a string indicating the architecture type.
Definition: loadimage_xml.hh:47
Collapse constants in an additive or multiplicative expression.
Definition: ruleaction.hh:689
Classes for disassembly and pcode generation.
bool sextrestrictions
Check for logical variables that are always sign extended into their container.
Definition: subflow.hh:84
virtual uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering the input value.
Definition: opbehavior.cc:241
Information about the MULTIEQUAL op-code.
Definition: typeop.hh:671
bool computeTypeCode(void)
Figure out if this value set is absolute or relative.
Definition: rangeutil.cc:1553
bool paramshiftModifyStop(Funcdata &data)
Throw out any paramshift parameters.
Definition: fspec.cc:4924
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:653
VarnodeDefSet::const_iterator endDef(void) const
End of all Varnodes sorted by definition address.
Definition: funcdata.hh:339
ArchitectureGhidra * glb
The owning Architecture and connection to the client.
Definition: loadimage_ghidra.hh:30
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:584
int4 calcDepth(const FlowBlock *leaf) const
Get the depth of the given component FlowBlock.
Definition: block.cc:344
@ is_override
Set if this prototype is created to override a single call site.
Definition: fspec.hh:1162
void forceExclusionGroup(ParamActive *active) const
Enforce exclusion rules for the given set of parameter trials.
Definition: fspec.cc:711
A function Symbol referring to an external location.
Definition: database.hh:296
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:707
uintb dedupId
A duplication id for the Scope.
Definition: database.hh:385
virtual PcodeOp * getStartOp(void) const
Get the PcodeOp associated with the current value.
Definition: jumptable.cc:362
LabSymbol * addCodeLabel(const Address &addr, const string &nm)
Create a code label at the given address in this Scope.
Definition: database.cc:1604
string type
The name of the Java exception class.
Definition: ghidra_arch.hh:34
void saveXml(ostream &s) const
Save this Range to an XML stream.
Definition: address.cc:264
PcodeOp * op
PcodeOp constructing the boolean value.
Definition: ruleaction.hh:1354
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1297
string processorspec
Name of .pspec file.
Definition: sleigh_arch.hh:56
virtual int4 getSize(void) const =0
Get the number of bytes occupied by this parameter.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:726
@ smallsize_sext
Assume values that are below the max size are sign extended into this container.
Definition: fspec.hh:54
TypePointer(const TypePointer &op)
Construct from another TypePointer.
Definition: type.hh:229
const OpToken * token
Operator used to drill-down to the field.
Definition: printc.hh:46
~BranchPoint(void)
BranchPoint owns its BlockTraces.
Definition: blockaction.cc:569
VarnodeLocSet::const_iterator endLoc(int4 s, const Address &addr) const
End of Varnodes with given storage.
Definition: funcdata.hh:319
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:466
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2556
virtual void removeSymbolMappings(Symbol *symbol)
Remove all SymbolEntrys from the given Symbol.
Definition: database_ghidra.hh:104
const Scope * findDistinguishingScope(const Scope *op2) const
Find first ancestor of this not shared by given scope.
Definition: database.cc:1422
virtual void resolveArchitecture(void)
Figure out the processor and compiler of the target executable.
Definition: ghidra_arch.cc:361
virtual void markLabelBumpUp(bool bump)
Let hierarchical blocks steal labels of their (first) components.
Definition: block.cc:2955
const uint1 * restorePackedOp(const Address &addr, const uint1 *ptr, const AddrSpaceManager *trans)
Emit pcode directly from a packed byte stream.
Definition: translate.cc:974
void setFlags(uint4 fl)
Set a cached attribute.
Definition: space.hh:249
void registerTag(const Element *el)
Register the given XML Element object under its tag name.
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:194
bool valid
Full tree search was performed.
Definition: ruleaction.hh:40
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:704
bool option_hide_exts
Set to true if we should hide implied extension operations.
Definition: printc.hh:120
uint4 hash(uint4 reg) const
Hash this edge into an accumulator.
Definition: dynamic.cc:89
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:271
EntrySubsort(const EntrySubsort &op2)
Copy constructor.
Definition: database.hh:100
void clearVisitCount(void)
Clear the visit count in all node FlowBlocks.
Definition: block.cc:1833
virtual void allowContextSet(bool val) const
Toggle whether disassembly is allowed to affect context.
Definition: translate.hh:346
virtual bool doAddressBreak(const Address &addr)
Invoke any breakpoints for the given address.
Definition: emulate.cc:87
static void selectJavaOperators(vector< TypeOp * > &inst, bool val)
Toggle Java specific aspects of the op-code information.
Definition: typeop.cc:112
static const int4 MAX_STEP
Definition: rangeutil.hh:113
CPUI_FLOAT_LESS behavior.
Definition: opbehavior.hh:364
list< PcodeOp * > op
The sequence of p-code operations.
Definition: block.hh:365
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8168
void restoreXml(const Element *el, TypeFactory &typegrp)
Restore object from XML stream.
Definition: cpool.cc:77
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:699
int4 invert(void)
Convert to complementary range.
Definition: rangeutil.cc:531
virtual void getAllRegisters(map< VarnodeData, string > ®list) const
Get a list of all register names and the corresponding location.
Definition: sleighbase.cc:129
bool removeUnreachableBlocks(bool issuewarning, bool checkexistence)
Remove any unreachable basic blocks.
Definition: funcdata_block.cc:341
Collapse INT_EQUAL and INT_NOTEQUAL: f(V,W) == f(V,W) => true
Definition: ruleaction.hh:201
Special AddrSpace for special/user-defined address spaces.
Definition: space.hh:186
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3659
bool highPtrPossible(const Address &loc, int4 size) const
Are pointers possible to the given location?
Definition: architecture.hh:303
virtual void opIntSub(const PcodeOp *op)=0
Emit a INT_SUB operator.
Classes for reducing/splitting Varnodes containing smaller logical values.
uint8 nextUniqueId
Next available symbol id.
Definition: database.hh:735
FlowBlock * getPathStart(int4 i)
Get the start of the i-th BlockTrace.
Definition: blockaction.cc:534
Datatype * restoreXmlType(const Element *el)
Restore Datatype from XML.
Definition: type.cc:1920
@ reverse_justification
Justification within aligned word is opposite of endianness.
Definition: space.hh:81
Class for performing a single transformation on a PcodeOp or Varnode.
Definition: action.hh:192
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:429
Architecture that reads executable files using GNU BFD libraries.
Definition: bfd_arch.hh:38
virtual bool emitsXml(void) const
Determine if this is an XML markup emitter.
Definition: prettyprint.hh:262
const CircleRange * getLandMark(void) const
Get any landmark range.
Definition: rangeutil.cc:1728
This class is a record in a database used to store and lookup potential names.
Definition: coreaction.hh:460
Simplify another expression associated with optimized division.
Definition: ruleaction.hh:1151
PcodeOp * replacement
The new op.
Definition: subflow.hh:55
A prototype model made by merging together other models.
Definition: fspec.hh:880
RangeList nohighptr
Ranges for which high-level pointers are not possible.
Definition: architecture.hh:146
void addRule(Rule *rl)
Add a Rule to the pool.
Definition: action.cc:723
virtual int4 beginFuncProto(void)
Begin a function prototype declaration.
Definition: prettyprint.cc:980
An implementation of the TypeFactory interface, query a Ghidra client for data-type information.
Definition: typegrp_ghidra.hh:30
void truncateIndirectJump(PcodeOp *op, int4 failuremode)
Treat indirect jump as indirect call that never returns.
Definition: flow.cc:720
void clear(void)
Clear instance specific data for this jump-table.
Definition: jumptable.cc:2570
virtual PrintLanguage * buildLanguage(Architecture *glb)
Build the main PrintLanguage object corresponding to this capability.
Definition: printjava.cc:31
int4 getPayloadId(int4 type, const string &nm) const
Map name and type to the payload id.
Definition: pcodeinject.cc:252
const ParamEntry * entry
PrototypeModel entry matching this trial.
Definition: fspec.hh:175
@ pop_solid
Backtracking, from path with successful, solid, movement, via COPY, LOAD, or other arith/logical.
Definition: funcdata.hh:600
virtual void emitBlockLs(const BlockList *bl)=0
Emit a sequence of blocks.
@ hide_thisparam
Do not print the 'this' parameter in argument lists.
Definition: printlanguage.hh:152
list< SymbolEntry >::const_iterator curiter
Current SymbolEntry being iterated.
Definition: database.hh:333
vector< FlowBlock * > rootlist
List of root FlowBlocks to trace from.
Definition: blockaction.hh:155
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:281
void erase(typename std::list< _recordtype >::iterator v)
Erase a given record from the container.
Definition: rangemap.hh:281
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3932
void buildADT(void)
Build the augmented dominator tree.
Definition: heritage.cc:1873
virtual void executeNew(void)
Standard behavior for (low-level) NEW op.
Definition: emulateutil.cc:142
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1845
static OpToken modulo
The modulo operator.
Definition: printc.hh:80
virtual void renameSymbol(Symbol *sym, const string &newname)
Rename a Symbol within this Scope.
Definition: database.cc:2020
virtual void tagVariable(const char *ptr, syntax_highlight hl, const Varnode *vn, const PcodeOp *op)
Emit a variable token.
Definition: prettyprint.cc:999
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1917
@ param_color
Function parameters.
Definition: prettyprint.hh:94
VarnodeLocSet::const_iterator endLoc(AddrSpace *spaceid) const
End of Varnodes stored in a given address space.
Definition: funcdata.hh:307
void attachScope(Scope *child)
Attach a new child Scope to this.
Definition: database.cc:801
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:288
virtual void saveXml(ostream &s) const
Save any parameters that are not backed by symbols to an XML stream.
Definition: fspec.cc:2583
uintb maximumOffset
Maximum offset of the LOAD.
Definition: heritage.hh:111
Document * getTrackedRegisters(const Address &addr)
Retrieve tracked register values at the given address.
Definition: ghidra_arch.cc:414
virtual void opIntSext(const PcodeOp *op, const PcodeOp *readOp)
Emit a INT_SEXT operator.
Definition: printc.cc:607
A helper class for describing the similarity of the boolean condition between 2 CBRANCH operations.
Definition: condexe.hh:33
uintm getOrder(void) const
Get the order field of a sequence number.
Definition: address.hh:132
PcodeOpTree optree
The main sequence number sort.
Definition: op.hh:246
void saveXmlTree(ostream &s) const
Save an XML description of the p-code tree to stream.
Definition: funcdata.cc:636
A helper class to mark up predicated INT_OR expressions.
Definition: condexe.hh:213
void calcLoop(void)
Calculate loop edges.
Definition: block.cc:1997
FlowBlock * finishblock
Designated exit block for the DAG (or null)
Definition: blockaction.hh:161
virtual string makeNameUnique(const string &nm) const =0
Produce a version of the given symbol name that won't collide with other names in this Scope.
@ CPUI_INT_ADD
Addition, signed or unsigned (+)
Definition: opcodes.hh:60
virtual void restoreXmlBody(List::const_iterator &iter, List::const_iterator enditer, BlockMap &resolver)
Restore details about this FlowBlock from an XML stream.
Definition: block.hh:183
SegmentOp * segop
The segment operator.
Definition: architecture.hh:285
void setDefaults(Architecture *glb)
Create any required operations if they weren't explicitly defined.
Definition: userop.cc:333
bool isLeftJustified(void) const
Is the logical value left-justified within its container.
Definition: fspec.hh:76
void parseCallOtherFixup(const Element *el, Architecture *glb)
Parse a <callotherfixup> XML tag.
Definition: userop.cc:467
virtual bool addressCallback(const Address &addr)
Call back method for address based breakpoints.
Definition: emulate.hh:115
void parseCompilerConfig(DocumentStorage &store)
Apply compiler specific configuration.
Definition: architecture.cc:1113
int4 arraysize
Number of elements in the array.
Definition: type.hh:249
virtual void postSpecFile(void)
Let components initialize after Translate is built.
Definition: raw_arch.cc:71
AddrSpace * getConstantSpace(void) const
Get the constant space.
Definition: translate.hh:507
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7683
virtual bool isReversible(void) const
Return true if the current value can be reversed to get a label.
Definition: jumptable.hh:195
An overlay space.
Definition: space.hh:238
@ f_mark2
A secondary mark.
Definition: block.hh:82
virtual bool isCharacterConstant(const uint1 *buf, int4 size, int4 charsize) const
Decide is the given byte array looks like a character string.
Definition: printc.cc:1953
static bool compareFinalOrder(const FlowBlock *bl1, const FlowBlock *bl2)
Final FlowBlock comparison.
Definition: block.cc:665
void mergeRangeMust(VarnodeLocSet::const_iterator startiter, VarnodeLocSet::const_iterator enditer)
Force the merge of a ranges of Varnodes with the same size and storage address.
Definition: merge.cc:234
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1212
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:672
static void buildLocaltypes(Funcdata &data)
Assign initial data-type based on local info.
Definition: coreaction.cc:4054
bool zeroPathIsTrue
True if path to zero set is the true path out of condBlock.
Definition: condexe.hh:220
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:350
int4 perform(Funcdata &data)
Perform this action (if necessary)
Definition: action.cc:290
Address getAddr(void) const
Get the location of the varnode as an address.
Definition: pcoderaw.hh:85
Base class for error handling facilities.
map< Address, uint4 > flowoverride
Override the CALL <-> BRANCH.
Definition: override.hh:56
virtual void getReadonly(RangeList &list) const
Return list of readonly address ranges.
Definition: loadimage.hh:184
bool contains(const ParamEntry &op2) const
Does this contain the indicated entry.
Definition: fspec.cc:63
vector< UserPcodeOp * > useroplist
Description objects indexed by CALLOTHER constant id.
Definition: userop.hh:251
Information about the BOOL_NEGATE op-code.
Definition: typeop.hh:517
CPUI_FLOAT_ABS behavior.
Definition: opbehavior.hh:428
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl)
Construct a token with no associated data-flow annotations.
Definition: printlanguage.hh:207
bool isbigendian
Set to true if this processor is big-endian.
Definition: sleigh_arch.hh:51
virtual void emitLineComment(int4 indent, const Comment *comm)
Emit a comment line.
Definition: printlanguage.cc:699
virtual void markLabelBumpUp(bool bump)
Let hierarchical blocks steal labels of their (first) components.
Definition: block.cc:2918
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1057
string getUserOpName(int4 index)
Get the name of a user-defined p-code op.
Definition: ghidra_arch.cc:432
int4 pass
Pass when the range was heritaged.
Definition: heritage.hh:32
bool isOtherSpace(void) const
Return true if this is the other address space.
Definition: space.hh:429
Toggle whether too many instructions in one function body is considered a fatal error.
Definition: options.hh:231
string getCodeLabel(const Address &addr)
Retrieve a label at the given address.
Definition: ghidra_arch.cc:515
Address refaddr
The placeholder address for meta-data.
Definition: database.hh:297
@ CPUI_INT_SDIV
Integer division, signed (/)
Definition: opcodes.hh:75
void addContent(const char *str, int4 start, int4 length)
Append new character content to this element.
Definition: xml.hh:168
SleighBase(void)
Construct an uninitialized translator.
Definition: sleighbase.cc:20
virtual void printRaw(ostream &s) const
Print a description of the type to stream.
Definition: type.cc:960
void orderParameters(void)
Assign an index to parameters.
Definition: pcodeinject.cc:44
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6160
virtual void findUnnormalized(uint4 maxaddsub, uint4 maxleftright, uint4 maxext)=0
Recover the unnormalized switch variable.
Scope * reresolveScope(const vector< string > &path) const
Find the Scope that will contain a result Symbol.
Definition: database_ghidra.cc:63
static OpToken typecast
The type cast operator.
Definition: printc.hh:77
void endDocument(int4 id)
Create an "end document" command.
Definition: prettyprint.hh:358
@ f_entry_point
Official entry point of the function.
Definition: block.hh:83
virtual void opBoolXor(const PcodeOp *op)=0
Emit a BOOL_XOR operator.
ProtoModel * selectModel(ParamActive *active) const
Select the best model given a set of trials.
Definition: fspec.cc:2217
virtual void executeCallother(void)
Standard behavior for a user-defined p-code op.
Definition: emulate.cc:290
virtual void buildCommentDB(DocumentStorage &store)
Build the comment database.
Definition: ghidra_arch.cc:343
virtual void opIntXor(const PcodeOp *op)
Emit a INT_XOR operator.
Definition: printc.hh:249
Funcdata & data
The function containing the Varnodes to be merged.
Definition: merge.hh:81
void restoreXml(const Element *el)
Restore this node from an XML stream.
Definition: userop.cc:84
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:288
bool isCpoolTransformed(void) const
Return true if we have already examined this cpool.
Definition: op.hh:206
void manualCallOtherFixup(const string &useropname, const string &outname, const vector< string > &inname, const string &snippet, Architecture *glb)
Manually install an InjectedUserOp given just names of the user defined op and the p-code snippet.
Definition: userop.cc:506
int4 byteDataLen
The number of bytes in the data for a string literal.
Definition: cpool.hh:70
Definition: prefersplit.hh:30
virtual Datatype * getSubType(uintb off, uintb *newoff) const
Recover component data-type one-level down.
Definition: type.cc:86
void forceInactiveChain(ParamActive *active, int4 maxchain, int4 start, int4 stop) const
Enforce rules about chains of inactive slots.
Definition: fspec.cc:778
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:329
void opUnsetOutput(PcodeOp *op)
Remove output Varnode from the given PcodeOp.
Definition: funcdata_op.cc:50
@ CPUI_INT_SUB
Subtraction, signed or unsigned (-)
Definition: opcodes.hh:61
virtual void executeBranch(void)
Standard behavior for a BRANCH.
Definition: emulateutil.cc:202
static FlowBlock * findCommonBlock(FlowBlock *bl1, FlowBlock *bl2)
Find the common dominator of two FlowBlocks.
Definition: block.cc:692
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:240
virtual void closeGroup(int4 id)
End a group of things that are printed together.
Definition: prettyprint.cc:1102
vector< VarnodeData > likelytrash
Storage locations potentially carrying trash values.
Definition: fspec.hh:623
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:677
virtual void pushSymbol(const Symbol *sym, const Varnode *vn, const PcodeOp *op)=0
Push a specific Symbol onto the RPN stack.
virtual void opFloatSub(const PcodeOp *op)
Emit a FLOAT_SUB operator.
Definition: printc.hh:272
ReplaceVarnode * output
Varnode output.
Definition: subflow.hh:58
virtual uintb getSize(void) const
Return the number of values the variables can take.
Definition: jumptable.cc:322
vector< string > userop
Names of user-define p-code ops for this Translate object.
Definition: sleighbase.hh:31
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:937
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:63
void emitStructDefinition(const TypeStruct *ct)
Emit the definition of a structure data-type.
Definition: printc.cc:1724
map< string, int4 > callFixupMap
Map of registered call-fixup names to injection id.
Definition: pcodeinject.hh:167
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:480
A loop structure where the condition is checked at the bottom.
Definition: block.hh:599
const char * get_opname(OpCode opc)
Convert an OpCode to the name as a string.
Definition: opcodes.cc:58
void checkExitBlock(BlockBasic *exit, int4 in1, int4 in2)
Look for additional Varnode pairs in an exit block that need to be merged.
Definition: blockaction.cc:1934
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1071
bool adjustFit(RangeHint &a) const
Make the given RangeHint fit in the current Symbol map.
Definition: varmap.cc:429
void emitSwitchCase(int4 casenum, const BlockSwitch *switchbl)
Emit labels for a case block.
Definition: printc.cc:2675
@ CPUI_EXTRACT
Extract a bit-range.
Definition: opcodes.hh:124
Scope * discoverScope(const Address &addr, int4 sz, const Address &usepoint)
Find the owning Scope of a given memory range.
Definition: database.cc:1255
vector< BlockEdge > intothis
Blocks which (can) fall into this block.
Definition: block.hh:114
int4 numspaces
Number of spaces in a whitespace token (tokenbreak)
Definition: prettyprint.hh:342
void addToCodeList(PcodeOp *op)
Add given PcodeOp to specific op-code list.
Definition: op.cc:623
A control-flow edge between blocks (FlowBlock)
Definition: block.hh:44
TypeOpFloatCeil(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1461
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7330
string spec
cspec file for this compiler
Definition: sleigh_arch.hh:31
int4 indpath
Specific CBRANCH path going to the switch.
Definition: jumptable.hh:133
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.cc:75
virtual bool checkPrintNegation(const Varnode *vn)=0
Check whether a given boolean Varnode can be printed in negated form.
static bool checkImpliedCover(Funcdata &data, Varnode *vn)
Check for cover violation if Varnode is implied.
Definition: coreaction.cc:2887
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:314
@ unary_prefix
Unary operator form (printed before its input)
Definition: printlanguage.hh:86
bool inUse(const Address &usepoint) const
Is this storage valid for the given code address.
Definition: database.cc:90
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:737
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1585
bool transferLockedOutput(Varnode *&newoutput)
Pass back the Varnode needed to match the output parameter (return value)
Definition: fspec.cc:4195
Definition: prefersplit.hh:23
virtual void stopIndent(int4 id)
End an indent level.
Definition: prettyprint.hh:154
int4 getDeadCodeDelay(AddrSpace *spc) const
Get pass delay for heritaging the given space.
Definition: heritage.cc:2368
virtual Datatype * getType(void) const
Get the data-type associate with this.
Definition: fspec.cc:2316
virtual Architecture * buildArchitecture(const string &filename, const string &target, ostream *estream)=0
Build an Architecture given a raw file or data.
An unstructured model for passing input parameters to a function.
Definition: fspec.hh:561
string name
Name of the model.
Definition: fspec.hh:618
A user defined p-code op with no specialization.
Definition: userop.hh:70
LoadImage(const string &f)
LoadImage constructor.
Definition: loadimage.hh:114
int4 justifiedContain(const Address &addr, int4 sz) const
Calculate endian aware containment.
Definition: fspec.cc:94
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:982
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:256
uint4 count_apply
Number of times this Rule has successfully been applied.
Definition: action.hh:208
uint8 hash
Hash encoding the Symbols environment.
Definition: varmap.hh:51
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:304
TypeOpMulti(TypeFactory *t)
Constructor.
Definition: typeop.cc:1482
int4 size
Size of table entry.
Definition: jumptable.hh:44
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1233
void removeTrace(BlockTrace *trace)
Remove the indicated BlockTrace.
Definition: blockaction.cc:649
virtual void emitBlockGoto(const BlockGoto *bl)=0
Emit a block ending with a goto statement.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:462
int4 size
Size of the Varnode in bytes.
Definition: varnode.hh:124
static Varnode * getHiBit(PcodeOp *op)
Get the piece containing the sign-bit.
Definition: ruleaction.cc:5305
static block_type nameToType(const string &name)
Get the block_type associated with a name string.
Definition: block.cc:613
set< Address > adset
Absolute address table (manually specified)
Definition: jumptable.hh:426
virtual bool doWidening(const ValueSet &valueSet, CircleRange &range, const CircleRange &newRange)=0
For an iteration that isn't stabilizing attempt to widen the given ValueSet.
virtual void executeCpoolRef(void)
Standard behavior for a CPOOLREF (constant pool reference) op.
Definition: emulateutil.cc:136
bool descend2Undef(Varnode *vn)
Transform all reads of the given Varnode to a special undefined constant.
Definition: funcdata_varnode.cc:419
static int4 compare_head(LoopBody *a, FlowBlock *looptop)
Compare just the head.
Definition: blockaction.cc:482
RangeList localRange
The set of addresses that might hold mapped locals (not parameters)
Definition: varmap.hh:184
intb sstart
A signed version of the starting offset.
Definition: varmap.hh:82
Emulation based on (existing) PcodeOps and Varnodes.
Definition: emulateutil.hh:41
Architecture * glb
Global configuration data.
Definition: funcdata.hh:66
virtual void tagComment(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a comment string as part of the generated source code.
Definition: prettyprint.cc:1044
Abstract class for emitting disassembly to an application.
Definition: translate.hh:118
FlowBlock * exitproto
Putative exit block for the BlockTrace.
Definition: blockaction.hh:145
@ is_constructor
Op is call to a constructor.
Definition: op.hh:104
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:297
SegmentOp(Architecture *g, const string &nm, int4 ind)
Constructor.
Definition: userop.cc:121
Definition: double.hh:303
void defaultParamRange(void)
Set the default stack range used for input parameters.
Definition: fspec.cc:1706
vector< Scope * > scopestack
The symbol scope stack.
Definition: printlanguage.hh:233
void restoreXml(const Element *el)
Initialize this Translate from XML.
Definition: ghidra_translate.cc:148
@ enter_node
Extending path into new Varnode.
Definition: funcdata.hh:598
virtual void assignMap(const vector< Datatype * > &proto, bool isinput, TypeFactory &typefactory, vector< ParameterPieces > &res) const
Given list of data-types, map the list positions to storage locations.
Definition: fspec.hh:585
A collection of parameter descriptions without backing symbols.
Definition: fspec.hh:1106
virtual void opCpoolRefOp(const PcodeOp *op)=0
Emit a CPOOLREF operator.
BlockGraph sblocks
Structured block hierarchy (on top of basic blocks)
Definition: funcdata.hh:79
static void formatBinary(ostream &s, uintb val)
Print a number in binary form.
Definition: printlanguage.cc:874
CircleRange range
Acceptable range of values for the normalized switch variable.
Definition: jumptable.hh:179
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1810
A map from values to control-flow targets within a function.
Definition: jumptable.hh:499
void emitAtom(const Atom &atom)
Send an variable token from the RPN to the emitter.
Definition: printlanguage.cc:373
static string normalizeArchitecture(const string &nm)
Try to recover a language id string.
Definition: sleigh_arch.cc:379
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:237
@ blocks_generated
Set if Basic blocks have been generated.
Definition: funcdata.hh:48
virtual void setIntegerFormat(const string &nm)
Set the default integer format.
Definition: printlanguage.cc:792
Description of logical lanes within a big Varnode.
Definition: transform.hh:126
An implementation of Translate that queries a Ghidra client for p-code information.
Definition: ghidra_translate.hh:34
virtual bool checkJoin(const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const =0
Check if the given two storage locations can represent a single logical parameter.
LaneDescription(const LaneDescription &op2)
Copy constructor.
Definition: transform.cc:20
TrackedSet cache
A cache of previously fetched tracked registers.
Definition: ghidra_context.hh:33
PcodeOp * op
Operation along the path to the Varnode.
Definition: funcdata.hh:575
void printRaw(ostream &s) const
Print a simple identifier plus additional info identifying Varnode with SSA form.
Definition: varnode.cc:634
static bool getIsNotAttached(uint8 h)
Retrieve the attachment boolean from a hash.
Definition: dynamic.cc:517
void setTypeFactory(TypeFactory *t)
Establish the data-type factory.
Definition: cast.cc:21
SeqNum seq
Identifying address and index of this operation.
Definition: pcoderaw.hh:96
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:717
syntax_highlight
Possible types of syntax highlighting.
Definition: prettyprint.hh:87
void gatherUnmarkedVn(void)
Move staged Varnodes into the sub-graph and mark them.
Definition: dynamic.cc:167
virtual int4 localExtensionType(const Varnode *vn) const
Decide on integer promotion by examining just local properties of the given Varnode.
Definition: cast.cc:61
void setBasicBlockRange(BlockBasic *bb, const Address &beg, const Address &end)
Set the initial ownership range for the given basic block.
Definition: funcdata.hh:497
void registerPcodeCallback(const string &nm, BreakCallBack *func)
Register a pcode based breakpoint.
Definition: emulate.cc:23
@ CPUI_INT_EQUAL
Integer comparison, equality (==)
Definition: opcodes.hh:51
Toggle whether unimplemented instructions are treated as a no-operation.
Definition: options.hh:213
static bool isPossibleAliasStep(Varnode *vn1, Varnode *vn2)
Check for additive relationship.
Definition: coreaction.cc:2790
virtual void opIntLeft(const PcodeOp *op)
Emit a INT_LEFT operator.
Definition: printc.hh:252
CPUI_FLOAT_INT2FLOAT behavior.
Definition: opbehavior.hh:444
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:219
@ TYPE_ARRAY
Array data-type, made up of a sequence of "element" datatype.
Definition: type.hh:44
Convert INT_LEFT to INT_MULT: V << 2 => V * 4
Definition: ruleaction.hh:599
@ directwrite
(could be) Directly affected by a valid input
Definition: varnode.hh:96
@ nolocalalias
There are no aliases pointing to this varnode.
Definition: varnode.hh:84
Make final attachments of dynamically mapped symbols to Varnodes.
Definition: coreaction.hh:997
bool sendParamMeasures
True if measurements for argument and return parameters should be sent.
Definition: ghidra_arch.hh:70
@ f_label_bumpup
Any label printed higher up in hierarchy.
Definition: block.hh:86
ParseError(const string &s)
Initialize the error with an explanatory string.
Definition: error.hh:67
@ utf16
16-bit wide chars in unicode UTF16
Definition: type.hh:75
TypeUnicode(const string &nm, int4 sz, type_metatype m)
Construct given name,size, meta-type.
Definition: type.cc:359
PcodeOp * getFirstReturnOp(void) const
Clone a PcodeOp into this function.
Definition: funcdata_op.cc:582
int4 state
Depth of critical path.
Definition: condexe.hh:42
TypeOpIntSborrow(TypeFactory *t)
Constructor.
Definition: typeop.cc:1034
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:614
virtual void registerContext(const string &name, int4 sbit, int4 ebit)
Add a new context variable to the model for this processor.
Definition: translate.hh:327
virtual bool isSextCast(Datatype *outtype, Datatype *intype) const
Is sign-extending an input data-type, producing an output data-type, considered a cast.
Definition: cast.cc:343
_valuetype & split(const _linetype &pnt)
Introduce a new split point.
Definition: partmap.hh:117
Address addr
Starting address of the memory range.
Definition: fspec.hh:172
A description of a byte-code object referenced by a constant.
Definition: cpool.hh:44
virtual bool doAddressBreak(const Address &addr)=0
Invoke any breakpoints associated with this machine address.
void restoreXmlEdges(List::const_iterator &iter, List::const_iterator enditer, BlockMap &resolver)
Restore edges from an XML stream.
Definition: block.cc:2363
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5265
static bool unicodeNeedsEscape(int4 codepoint)
Determine if the given codepoint needs to be escaped.
Definition: printlanguage.cc:408
virtual int4 getTableSize(void) const =0
Return the number of entries in the address table.
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:137
JumpModel * jmodel
Current model of how the jump table is implemented in code.
Definition: jumptable.hh:509
int4 group
Group of (mutually exclusive) entries that this entry belongs to.
Definition: fspec.hh:64
PcodeOp * target(const Address &addr) const
Find the first executing PcodeOp for a target address.
Definition: op.cc:824
bool operator<(const ScopeKey &op2) const
Comparison operator.
Definition: database.cc:788
virtual void opIntSright(const PcodeOp *op)
Emit a INT_SRIGHT operator.
Definition: printc.hh:254
void truncateSpace(const TruncationTag &tag)
Mark a space as truncated from its original size.
Definition: translate.cc:709
std::pair< const_iterator, const_iterator > find(linetype a) const
Find sub-ranges intersecting the given boundary point.
Definition: rangemap.hh:332
void registerOption(ArchOption *option)
Map from ArchOption name to its class instance.
Definition: options.cc:40
A pool of Rules that apply simultaneously.
Definition: action.hh:259
vector< PcodeOp * > loadCopyOps
List of COPY ops generated by load guards.
Definition: heritage.hh:216
int4 groupsize
The number of consecutive groups taken by the entry.
Definition: fspec.hh:65
Simplify INT_AND when applied to aligned INT_ADD: (V + c) & 0xfff0 => V + (c & 0xfff0)
Definition: ruleaction.hh:268
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:199
@ comma_separate
Statements within condition.
Definition: printlanguage.hh:147
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:319
virtual Datatype * arithmeticOutputStandard(const PcodeOp *op)=0
What is the output data-type produced by the given integer arithmetic operation.
virtual void opFloatDiv(const PcodeOp *op)=0
Emit a FLOAT_DIV operator.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1202
Architecture * glb
The Architecture owning the language emitter.
Definition: printlanguage.hh:242
int4 compare(const RangeHint &op2) const
Order this with another RangeHint.
Definition: varmap.cc:247
virtual bool unjustifiedContainer(const Address &loc, int4 size, VarnodeData &res) const =0
Check if the given storage location looks like an unjustified parameter.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5597
virtual void executeCpoolRef(void)
Standard behavior for a CPOOLREF (constant pool reference) op.
Definition: emulateutil.cc:270
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:301
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2245
virtual void executeBinary(void)
Execute a binary arithmetic/logical operation.
Definition: emulate.cc:225
int4 size
Number of bytes in the memory range.
Definition: fspec.hh:173
TypeBase(int4 s, type_metatype m)
Construct TypeBase from a size and meta-type.
Definition: type.hh:165
vector< VarnodeData * > varList
Varnodes allocated for ops.
Definition: emulateutil.hh:114
static void countMatchingCalls(const vector< FuncCallSpecs * > &qlst)
Calculate the number of times an individual sub-function is called.
Definition: fspec.cc:4963
static OpToken binary_minus
The binary subtraction operator.
Definition: printc.hh:82
void emitAnyLabelStatement(const FlowBlock *bl)
Emit any required label statement for a given control-flow block.
Definition: printc.cc:2762
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:290
int4 beginDocument(void)
Create a "begin document" command.
Definition: prettyprint.hh:352
Address operator+(int4 off) const
Increment address by a number of bytes.
Definition: address.hh:394
@ rule_warnings_given
A warning has been issued for this action.
Definition: action.hh:59
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:71
Symbol * linkSymbolReference(Varnode *vn)
Discover and attach Symbol to a constant reference.
Definition: funcdata_varnode.cc:1007
virtual void executeIndirect(void)
Standard behavior for an INDIRECT op.
Definition: emulateutil.cc:258
Address linetype
The linear element for a rangemap.
Definition: database.hh:806
uint4 gototype
The type of unstructured branch (f_goto_goto, f_break_goto, etc.)
Definition: block.hh:444
void clearNoncore(void)
Clear out non-core types.
Definition: type.cc:1338
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl, const Datatype *c)
Construct a token for a data-type name.
Definition: printlanguage.hh:211
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:1237
int4 slot
The input parameter slot to which the constraint is attached.
Definition: rangeutil.hh:121
Container class for PcodeOps associated with a single function.
Definition: op.hh:245
RangeList paramrange
Memory range(s) of space-based parameters.
Definition: fspec.hh:627
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:561
char getShortcut(void) const
Get the shortcut character.
Definition: space.hh:375
void opUnary(const OpToken *tok, const PcodeOp *op)
Push a unary operator onto the RPN stack.
Definition: printlanguage.cc:686
virtual void loadFill(uint1 *ptr, int4 size, const Address &addr)=0
Get data from the LoadImage.
bool option_NULL
Set to true if we should emit NULL keyword.
Definition: printc.hh:115
bool hasLoopOut(void) const
Is there a looping edge going out of this block.
Definition: block.cc:407
virtual string getArchType(void) const
Get a string indicating the architecture type.
Definition: loadimage_ghidra.cc:41
Varnode * switchvn
The switch variable.
Definition: jumptable.hh:476
Address getConstant(uintb val) const
Get a constant encoded as an Address.
Definition: translate.hh:517
bool contains(const CircleRange &op2) const
Check containment of another range in this.
Definition: rangeutil.cc:299
void saveXml(ostream &s) const
Serialize the reference to an XML element.
Definition: cpool.cc:176
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7090
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:712
int4 maxdelay
Maximum heritage delay across all parameters.
Definition: fspec.hh:494
bool operator<=(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:369
bool collectloads
Set to true if the emulator collects individual LOAD addresses.
Definition: jumptable.hh:103
bool verifySameCondition(void)
Verify that initblock and iblock branch on the same condition.
Definition: condexe.cc:422
SymbolEntry * getSymbolEntry(void) const
Definition: variable.cc:278
void deleteRemainingOps(list< PcodeOp * >::const_iterator oiter)
Delete any remaining ops at the end of the instruction.
Definition: flow.cc:225
void eraseDescend(PcodeOp *op)
Erase a descendant (reading) PcodeOp from this Varnode's list.
Definition: varnode.cc:289
Information about the FLOAT_ROUND op-code.
Definition: typeop.hh:664
Address createConstFromSpace(AddrSpace *spc) const
Create a constant address encoding an address space.
Definition: translate.hh:527
void nodeSplitInputPatch(BlockBasic *b, BlockBasic *bprime, int4 inedge)
Patch Varnode inputs to p-code ops in split basic block.
Definition: funcdata_block.cc:831
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:530
string name
Name of the option.
Definition: options.hh:34
int4 getFieldIter(int4 off) const
Get index into field list.
Definition: type.cc:741
void printCover(ostream &s) const
Print raw coverage info about the Varnode.
Definition: varnode.cc:242
@ implied
This varnode is a temporary variable.
Definition: varnode.hh:79
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely output prototype.
Definition: fspec.hh:660
TypeOpBoolXor(TypeFactory *t)
Constructor.
Definition: typeop.cc:1335
virtual bool doEmitWideCharPrefix(void) const
Return true if this language requires a prefix when expressing wide characters.
Definition: printjava.hh:64
static Varnode * findForm(PcodeOp *op, int4 &n, uintb &y, int4 &xsize, OpCode &extopc)
Check for INT_(S)RIGHT and/or SUBPIECE followed by INT_MULT.
Definition: ruleaction.cc:6778
void saveXml(ostream &s) const
Save this jump-table as a <jumptable> XML tag.
Definition: jumptable.cc:2596
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:3158
Simplify concatenation with zero: concat(V,0) => zext(V) << c
Definition: ruleaction.hh:824
int4 size
Current lane size.
Definition: transform.hh:93
void saveXml(ostream &s) const
Save this container to stream.
Definition: type.cc:1981
int4 max_term_duplication
Max terms duplicated without a new variable.
Definition: architecture.hh:124
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:887
static int4 mostNaturalBase(uintb val)
Determine the most natural base for an integer.
Definition: printlanguage.cc:812
@ CPUI_FLOAT_SUB
Floating-point subtraction (-)
Definition: opcodes.hh:96
OpCode getOpcode(void) const
Get the opcode for this op.
Definition: pcoderaw.hh:135
virtual Symbol * getSymbol(void) const
Retrieve the formal Symbol associated with this parameter.
Definition: fspec.cc:2411
void spliceBlockBasic(BlockBasic *bl)
Merge the given basic block with the block it flows into.
Definition: funcdata_block.cc:971
ProtoParameter * outparam
The return-value parameter.
Definition: fspec.hh:1084
static int4 checkClog(Funcdata &data, AddrSpace *id, int4 spcbase)
Find any stack pointer clogs and pass it on to the repair routines.
Definition: coreaction.cc:429
void structureLoops(vector< FlowBlock * > &rootlist)
Label loop edges.
Definition: block.cc:2087
void removeFromCodeList(PcodeOp *op)
Remove given PcodeOp from specific op-code list.
Definition: op.cc:644
virtual void opFloatNan(const PcodeOp *op)=0
Emit a FLOAT_NAN operator.
map< Address, FuncProto * > protoover
Override prototype at call-point.
Definition: override.hh:54
virtual ProtoParameter * clone(void) const
Clone the parameter.
Definition: fspec.cc:2303
static OpToken equal
The equal operator.
Definition: printc.hh:89
uint4 flags
Boolean properties of the trial.
Definition: fspec.hh:171
static bool compareCopyByInVarnode(PcodeOp *op1, PcodeOp *op2)
Compare COPY ops first by Varnode input, then by block containing the op.
Definition: merge.cc:943
@ IPTR_SPACEBASE
addresses = offsets off of base register
Definition: space.hh:31
virtual MapIterator begin(void) const =0
Beginning iterator to mapped SymbolEntrys.
static uintm getUIndex(const PcodeOp *op)
Get the comparison index for a PcodeOp.
Definition: cover.cc:27
void init(DocumentStorage &store)
Load the image and configure architecture.
Definition: architecture.cc:1235
void doReplacement(void)
Perform the discovered transform, making logical values explicit.
Definition: subflow.cc:1327
Datatype * ptrto
Type being pointed to.
Definition: type.hh:222
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:662
bool isspecial
Is op not a normal unary or binary op.
Definition: opbehavior.hh:45
int4 rhs
Right hand side of the equation.
Definition: coreaction.cc:25
TypeOpFloatLessEqual(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1377
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4711
uintb highest
Highest (byte) offset into this space.
Definition: space.hh:99
Datatype * voidtype
Cached reference to the void data-type.
Definition: fspec.hh:1107
map< CheapSorter, CPoolRecord > cpoolMap
A map from reference to constant pool record.
Definition: cpool.hh:190
PcodeOp * binaryop
The binary operator producing the root boolean (if non-null)
Definition: condexe.hh:39
static int4 getSlotFromHash(uint8 h)
Retrieve the encoded slot from a hash.
Definition: dynamic.cc:469
virtual ExternRefSymbol * findExternalRef(const Address &addr) const
Find an external reference at the given address.
Definition: database.cc:2205
bool isinputscore
True if scoring against input parameters, false for outputs.
Definition: fspec.hh:856
virtual void dump(const Address &addr, OpCode opc, VarnodeData *outvar, VarnodeData *vars, int4 isize)
The main pcode emit method.
Definition: emulate.cc:121
void saveXml(ostream &s) const
Save object to an XML stream.
Definition: cpool.cc:20
Extension point for building a GNU BFD capable Architecture.
Definition: bfd_arch.hh:25
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1841
void insert(list< PcodeOp * >::iterator iter, PcodeOp *inst)
Insert p-code operation at a given position.
Definition: block.cc:2151
The java-language token emitter.
Definition: printjava.hh:55
virtual void opIntDiv(const PcodeOp *op)
Emit a INT_DIV operator.
Definition: printc.hh:256
@ end_comment
End of a comment block.
Definition: prettyprint.hh:289
@ boundary_node
Augmented Dominator Tree boundary node.
Definition: heritage.hh:173
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:311
CPUI_INT_XOR behavior.
Definition: opbehavior.hh:240
TypeOpCpoolref(TypeFactory *t)
Constructor.
Definition: typeop.cc:1759
@ CPUI_SUBPIECE
Truncate.
Definition: opcodes.hh:115
virtual int4 beginBlock(const FlowBlock *bl)
Begin a control-flow element.
Definition: prettyprint.cc:888
void restoreContext(const Element *el, const Address &addr1, const Address &addr2)
Restore a context blob for given address range from an XML tag.
Definition: globalcontext.cc:352
A Symbol scope for local variables of a particular function.
Definition: varmap.hh:182
int4 startIndent(int4 bump)
Create a "start a new indent level" command.
Definition: prettyprint.hh:548
vector< Action * >::iterator state
Current action being applied.
Definition: action.hh:145
Scope * getMap(void) const
Get the symbol table indexed by this.
Definition: type.cc:1111
ConstantPoolInternal cache
The local cache of previouly queried CPoolRecord objects.
Definition: cpool_ghidra.hh:33
Transform pointer arithmetic.
Definition: ruleaction.hh:995
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1131
void setDefaultFloatFormats(void)
If no explicit float formats, set up default formats.
Definition: translate.cc:852
static FuncCallSpecs * getFspecFromConst(const Address &addr)
Convert FspecSpace addresses to the underlying FuncCallSpecs object.
Definition: fspec.hh:1520
MemoryBank * getMemoryBank(AddrSpace *spc) const
Get a memory bank associated with a particular space.
Definition: memstate.cc:634
uint4 flags
Boolean options for flow following.
Definition: flow.hh:99
static bool propagateGoodEdge(PcodeOp *op, int4 inslot, int4 outslot, Varnode *invn)
Determine if propagation should happen along the given edge.
Definition: coreaction.cc:4182
Classes for simplifying control-flow with shared conditional expressions.
virtual void opSubpiece(const PcodeOp *op)
Emit a SUBPIECE operator.
Definition: printc.cc:638
void generateOps(void)
Generate raw control-flow from the function's base address.
Definition: flow.cc:749
Datatype * arrayof
type of which we have an array
Definition: type.hh:248
@ stat_e
End of a statement.
Definition: prettyprint.hh:306
bool subset(int4 lsbOffset, int4 size)
Trim this to a subset of the original lanes.
Definition: transform.cc:68
An in-memory implementation of the Scope interface.
Definition: database.hh:721
@ lisconsume
In consume worklist.
Definition: varnode.hh:115
virtual void initialize(void)
Complete initialization of an extension point.
Definition: ghidra_process.cc:491
int4 numSpaces(void) const
Get the number of address spaces for this processor.
Definition: translate.hh:535
void tagType(const char *ptr, EmitXml::syntax_highlight h, const Datatype *ct)
Create a data-type identifier token.
Definition: prettyprint.hh:472
virtual ExternRefSymbol * findExternalRef(const Address &addr) const =0
Find an external reference at the given address.
Classes for keeping track of local variables and reconstructing stack layout.
virtual Datatype * getSubType(uintb off, uintb *newoff) const
Recover component data-type one-level down.
Definition: type.cc:1123
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2985
void opDestroy(PcodeOp *op)
Remove given PcodeOp and destroy its Varnode operands.
Definition: funcdata_op.cc:201
void setupSizes(void)
Derive some size information from Architecture.
Definition: type.cc:1229
PcodeOpTree::const_iterator op_state
Current PcodeOp up for rule application.
Definition: action.hh:262
Element * root
The root XML element being processed by this handler.
Definition: xml.hh:218
virtual void tagField(const char *ptr, syntax_highlight hl, const Datatype *ct, int4 off)
Emit an identifier for a field within a structured data-type.
Definition: prettyprint.cc:234
void removeFromFlowSplit(FlowBlock *bl, bool flipflow)
Remove FlowBlock splitting flow between input and output edges.
Definition: block.cc:1475
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2487
A range of nodes (within the weak topological ordering) that are iterated together.
Definition: rangeutil.hh:159
string name
The name of the parameter, "" for undefined or return value parameters.
Definition: fspec.hh:965
A record describing how logical values are split.
Definition: translate.hh:195
@ RETURN
Replace primary BRANCH or CALL with a suitable RETURN operation.
Definition: override.hh:48
bool operator<(const HighEdge &op2) const
Comparator.
Definition: merge.hh:35
void moveSequenceDead(PcodeOp *firstop, PcodeOp *lastop, PcodeOp *prev)
Move a sequence of PcodeOps to a point in the dead list.
Definition: op.cc:791
VarnodeLocSet::const_iterator endLoc(void) const
End of all Varnodes sorted by storage.
Definition: funcdata.hh:301
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2050
bool inRange(const Address &addr, int4 size) const
Check containment an address range.
Definition: address.cc:402
This class holds a single entry in a stack used to traverse Varnode expressions.
Definition: coreaction.hh:417
@ jumptablerecovery_on
Set if this Funcdata object is dedicated to jump-table recovery.
Definition: funcdata.hh:54
uint4 insn_count
Number of instructions flowed through.
Definition: flow.hh:92
@ stack_store
Created by an explicit STORE.
Definition: varnode.hh:119
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1190
bool tryReturnPull(PcodeOp *op, ReplaceVarnode *rvn, int4 slot)
Determine if the given subgraph variable can act as return value for the given RETURN op.
Definition: subflow.cc:235
virtual void opIntNegate(const PcodeOp *op)
Emit a INT_NEGATE operator.
Definition: printc.hh:248
friend ostream & operator<<(ostream &s, const Address &addr)
Write out an address to stream.
Definition: address.cc:34
int4 size
Number of bytes in a single element of this range.
Definition: varmap.hh:81
virtual Varnode * getStartVarnode(void) const
Get the Varnode associated with the current value.
Definition: jumptable.cc:300
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1413
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:786
bool isBoolOutput(void) const
Return true if this op produces a boolean output.
Definition: op.hh:173
virtual bool isReversible(void) const
Return true if the current value can be reversed to get a label.
Definition: jumptable.hh:218
virtual void inject(InjectContext &context, PcodeEmit &emit) const =0
bool flipstate[2]
Boolean negation along the critical path.
Definition: condexe.hh:44
bool checkRetirement(BlockTrace *trace, FlowBlock *&exitblock)
Check if a given BlockTrace can be retired.
Definition: blockaction.cc:859
uint4 getAllFlags(void) const
Get all Varnode flags for this storage.
Definition: database.hh:239
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1638
void collectBehaviors(vector< OpBehavior * > &behave) const
Provide a list of OpBehavior objects.
Definition: architecture.cc:297
virtual void executeIndirect(void)
Standard behavior for an INDIRECT op.
Definition: emulateutil.cc:110
void setOutputLock(bool val)
Toggle the data-type lock on the return value.
Definition: fspec.cc:3091
virtual int4 openParen(char o, int4 id=0)
Emit an open parenthesis.
Definition: prettyprint.cc:1071
@ f_unstructured_targ
Block is destination of unstructured goto.
Definition: block.hh:80
bool testOpRead(Varnode *vn, PcodeOp *op)
Can we move the (non MULTIEQUAL) defining p-code of the given Varnode.
Definition: condexe.cc:473
Architecture * glb
The Architecture owning this prototype model.
Definition: fspec.hh:617
Mark COPY operations between Varnodes representing the object as non-printing.
Definition: coreaction.hh:975
@ CPUI_INT_LESSEQUAL
Integer comparison, unsigned less-than-or-equal (<=)
Definition: opcodes.hh:57
void partitionSurround(Partition &part)
Create a full partition component.
Definition: rangeutil.cc:1949
ParamEntry * entry
Pointer to the actual ParamEntry.
Definition: fspec.hh:108
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:3005
int4 flowsize
Size of the logical data-flow in bytes.
Definition: subflow.hh:80
int4 functionalEqualityLevel(Varnode *vn1, Varnode *vn2, Varnode **res1, Varnode **res2)
Try to determine if vn1 and vn2 contain the same value.
Definition: op.cc:975
void setDisplayFormat(uint4 val)
Set the display format for this Symbol.
Definition: database.hh:230
virtual void executeLoad(void)=0
Standard behavior for a p-code LOAD.
static void shutdown(void)
Shutdown this SleighArchitecture and free all resources.
Definition: sleigh_arch.cc:463
void findComparisons(Varnode *vn, vector< PcodeOp * > &res)
Find INT_EQUAL or INT_NOTEQUAL taking the sign bit as input.
Definition: ruleaction.cc:3262
bool contains(const VarnodeData &op2) const
Does this container another given VarnodeData.
Definition: pcoderaw.cc:48
int4 offset
Offset into the Symbol that this covers.
Definition: database.hh:57
bool contain(const PcodeOp *point) const
Check containment of given point.
Definition: cover.cc:105
FlowBlock * head
head of the loop
Definition: blockaction.hh:45
@ bloc_b
Start of a control-flow section.
Definition: prettyprint.hh:299
@ CPUI_CBRANCH
Conditional branch.
Definition: opcodes.hh:41
RangeList range
The subset of ranges, within the whole address space to analyze.
Definition: varmap.hh:147
ruleflags
Boolean behavior properties governing this particular Action.
Definition: action.hh:53
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:574
virtual int4 getMaxDelay(void) const
Return the maximum heritage delay across all possible parameters.
Definition: fspec.hh:529
int4 refcount
Number of managers using this space.
Definition: space.hh:97
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:381
PcodeOp * fallthruOp(PcodeOp *op) const
Find fallthru pcode-op for given op.
Definition: flow.cc:86
void recurse(void)
Emit from the RPN stack as much as possible.
Definition: printlanguage.cc:639
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely inputs for this prototype.
Definition: fspec.hh:1297
virtual SymbolEntry * findClosestFit(const Address &addr, int4 size, const Address &usepoint) const =0
Find Symbol which is the closest fit to the given memory range.
AddrSpace * getSpaceBySpacebase(const Address &loc, int4 size) const
Get space associated with a spacebase register.
Definition: architecture.cc:201
virtual TrackedSet & createSet(const Address &addr1, const Address &addr2)
Create a tracked register set that is valid over the given range.
Definition: globalcontext.cc:482
static uint4 countMarks(PcodeOp *op)
Definition: coreaction.cc:1918
The basic switch model.
Definition: jumptable.hh:344
An Architecture that loads executables using an XML format.
Definition: xml_arch.hh:34
void fixReturnOp(void)
Reproduce COPY data-flow into RETURN ops affected by the removal of iblock.
Definition: condexe.cc:669
static void minMaxUse(Varnode *vn, int4 &maxByte, int4 &minByte)
Compute minimum and maximum bytes being used.
Definition: ruleaction.cc:732
vector< Equation > equations
Any equations associated with this value set.
Definition: rangeutil.hh:137
virtual void opIntCarry(const PcodeOp *op)=0
Emit a INT_CARRY operator.
@ unimplemented_present
Set if function contains unimplemented instructions.
Definition: funcdata.hh:57
vector< PcodeOp * > tablelist
List of BRANCHIND ops (preparing for jump table recovery)
Definition: flow.hh:87
void markIndirectOnly(void)
Mark illegal input Varnodes used only in INDIRECTs.
Definition: funcdata_varnode.cc:679
virtual void ignorableWhitespace(const char *text, int4 start, int4 length)
Callback with whitespace character data for the current XML element.
Definition: xml.hh:234
TypeSpacebase * getTypeSpacebase(AddrSpace *id, const Address &addr)
Create a "spacebase" type.
Definition: type.cc:1843
static const uint1 * unpackOffset(const uint1 *ptr, uintb &off)
Helper function for unpacking an offset from a pcode byte stream.
Definition: translate.cc:924
bool verifyCondition(PcodeOp *op, PcodeOp *initop)
Perform the correlation test on two CBRANCH operations.
Definition: condexe.cc:341
virtual void getRegionForSet(vector< uintm * > &res, const Address &addr1, const Address &addr2, int4 num, uintm mask)
Grab the context blob(s) for the given address range, marking bits that will be set.
Definition: globalcontext.cc:436
LabSymbol * queryCodeLabel(const Address &addr) const
Look-up a code label by address.
Definition: database.cc:1223
void collectEdges(void)
Collect edges between basic blocks as PcodeOp to PcodeOp pairs.
Definition: flow.cc:879
@ TYPE_INT
Signed integer. Signed is considered less specific than unsigned in C.
Definition: type.hh:37
virtual Datatype * findById(const string &n, uint8 id)
Search by name and id.
Definition: type.cc:1391
AddrSpace * getJoinSpace(void) const
Get the joining space.
Definition: translate.hh:460
void setPropertyRange(uint4 flags, const Range &range)
Set boolean properties over a given memory range.
Definition: database.cc:2997
void labelContainments(const vector< FlowBlock * > &body, const vector< LoopBody * > &looporder)
Record any loops that body contains.
Definition: blockaction.cc:320
void initActiveOutput(void)
Definition: funcdata_varnode.cc:461
virtual int4 beginVarDecl(const Symbol *sym)
Begin a variable declaration.
Definition: prettyprint.cc:942
ExecutablePcodeGhidra(Architecture *g, const string &src, const string &nm)
Constructor.
Definition: inject_ghidra.cc:106
bool checkRelativeConstant(Varnode *vn, int4 &typeCode, uintb &value) const
Check if the given Varnode is a relative constant.
Definition: rangeutil.cc:2302
vector< Rule * > allrules
The set of Rules in this ActionPool.
Definition: action.hh:260
virtual void opPiece(const PcodeOp *op)=0
Emit a PIECE operator.
ParamActive(bool recoversub)
Constructor an empty container.
Definition: fspec.cc:1379
virtual void opPtrsub(const PcodeOp *op)
Definition: printc.cc:691
virtual void emitBlockBasic(const BlockBasic *bb)
Emit statements in a basic block.
Definition: printc.cc:2291
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6232
TransformVar * lanes
Lane placeholders for underyling Varnode.
Definition: subflow.hh:170
virtual void opCall(const PcodeOp *op)=0
Emit a CALL operator.
uintm unique_base
Starting offset into unique space.
Definition: translate.hh:295
void endVarDecl(int4 id)
Create an "end variable declaration" command.
Definition: prettyprint.hh:409
string name
Name of type.
Definition: type.hh:81
virtual Architecture * buildArchitecture(const string &filename, const string &target, ostream *estream)
Build an Architecture given a raw file or data.
Definition: bfd_arch.cc:35
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:624
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1527
Casting strategies that are specific to the C language.
Definition: cast.hh:158
virtual Rule * getSubRule(const string &specify)
Retrieve a specific sub-rule by name.
Definition: action.cc:772
virtual bool isHiddenReturn(void) const
Is this a pointer to storage for a return value.
Definition: fspec.hh:980
CollapseStructure(BlockGraph &g)
Construct given a control-flow graph.
Definition: blockaction.cc:1850
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5259
Varnode * side1
Varnode coming from block1.
Definition: blockaction.hh:235
PcodeOp * earliestUseInBlock(Varnode *vn, BlockBasic *bl)
Get the earliest use/read of a Varnode in a specified basic block.
Definition: funcdata_op.cc:1123
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5175
bool discoverCbranch(void)
Find CBRANCH operation that determines whether zero is set or not.
Definition: condexe.cc:917
virtual ProtoParameter * getInput(int4 i)=0
Get the i-th input parameter (or NULL if it doesn't exist)
string getCallMechanismName(int4 injectid) const
Get the call mechanism name associated with an id.
Definition: pcodeinject.cc:301
Address baseaddr
Starting code address of binary data.
Definition: funcdata.hh:69
const_iterator find_end(linetype point) const
Find ending of sub-ranges that contain the given boundary point.
Definition: rangemap.hh:389
int4 innerinsize
The size in bytes of the near pointer value.
Definition: userop.hh:203
string explain
Explanatory string.
Definition: xml.hh:289
ReplaceOp * createOpDown(OpCode opc, int4 numparam, PcodeOp *op, ReplaceVarnode *inrvn, int4 slot)
Create a logical subgraph operator node given one of its input variable nodes.
Definition: subflow.cc:181
virtual void clearCategory(int4 cat)
Clear all symbols of the given category from this scope.
Definition: database_ghidra.hh:100
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:47
FlowBlock * bottom
Ending FlowBlock of the edge.
Definition: blockaction.hh:31
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: coreaction.hh:189
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3583
void applyIndirect(Funcdata &data, FuncCallSpecs &fspecs) const
Look for and apply destination overrides of indirect calls.
Definition: override.cc:167
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:360
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:625
static uint4 getMethodFromHash(uint8 h)
Retrieve the encoded method from a hash.
Definition: dynamic.cc:481
void setGroup(const string &grp, const char **argv)
Establish a new root Action.
Definition: action.cc:1020
void commitNewOutputs(Funcdata &data, Varnode *newout)
Update output Varnode to this CALL to reflect the formal return value.
Definition: fspec.cc:4272
@ break_start
Break at beginning of action.
Definition: action.hh:72
@ is_otherspace
Quick check for the OtherSpace derived class.
Definition: space.hh:86
Datatype * type
Data-type of the parameter.
Definition: fspec.hh:967
int4 slotback
The slot(+1) of the last input Varnode to traverse in this subexpression.
Definition: coreaction.hh:420
void restructureVarnode(bool aliasyes)
Layout mapped symbols based on Varnode information.
Definition: varmap.cc:985
Datatype * type_nochar
Same dimensions as char but acts and displays as an INT.
Definition: type.hh:390
virtual void addRange(AddrSpace *spc, uintb first, uintb last)
Add a memory range to the ownership of this Scope.
Definition: database.cc:1037
Architecture * glb
Architecture under which this jump-table operates.
Definition: jumptable.hh:508
virtual MapIterator begin(void) const
Beginning iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:94
void print_data(ostream &s, uint1 *buffer, int4 size, const Address &baseaddr)
Print a hex dump of a data buffer to stream.
Definition: type.cc:27
SeqNum(const Address &a, uintm b)
Create a sequence number with a specific time field.
Definition: address.hh:120
virtual list< SymbolEntry >::const_iterator beginDynamic(void) const =0
Beginning iterator to dynamic SymbolEntrys.
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:39
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1804
void resetMemory(void)
Reset the emulation snippet.
Definition: emulateutil.hh:154
virtual bool checkFreeze(const ValueSet &valueSet)
Check if the given value set has been frozen for the remainder of the iteration process.
Definition: rangeutil.cc:1874
virtual void adjustVma(long adjust)
Adjust load addresses with a global offset.
Definition: loadimage.cc:75
virtual uintb execute(const vector< uintb > &input) const =0
Compute the output value of this operation, given constant inputs.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3195
void initialize(Architecture *glb)
Initialize description objects for all user defined ops.
Definition: userop.cc:318
const Funcdata * fd
A function associated with the token.
Definition: printlanguage.hh:201
list< PcodeOp * >::const_iterator endOpDead(void) const
End of PcodeOp objects in the dead list.
Definition: funcdata.hh:464
TypeOpFloatRound(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1475
Varnode * extravn
The extra Varnode holding the default value.
Definition: jumptable.hh:406
void solve(int4 max, Widener &widener)
Iterate the ValueSet system until it stabilizes.
Definition: rangeutil.cc:2510
int4 funcptr_align
How many bits of alignment a function ptr has.
Definition: architecture.hh:131
Address addr
Starting address of table.
Definition: jumptable.hh:43
virtual void buildLabels(Funcdata *fd, vector< Address > &addresstable, vector< uintb > &label, const JumpModel *orig) const
Recover case labels associated with the Address table.
Definition: jumptable.cc:2024
uintb startingvalue
Possible start for guessing values that match addresses.
Definition: jumptable.hh:429
virtual bool contains(uintb val) const =0
Return true if the given value is in the set of possible values.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6446
void findSmallestNormal(uint4 matchsize)
Find the putative switch variable with the smallest range of values reaching the switch.
Definition: jumptable.cc:1128
TypeOpBranchind(TypeFactory *t)
Constructor.
Definition: typeop.cc:523
virtual void opIntRight(const PcodeOp *op)
Emit a INT_RIGHT operator.
Definition: printc.hh:253
std::list< _recordtype >::iterator value
Iterator pointing at the actual recordtype.
Definition: rangemap.hh:83
AddrSpace * spc
The stack space being loaded from.
Definition: heritage.hh:108
int4 getCurrentOpIndex(void) const
Get the index of current pcode op within current instruction.
Definition: emulate.hh:347
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2748
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3694
bool getContainer(const Address &addr, int4 sz, VarnodeData &res) const
Calculate the containing memory range.
Definition: fspec.cc:141
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:536
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:216
void addTerminalPatch(PcodeOp *pullop, ReplaceVarnode *rvn)
Mark an operation where a subgraph variable is naturally copied into the original data-flow.
Definition: subflow.cc:1063
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:574
RangeList localrange
Memory range(s) of space-based locals.
Definition: fspec.hh:626
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:264
list< LoopBody >::iterator loopbodyiter
Current (innermost) loop being structured.
Definition: blockaction.hh:196
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1575
int4 type
Type of this payload: CALLFIXUP_TYPE, CALLOTHERFIXUP_TYPE, etc.
Definition: pcodeinject.hh:88
void splitJoinWrite(Varnode *vn, JoinRecord *joinrec)
Split a written join-space Varnode into specified pieces.
Definition: heritage.cc:1733
EmulateSnippet emulator
The emulator.
Definition: pcodeinject.hh:138
TypeOpFloatNotEqual(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1363
void printEntry(ostream &s) const
Dump a description of this to a stream.
Definition: database.cc:155
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:268
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2098
vector< WorkNode > workList
List of Varnodes still left to trace.
Definition: subflow.hh:176
virtual int4 getNumInputs(void) const =0
Get the number of input parameters for this prototype.
AddrSpace * spaceid
Address space containing the range.
Definition: fspec.hh:66
string getFullName(void) const
Get the full name of this Scope.
Definition: database.cc:1345
virtual bool checkIntPromotionForExtension(const PcodeOp *op) const =0
Check if integer promotion forces a cast for the input to the given extension.
static OpToken greater_than
The greater than operator.
Definition: printc.hh:87
Classes for managing p-code injection.
static Varnode * constructNegate(Varnode *vn, PcodeOp *op, Funcdata &data)
Construct the boolean negation of a given boolean Varnode.
Definition: ruleaction.cc:7887
void cseEliminateList(Funcdata &data, vector< pair< uintm, PcodeOp * > > &list, vector< Varnode * > &outlist)
Perform Common Subexpression Elimination on a list of Varnode descendants.
Definition: funcdata_op.cc:1247
AddrSpace * space
The address space of the main SymbolEntry starting address.
Definition: database.hh:69
Address opaddress
Absolute address of the BRANCHIND jump.
Definition: jumptable.hh:515
vector< VarnodeData > output
Storage location for output.
Definition: pcodeinject.hh:63
void overrideSizeLockType(Symbol *sym, Datatype *ct)
Change the data-type of a Symbol that is sizelocked.
Definition: database.cc:1289
PcodeOp * currentOp
Current PcodeOp being executed.
Definition: emulateutil.hh:44
virtual void restoreXml(const Element *el)
Restore this Symbol from an XML stream.
Definition: database.cc:739
Class for merging low-level Varnodes into high-level HighVariables.
Definition: merge.hh:80
void swapBlocks(int4 i, int4 j)
Swap the positions two component FlowBlocks.
Definition: block.cc:1147
static void parseParentTag(const Element *el, string &name, vector< string > &parnames)
Read an XML <parent> tag for a Scope path.
Definition: database.cc:3053
virtual void flipInPlaceExecute(void)
Perform the flip to normalize conditional branch executed by this block.
Definition: block.cc:2774
Classes and API for accessing a binary load image.
Simplify concatenation of extended value: concat(V, zext(W) << c) => concat( concat(V,...
Definition: ruleaction.hh:834
vector< string > callFixupNames
Map from injectid to call-fixup name.
Definition: pcodeinject.hh:171
Toggle whether the decompiler should try to recover the table used to evaluate a switch.
Definition: options.hh:249
int4 enumsize
Size of an enumerated type.
Definition: type.hh:383
int4 promoteSize
Size of int data-type, (size that integers get promoted to)
Definition: cast.hh:55
void findSpanningTree(vector< FlowBlock * > &preorder, vector< FlowBlock * > &rootlist)
Find a spanning tree (skipping irreducible edges).
Definition: block.cc:935
Information about the INT_MULT op-code.
Definition: typeop.hh:477
PcodeOpTree::const_iterator endAll(void) const
End of all PcodeOps in sequence number order.
Definition: op.hh:282
virtual void emitExpression(const PcodeOp *op)
Emit a full expression.
Definition: printc.cc:2077
Information about the SEGMENTOP op-code.
Definition: typeop.hh:749
@ vari_t
A variable identifier.
Definition: prettyprint.hh:309
A helper function describing the number of bytes in a machine instruction and the starting p-code op.
Definition: flow.hh:75
vector< LoadTable > loadpoints
Any recovered in-memory data for the jump-table.
Definition: jumptable.hh:514
Information about the PTRSUB op-code.
Definition: typeop.hh:730
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: translate.cc:114
void constraintsFromCBranch(PcodeOp *cbranch)
Generate constraints arising from the given branch.
Definition: rangeutil.cc:2196
virtual int4 getTableSize(void) const
Return the number of entries in the address table.
Definition: jumptable.hh:327
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:294
uintb val
Value (if boolean is constant)
Definition: ruleaction.hh:1355
void queryByName(const string &name, vector< Symbol * > &res) const
Look-up symbols by name.
Definition: database.cc:1120
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:664
Scope * scope
The scope that owns this symbol.
Definition: database.hh:158
virtual void setPage(uintb addr, const uint1 *val, int4 skip, int4 size)
Overridden setPage.
Definition: memstate.cc:500
virtual void restoreXml(const Element *el)
Restore this model from an XML stream.
Definition: fspec.cc:2244
AddrSpace * space
AddressSpace in which to search.
Definition: varmap.hh:118
@ unknown_effect
An unknown effect (indicates the absence of an EffectRecord)
Definition: fspec.hh:311
@ CPUI_INT_2COMP
Twos complement.
Definition: opcodes.hh:65
virtual void printTemplate(ostream &s) const =0
Print the p-code ops of the injection to a stream (for debugging)
virtual void buildContext(DocumentStorage &store)
Build the Context database.
Definition: architecture.cc:517
vector< RangeHint * > maplist
The list of collected RangeHints.
Definition: varmap.hh:148
static int4 propagateAddPointer(PcodeOp *op, int4 slot)
Test if edge is pointer plus a constant.
Definition: coreaction.cc:4102
virtual void opFloatTrunc(const PcodeOp *op)=0
Emit a FLOAT_TRUNC operator.
AddrSpace * spacebase
Address space containing relative offset parameters.
Definition: fspec.hh:500
@ CPUI_FLOAT_ADD
Floating-point addition (+)
Definition: opcodes.hh:93
Cleanup: Convert truncation to cast: sub(V,c) => sub(V>>c*8,0)
Definition: ruleaction.hh:1083
API and specific strategies for applying type casts.
virtual void setCategory(Symbol *sym, int4 cat, int4 ind)
Set the category and index for the given Symbol.
Definition: database_ghidra.hh:114
void destroyType(Datatype *ct)
Remove a data-type from this.
Definition: type.cc:1868
string name
Name of the Rule.
Definition: action.hh:205
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8394
VarnodeLocSet::const_iterator beginLoc(int4 s, const Address &addr, uint4 fl) const
Start of Varnodes matching storage and properties.
Definition: funcdata.hh:322
void collectLaneSizes(Varnode *vn, const LanedRegister &allowedLanes, LanedRegister &checkLanes)
Examine the PcodeOps using the given Varnode to determine possible lane sizes.
Definition: coreaction.cc:506
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:174
virtual string getRegisterName(AddrSpace *base, uintb off, int4 size) const
Get the name of a register given its location.
Definition: sleighbase.cc:103
@ class_reference
Reference to (system level) class object, token holds class name.
Definition: cpool.hh:50
Information about the FLOAT_INT2FLOAT op-code.
Definition: typeop.hh:629
Address addr
The entry point address of the function to decompile.
Definition: ghidra_process.hh:153
void doReplacement(PcodeOp *op)
Replace the data-flow for the given PcodeOp in iblock.
Definition: condexe.cc:625
void collectNameRecs(void)
Collect names of unlocked Symbols on the stack.
Definition: varmap.cc:281
int4 numIterations
Count of individual ValueSet iterations.
Definition: rangeutil.hh:296
bool hasbaseregister
true if a base register has been attached
Definition: translate.hh:173
void applyConstraints(Varnode *vn, int4 type, const CircleRange &range, PcodeOp *cbranch)
Look for PcodeOps where the given constraint range applies and instantiate an equation.
Definition: rangeutil.cc:2091
@ binary
Binary operator form (printed between its inputs)
Definition: printlanguage.hh:85
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:674
Datatype * findAdd(Datatype &ct)
Find data-type in this container or add it.
Definition: type.cc:1426
virtual void buildConstantPool(DocumentStorage &store)
Build the constant pool.
Definition: architecture.cc:586
Cleanup: Convert INT_ADD of constants to INT_SUB: V + 0xff... => V - 0x00...
Definition: ruleaction.hh:1061
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:394
A class for simplifying a series of conditionally executed statements.
Definition: condexe.hh:131
const SeqNum & getSeqNum(void) const
Retrieve the sequence number.
Definition: pcoderaw.hh:157
A base class for operations that access volatile memory.
Definition: userop.hh:99
Set the default prototype model for analyzing unknown functions.
Definition: options.hh:87
virtual bool contains(uintb val) const
Return true if the given value is in the set of possible values.
Definition: jumptable.cc:274
void openParen(char o, int4 id)
Create an open parenthesis.
Definition: prettyprint.hh:520
Manage the construction of Static Single Assignment (SSA) form.
Definition: heritage.hh:170
PcodeOp * op
Pointer to CALL or CALLIND instruction.
Definition: fspec.hh:1437
virtual void opIntSub(const PcodeOp *op)
Emit a INT_SUB operator.
Definition: printc.hh:243
vector< int4 > spacerange
List of address spaces that are in the global range.
Definition: database_ghidra.hh:39
RawBinaryArchitectureCapability(void)
Singleton.
Definition: raw_arch.cc:21
void insertMultistageJump(const Address &addr)
Flag an indirect jump for multistage analysis.
Definition: override.cc:127
void getChunk(uint1 *res, AddrSpace *spc, uintb off, int4 size) const
Get a chunk of data from memory state.
Definition: memstate.cc:710
int4 right
Index within the array of the rightmost object in the queue.
Definition: prettyprint.hh:608
virtual void saveXml(ostream &s) const
Save all records in this container to an XML stream.
Definition: cpool_ghidra.cc:56
virtual void setAttribute(Symbol *sym, uint4 attr)=0
Set boolean Varnode properties on a Symbol.
MapIterator(const MapIterator &op2)
Copy constructor.
Definition: database.hh:349
vector< FlowBlock * > gotoedges
List of goto targets from this block.
Definition: block.hh:469
virtual bool foldInGuards(Funcdata *fd, JumpTable *jump)
Eliminate any guard code involved in computing the switch destination.
Definition: jumptable.hh:333
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5526
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2307
void doInputJoin(int4 slot1, bool ishislot)
Join two parameter trials.
Definition: fspec.cc:4411
@ copy_in1
There exists at least 1 COPY into this HighVariable from other HighVariables.
Definition: variable.hh:51
list< ValueSet > valueNodes
Storage for all the current value sets.
Definition: rangeutil.hh:289
const char * print
Printing characters for the token.
Definition: printlanguage.hh:92
uintb nzm
Which bits do we know are zero.
Definition: varnode.hh:144
uint4 crc_update(uint4 reg, uint4 val)
Feed 8 bits into a CRC register.
Definition: crc32.hh:31
void mult64to128(uint8 *res, uint8 x, uint8 y)
Multiply 2 unsigned 64-bit values, producing a 128-bit value.
Definition: address.cc:812
bool hasOutputErrors(void) const
Has this prototype been marked as having an incorrect return value description.
Definition: fspec.hh:1268
uint4 breakpoint
Breakpoint properties.
Definition: action.hh:81
void markNearPointers(AddrSpace *spc, int4 size)
Mark that given space can be accessed with near pointers.
Definition: translate.cc:511
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:271
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:276
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:429
Partition * partHead
If Varnode is a component head, pointer to corresponding Partition.
Definition: rangeutil.hh:138
Search for concatenations with unlikely things to inform return/parameter consumption calculation.
Definition: ruleaction.hh:1435
bool hasRestartPending(void) const
Does this function need to restart its analysis.
Definition: funcdata.hh:191
SymbolEntry * queryContainer(const Address &addr, int4 size, const Address &usepoint) const
Find the smallest containing Symbol.
Definition: database.cc:1168
Remove unreachable blocks.
Definition: coreaction.hh:479
bool setEnumValues(const vector< string > &namelist, const vector< uintb > &vallist, const vector< bool > &assignlist, TypeEnum *te)
Set named values for an enumeration.
Definition: type.cc:1550
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4717
@ IPTR_FSPEC
Special internal FuncCallSpecs reference.
Definition: space.hh:33
uint4 getHaltType(void) const
Get type which indicates unusual halt in control-flow.
Definition: op.hh:162
void saveXml(ostream &s) const
Save the record to an XML stream.
Definition: fspec.cc:1656
A trivial emitter that outputs syntax straight to the stream.
Definition: prettyprint.hh:220
static bool mergeTestBasic(Varnode *vn)
A test if the given Varnode can ever be merged.
Definition: merge.cc:189
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1135
const FlowBlock * nextInFlow(void) const
Return next block to be executed in flow.
Definition: block.cc:2407
CPUI_INT_SEXT behavior.
Definition: opbehavior.hh:181
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1426
virtual void executeLoad(void)
Standard behavior for a p-code LOAD.
Definition: emulateutil.cc:184
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:604
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:984
list< PcodeOp * >::const_iterator beginDead(void) const
Start of all PcodeOps marked as dead.
Definition: op.hh:297
virtual FlowBlock * getSplitPoint(void)
Get the leaf splitting block.
Definition: block.hh:726
@ f_forward_edge
An edge that jumps forward in the spanning tree.
Definition: block.hh:101
static const Scope * stackAddr(const Scope *scope1, const Scope *scope2, const Address &addr, const Address &usepoint, SymbolEntry **addrmatch)
Query for Symbols starting at a given address, which match a given usepoint.
Definition: database.cc:841
bool flowoverride_present
Does the function have registered flow override instructions.
Definition: flow.hh:98
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:433
virtual void docTypeDefinitions(const TypeFactory *typegrp)
Emit definitions of data-types.
Definition: printc.cc:2010
vector< vector< FlowBlock * > > queue
An array of stacks, indexed by priority.
Definition: heritage.hh:65
void sortCallSpecs(void)
Sort calls using a dominance based order.
Definition: funcdata.cc:461
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:327
A callother-fixup injection that uses a Ghidra client to generate the p-code ops.
Definition: inject_ghidra.hh:57
An interval map container.
Definition: rangemap.hh:65
virtual void printStatistics(ostream &s) const
Dump statistics to stream.
Definition: action.cc:938
void initActiveInput(void)
Turn on analysis recovering input parameters.
Definition: fspec.cc:4366
vector< Rule * > extra_pool_rules
Extra rules that go in the main pool (cpu specific, experimental)
Definition: architecture.hh:133
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:554
@ CPUI_BRANCHIND
Indirect branch (jumptable)
Definition: opcodes.hh:42
void a_v_b(ostream &s, const string &attr, bool val)
Output the given boolean value as an XML attribute.
Definition: xml.hh:365
bool isOverlayBase(void) const
Return true if other spaces overlay this space.
Definition: space.hh:425
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:248
vector< Address > addrtable
Address associated with each value.
Definition: jumptable.hh:428
Find Varnodes with a vectorized lane scheme and attempt to split the lanes.
Definition: coreaction.hh:106
Get rid of unused PcodeOp objects where we can guarantee the output is unused.
Definition: ruleaction.hh:43
void markPath(void)
Mark a path from this up to the root BranchPoint.
Definition: blockaction.cc:502
Information about the SUBPIECE op-code.
Definition: typeop.hh:697
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:582
void propagateCopyAway(PcodeOp *op)
Eliminate a COPY sink preserving its data-flow.
Definition: heritage.cc:522
Datatype(int4 s, type_metatype m)
Construct the base data-type providing size and meta-type.
Definition: type.hh:92
VarnodeDefSet::const_iterator endDef(uint4 fl) const
End of varnodes with set definition property.
Definition: varnode.cc:1430
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:818
Information about the STORE op-code.
Definition: typeop.hh:226
void makeFree(Varnode *vn)
Convert a Varnode to be free.
Definition: varnode.cc:940
bool isSpecial(void) const
Check if this is a special operator.
Definition: opbehavior.hh:110
static void linkSpacebaseSymbol(Varnode *vn, Funcdata &data, vector< Varnode * > &namerec)
Link symbols associated with a given spacebase Varnode.
Definition: coreaction.cc:2438
vector< int4 > companion
Index of companion input for variable produced by CPUI_INDIRECT.
Definition: coreaction.cc:34
virtual void opIntSright(const PcodeOp *op)=0
Emit a INT_SRIGHT operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:378
Cover * cover
Addresses covered by the def->use of this Varnode.
Definition: varnode.hh:138
virtual bool isExtensionCastImplied(const PcodeOp *op, const PcodeOp *readOp) const
Is the given ZEXT/SEXT cast implied by the expression its in?
Definition: cast.cc:169
virtual int4 determineIterationReset(const ValueSet &valueSet)
Upon entering a fresh partition, determine how the given ValueSet count should be reset.
Definition: rangeutil.cc:1866
virtual void modifySpaces(Translate *trans)
Modify address spaces as required by this Architecture.
Definition: sleigh_arch.cc:273
void printBounds(ostream &s) const
Print this Range to a stream.
Definition: address.cc:255
@ f_break_goto
Block ends with a break;.
Definition: block.hh:77
void calcDelay(void)
Calculate the maximum heritage delay for any potential parameter in this list.
Definition: fspec.cc:823
InitData inittype
Initialization data for a ScopeMapper.
Definition: fspec.hh:131
uint4 flags
Lock properties. Varnode::mark is co-opted to hold the size-lock flag.
Definition: fspec.hh:968
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:777
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1167
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:426
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:471
Comparator for JoinRecord objects.
Definition: translate.hh:209
vector< EffectRecord > effectlist
List of side-effects.
Definition: fspec.hh:622
BlockGraph ingraph
The control-flow graph to structure.
Definition: ghidra_process.hh:171
uint4 wordsize
Size of unit being addressed (1=byte)
Definition: space.hh:105
map< string, ContextBitRange > variables
Map from context variable name to description object.
Definition: globalcontext.hh:274
VarnodeData * getInput(int4 i) const
Get the i-th input varnode for this op.
Definition: pcoderaw.hh:217
static bool isprune(Varnode *vn)
Do we prune in here in our depth-first search for the normalized switch variable.
Definition: jumptable.cc:416
Scope * scope
Backing Scope for input parameters.
Definition: fspec.hh:1081
void splitTrial(int4 i, int4 sz)
Split the given trial in two.
Definition: fspec.cc:1474
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:931
@ error_outputparam
Set if the return value(s) are not properly represented.
Definition: fspec.hh:1156
uint4 breakpoint
Breakpoint(s) enabled for this Rule.
Definition: action.hh:204
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:210
virtual void executeIndirect(void)
Standard behavior for an INDIRECT op.
Definition: emulate.cc:302
Information about the FLOAT_ABS op-code.
Definition: typeop.hh:615
PcodeOpRaw * getOpByIndex(int4 i) const
Get pcode op in current instruction translation by index.
Definition: emulate.hh:357
An error generated while parsing a command or language.
Definition: error.hh:65
A container of commands that override the decompiler's default behavior for a single function.
Definition: override.hh:40
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6133
vector< RangeHint * >::iterator iter
The current iterator into the RangeHints.
Definition: varmap.hh:149
virtual void setCommentFill(const string &fill)
Set the comment fill characters for when line breaks are forced.
Definition: prettyprint.hh:769
Scope * inittype
Initialization data for a ScopeMapper.
Definition: database.hh:808
void setUniqueBase(uintm val)
Set the base offset for new temporary registers.
Definition: translate.hh:563
Simplify 'less than or equal': V < W || V == W => V <= W
Definition: ruleaction.hh:418
virtual void push_float(uintb val, int4 sz, const Varnode *vn, const PcodeOp *op)
Push a constant with a floating-point data-type to the RPN stack.
Definition: printc.cc:1087
@ CPUI_INT_OR
Logical/bitwise or (|)
Definition: opcodes.hh:69
bool testRemovability(PcodeOp *op)
Test if the given PcodeOp can be removed from iblock.
Definition: condexe.cc:692
@ status_mid
In middle of action (use subclass status)
Definition: action.hh:66
vector< BlockTrace * > paths
BlockTrace for each possible path out of this BlockPoint.
Definition: blockaction.hh:104
bool associative
True if the operator is associative.
Definition: printlanguage.hh:95
Definition: paramid.hh:41
bool isNameUndefined(void) const
Does this have an undefined name.
Definition: database.cc:229
virtual void initialize(void)
Do specialized initialization.
Definition: architecture.cc:32
void normalize(void)
Normalize the representation of full sets.
Definition: rangeutil.cc:23
@ stat_b
Start of a statement.
Definition: prettyprint.hh:305
virtual bool isNameUndefined(void) const
Is the name of this parameter undefined.
Definition: fspec.hh:981
bool functionalDifference(Varnode *vn1, Varnode *vn2, int4 depth)
Return true if vn1 and vn2 are verifiably different values.
Definition: op.cc:1074
LabSymbol(Scope *sc, const string &nm)
Construct given name.
Definition: database.cc:674
bool onlyOpUse(const Varnode *invn, const PcodeOp *opmatch, const ParamTrial &trial) const
Test if the given Varnode seems to only be used by a CALL.
Definition: funcdata_varnode.cc:1411
bool buildPiece(PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes)
Convert a CPUI_PIECE operation into copies between placeholders, given the output lanes.
Definition: subflow.cc:2079
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:501
UserPcodeOp * getOp(int4 i) const
Definition: userop.hh:267
@ IPTR_INTERNAL
Internally managed temporary space.
Definition: space.hh:32
GhidraDecompCapability & operator=(const GhidraDecompCapability &op2)
Not implemented.
@ vacconsume
Vacuous consume.
Definition: varnode.hh:114
bool processInstruction(const Address &curaddr, bool &startbasic)
Generate p-code for a single machine instruction and process discovered flow information.
Definition: flow.cc:369
void clear(void)
Clear out all the caches.
Definition: loadimage_xml.cc:134
bool isInputLocked(void) const
Are input data-types locked.
Definition: fspec.cc:3055
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:478
virtual void emitBlockIf(const BlockIf *bl)=0
Emit an if/else style construct.
vector< ValueSet * > rootNodes
Values treated as inputs.
Definition: rangeutil.hh:293
bool testMultiRead(Varnode *vn, PcodeOp *op)
Can we mave the MULTIEQUAL defining p-code of the given Varnode.
Definition: condexe.cc:451
Merge covermerge
Variable range intersection algorithms.
Definition: funcdata.hh:81
vector< Element * > List
A list of XML elements.
Definition: xml.hh:144
void set(ProtoModel *model, Datatype *outtype, const vector< Datatype * > &intypes, bool dotdotdot, Datatype *voidtype)
Establish a function pointer.
Definition: type.cc:915
virtual void emitBlockWhileDo(const BlockWhileDo *bl)=0
Emit a loop structure, check at top.
OpBehavior * behave
Object for emulating the behavior of the op-code.
Definition: typeop.hh:49
vector< bool > heritageyes
Boolean array indexed by address space indicating whether the space is heritaged.
Definition: condexe.hh:146
void saveXml(ostream &s) const
Save the image back out to an XML stream.
Definition: loadimage_xml.cc:35
vector< FlowBlock * > list
List of FlowBlock components within this super-block.
Definition: block.hh:271
virtual void setCommentStyle(const string &nm)=0
Set the way comments are displayed in decompiler output.
@ branch
This instruction is a branch.
Definition: op.hh:68
PcodeOp * mult
The (optional) multiplier being applied to the term.
Definition: coreaction.hh:1042
@ symboldirty
The symbol attachment is dirty.
Definition: variable.hh:50
void saveXml(ostream &s) const
Save the variable to stream as an XML <high> tag.
Definition: variable.cc:452
Eliminate INT_SUB: V - W => V + W * -1
Definition: ruleaction.hh:669
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:839
virtual int4 beginVarDecl(const Symbol *sym)
Begin a variable declaration.
Definition: prettyprint.hh:233
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:345
virtual void endBlock(int4 id)
End a control-flow element.
Definition: prettyprint.cc:897
void opZeroMulti(PcodeOp *op)
Transform trivial CPUI_MULTIEQUAL to CPUI_COPY.
Definition: funcdata_block.cc:172
Funcdata * inline_head
First function in the in-lining chain.
Definition: flow.hh:100
bool minimalContainer(const CircleRange &op2, int4 maxStep)
Construct minimal range that contains both this and another range.
Definition: rangeutil.cc:452
PathMeld origPathMeld
The set of paths that produce non-default addresses.
Definition: jumptable.hh:407
Element * parent
The parent Element (or null)
Definition: xml.hh:156
uint4 getFlowOverride(const Address &addr) const
Return the particular flow override at a given address.
Definition: override.cc:223
TypeUnicode * getTypeUnicode(const string &nm, int4 sz, type_metatype m)
Create a default "unicode" type.
Definition: type.cc:1654
int4 dataflow_changecount
Number of data-flow changes made during structuring.
Definition: blockaction.hh:198
static uint1 * readPackedStream(istream &s)
Read packed p-code op information.
Definition: ghidra_arch.cc:138
Data-type and behavior information associated with specific p-code op-codes.
rangemap< ScopeMapper > ScopeResolve
A map from address to the owning Scope.
Definition: database.hh:822
virtual void registerVariable(const string &nm, int4 sbit, int4 ebit)
Register a new named context variable (as a bit range) with the database.
Definition: ghidra_context.hh:64
void setFields(const vector< TypeField > &fd)
Establish fields for this.
Definition: type.cc:722
An iterator into the interval map container.
Definition: rangemap.hh:100
@ floatingpoint
A floating point operation.
Definition: op.hh:87
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4640
virtual void printEntries(ostream &s) const
Dump a description of all SymbolEntry objects to a stream.
Definition: database.cc:2649
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore the state of this database object from a serialized XML stream.
Definition: globalcontext.cc:512
Restrict possible range of local variables.
Definition: coreaction.hh:775
An abstract Emulate class using a MemoryState object as the backing machine state.
Definition: emulate.hh:243
void mergeOp(PcodeOp *op)
Force the merge of all input and output Varnodes for the given PcodeOp.
Definition: merge.cc:608
void renormalize(int4 size)
Make sure there is a backing JoinRecord if this is in the join space.
Definition: address.cc:185
list< LoadGuard > storeGuard
List of STORE operations taking an indexed pointer to the stack.
Definition: heritage.hh:215
Locate shadow Varnodes and adjust them so they are hidden.
Definition: coreaction.hh:953
vector< AddrSpace * > baselist
Every space we know about for this architecture.
Definition: translate.hh:219
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:221
Symbol * sym
Backing Symbol for this parameter.
Definition: fspec.hh:1054
Symbol * removeQuery(const Address &addr) const
Process a query that missed the cache.
Definition: database_ghidra.cc:210
bool reconcile(const RangeHint *b) const
Can the given intersecting RangeHint coexist with this at their given offsets.
Definition: varmap.cc:26
TypeOpFloatMult(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1405
uint8 id
A unique id for the type (or 0 if an id is not assigned)
Definition: type.hh:84
TypeOpIntLeft(TypeFactory *t)
Constructor.
Definition: typeop.cc:1119
string version
Version of the specification.
Definition: sleigh_arch.hh:54
Information about the CALLIND op-code.
Definition: typeop.hh:271
virtual void clearUnlockedCategory(int4 cat)=0
Clear unlocked symbols of the given category from this scope.
uintb uintb_negate(uintb in, int4 size)
Negate the sized value.
Definition: address.cc:592
int4 a_in1
In edge of exita coming from block1.
Definition: blockaction.hh:245
void restoreFlowOverride(const Element *el)
Set flow overrides from XML.
Definition: architecture.cc:382
void clearActiveOutput(void)
Clear any analysis of the function's return prototype.
Definition: funcdata.hh:376
virtual void stopComment(int4 id)
End a comment block.
Definition: prettyprint.hh:166
A stand-alone parameter with no backing symbol.
Definition: fspec.hh:964
virtual void executeStore(void)
Standard behavior for a p-code STORE.
Definition: emulate.cc:246
virtual void buildAction(DocumentStorage &store)
Build the Action framework.
Definition: architecture.cc:506
void clearCache(void)
Clear the common type cache.
Definition: type.cc:1216
virtual void printMessage(const string &message) const =0
Print an error message to console.
void mergeLinear(vector< HighVariable * > &highvec)
Speculatively merge all HighVariables in the given list as well as possible.
Definition: merge.cc:205
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6452
vector< uintb > address
The hashtable addresses.
Definition: memstate.hh:132
void restoreXml(const Element *el, Architecture *glb)
Read in this table from a <loadtable> XML description.
Definition: jumptable.cc:34
Base type for character data-types: i.e. char.
Definition: type.hh:174
virtual MapIterator end(void) const =0
Ending iterator to mapped SymbolEntrys.
Action * setCurrent(const string &actname)
Set the current root Action.
Definition: action.cc:982
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:442
An iterator over SymbolEntry objects in multiple address spaces.
Definition: database.hh:330
const FloatFormat * format
The floating-point format of the logical value.
Definition: subflow.hh:153
Information about the COPY op-code.
Definition: typeop.hh:205
@ CPUI_INT_NOTEQUAL
Integer comparison, in-equality (!=)
Definition: opcodes.hh:52
mach_extreme
An enum for specifying extremal addresses.
Definition: address.hh:52
virtual void buildAddresses(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable, vector< LoadTable > *loadpoints) const
Construct the explicit list of target addresses (the Address Table) from this model.
Definition: jumptable.cc:1852
A p-code emitter for building PcodeOp objects.
Definition: funcdata.hh:553
partmap< Address, uint4 > flagbase
Map of global properties.
Definition: database.hh:842
int4 index2case
Id of p-code script performing index2case (== -1 if no script and index==case)
Definition: userop.hh:230
const PcodeOp * op
The PcodeOp defining the edge.
Definition: dynamic.hh:31
virtual void opInsertOp(const PcodeOp *op)=0
Emit an INSERT operator.
static RawBinaryArchitectureCapability rawBinaryArchitectureCapability
The singleton instance.
Definition: raw_arch.hh:23
Action * toggleAction(const string &grp, const string &basegrp, bool val)
Toggle a group of Actions with a root Action.
Definition: action.cc:997
int4 depthFirstIndex
(Global) depth first numbering for topological ordering
Definition: rangeutil.hh:295
virtual void executeBranchind(void)=0
Standard behavior for a BRANCHIND.
TypeEnum * getTypeEnum(const string &n)
Create an (empty) enumeration.
Definition: type.cc:1831
void connectBasic(void)
Generate edges between basic blocks.
Definition: flow.cc:994
The list of groups defining a root Action.
Definition: action.hh:29
uintb last
Ending offset of the current valid range.
Definition: globalcontext.hh:314
string content
Character content of the element.
Definition: xml.hh:152
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3952
void copy(const FuncProto &op2)
Copy another function prototype.
Definition: fspec.cc:2931
PcodeOp * initop
The root CBRANCH operation to compare against.
Definition: condexe.hh:34
void endFunction(int4 id)
Create an "end function body" command.
Definition: prettyprint.hh:370
void blockRemoveInternal(BlockBasic *bb, bool unreachable)
Remove an active basic block from the function.
Definition: funcdata_block.cc:249
Action * deriveAction(const string &baseaction, const string &grp)
Derive a root Action.
Definition: action.cc:1099
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1053
void checkInputTrialUse(Funcdata &data, AliasChecker &aliascheck)
Mark if input trials are being actively used.
Definition: fspec.cc:4613
virtual void printEntries(ostream &s) const
Dump a description of all SymbolEntry objects to a stream.
Definition: database_ghidra.hh:111
SpacebaseSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind, int4 sz, AddrSpace *base, int4 dl)
Definition: translate.cc:38
Simplify INT_NEGATE chains: ~~V => V
Definition: ruleaction.hh:1338
void stopProcessing(void)
Mark that processing has completed for this function.
Definition: funcdata.cc:144
@ CPUI_FLOAT_DIV
Floating-point division (/)
Definition: opcodes.hh:94
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6501
BlockList * newBlockList(const vector< FlowBlock * > &nodes)
Build a new BlockList.
Definition: block.cc:1651
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:51
virtual string getOperatorName(const PcodeOp *op) const
Get the symbol representing this operation in decompiled code.
Definition: userop.hh:54
bool attemptDynamicMappingLate(SymbolEntry *entry, DynamicHash &dhash)
Map the name of a dynamic symbol to a Varnode.
Definition: funcdata_varnode.cc:1154
virtual uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering the input value.
Definition: opbehavior.cc:161
void truncatedFlow(const Funcdata *fd, const FlowInfo *flow)
Generate a clone with truncated control-flow given a partial function.
Definition: funcdata_op.cc:745
int4 pos
Index of current p-code op being executed.
Definition: emulateutil.hh:117
bool ruleCaseFallthru(FlowBlock *bl)
Attempt to one switch case falling through to another.
Definition: blockaction.cc:1709
void mergeAdjacent(void)
Speculatively merge Varnodes that are input/output to the same p-code op.
Definition: merge.cc:881
Simplify MULTIEQUAL operations where the branches hold the same value.
Definition: ruleaction.hh:247
void unifyAddress(VarnodeLocSet::const_iterator startiter, VarnodeLocSet::const_iterator enditer)
Make sure all Varnodes with the same storage address and size can be merged.
Definition: merge.cc:495
An interface to the pool of constant objects for byte-code languages.
Definition: cpool.hh:94
A single non-operator token emitted by the decompiler.
Definition: printlanguage.hh:194
static string typeToName(block_type bt)
Get the name string associated with a block_type.
Definition: block.cc:627
virtual void saveXml(ostream &s) const
Save this context to an XML stream as a <context> tag.
Definition: inject_ghidra.cc:18
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1076
RangeList holes
List of (queried) memory ranges with no Symbol in them.
Definition: database_ghidra.hh:38
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3938
virtual int4 openParen(char o, int4 id=0)
Emit an open parenthesis.
Definition: prettyprint.cc:304
TypeOpCallind(TypeFactory *t)
Constructor.
Definition: typeop.cc:610
@ CPUI_INT_LEFT
Left shift (<<)
Definition: opcodes.hh:70
Simplify INT_ZEXT applied to SUBPIECE expressions.
Definition: ruleaction.hh:844
@ noload
uninitialized section
Definition: loadimage.hh:48
Factory and static initializer for the "c-language" back-end to the decompiler.
Definition: printc.hh:32
virtual void tagVariable(const char *ptr, syntax_highlight hl, const Varnode *vn, const PcodeOp *op)
Emit a variable token.
Definition: prettyprint.hh:239
bool stackgrowsnegative
True if stack parameters have (normal) low address to high address ordering.
Definition: fspec.hh:628
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:830
bool isSubScope(const Scope *scp) const
Is this a sub-scope of the given Scope.
Definition: database.cc:1334
@ rule_repeatapply
Apply rule repeatedly until no change.
Definition: action.hh:54
virtual string getArchType(void) const =0
Get a string indicating the architecture type.
Information about the PIECE op-code.
Definition: typeop.hh:688
virtual void setContextDefault(const string &name, uintm val)
Set the default value for a particular context variable.
Definition: translate.hh:336
virtual Rule * clone(const ActionGroupList &grouplist) const =0
Clone the Rule.
virtual Rule * getSubRule(const string &specify)
Retrieve a specific sub-rule by name.
Definition: action.cc:464
virtual int4 getTableSize(void) const
Return the number of entries in the address table.
Definition: jumptable.hh:381
void mergeMarker(void)
Force the merge of input and output Varnodes to MULTIEQUAL and INDIRECT ops.
Definition: merge.cc:800
static void analyzeExtraPop(Funcdata &data, AddrSpace *stackspace, int4 spcbase)
Calculate stack-pointer change across undetermined sub-functions.
Definition: coreaction.cc:258
virtual AddrSpace * getSpacebase(void) const
Get the address space associated with any stack based parameters in this list.
Definition: fspec.hh:527
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:156
virtual void printRaw(ostream &s) const
Print a description of the type to stream.
Definition: type.cc:446
uintb localExtreme
Largest possible offset for a local variable.
Definition: varmap.hh:122
void refineInput(Varnode *vn, const Address &addr, const vector< int4 > &refine, vector< Varnode * > &newvn)
Split up a known input Varnode based on the given refinement.
Definition: heritage.cc:1426
map< Address, SizePass >::iterator iterator
Iterator into the main map.
Definition: heritage.hh:45
static void lookForBadJumpTables(Funcdata &data)
Mark the switch variable for bad jump-tables.
Definition: coreaction.cc:2309
void build(const Funcdata &data, AddrSpace *id, int4 spcbase)
Build the system of equations.
Definition: coreaction.cc:144
virtual int4 printAssembly(AssemblyEmit &emit, const Address &baseaddr) const
Disassemble a single machine instruction.
Definition: ghidra_translate.hh:54
SymbolEntry * addMap(const SymbolEntry &entry)
Integrate a SymbolEntry into the range maps.
Definition: database.cc:1058
virtual void restoreXml(DocumentStorage &store)
Restore the Architecture state from an XML stream.
Definition: architecture.cc:421
@ writemask
Should not be considered a write in heritage calculation.
Definition: varnode.hh:113
Classes to support jump-tables and their recovery.
A group of actions (generally) applied in sequence.
Definition: action.hh:142
void calcNZMask(void)
Calculate non-zero masks for all Varnodes.
Definition: funcdata_varnode.cc:720
RangeType rangeType
The type of range.
Definition: varmap.hh:85
virtual void opMultiequal(const PcodeOp *op)
Emit a MULTIEQUAL operator.
Definition: printc.hh:282
bool res
Set to true if the configuration action was successful.
Definition: ghidra_process.hh:209
A complete in-memory XML document.
Definition: xml.hh:206
void halfDeleteOutEdge(int4 slot)
Delete the out half of an edge, correcting indices.
Definition: block.cc:103
string name
Name of function.
Definition: funcdata.hh:67
Utilities for following control-flow in p-code generated from machine instructions.
bool pullBackBinary(OpCode opc, uintb val, int4 slot, int4 inSize, int4 outSize)
Pull-back this thru binary operator.
Definition: rangeutil.cc:797
Classes supporting the java-language back-end to the decompiler.
void toPhysical(void)
Convert this to a physical address.
Definition: address.cc:91
rangemap< ParamEntryRange > ParamEntryResolver
A map from offset to ParamEntry.
Definition: fspec.hh:141
addl_flags
Additional boolean properties on a Varnode.
Definition: varnode.hh:111
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1677
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:477
Transform INT_ZEXT and INT_SLESS: zext(V) s< c => V < c
Definition: ruleaction.hh:478
PcodeOp * cseFindInBlock(PcodeOp *op, Varnode *vn, BlockBasic *bl, PcodeOp *earliest)
Find a duplicate calculation of a given PcodeOp reading a specific Varnode.
Definition: funcdata_op.cc:1151
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:707
void setContextRegion(const Address &addr1, const Address &addr2, int4 num, uintm mask, uintm value)
Set a context variable value over a given range of addresses.
Definition: globalcontext.cc:190
uintb nonmultsum
Sum of non-multiple constants.
Definition: ruleaction.hh:39
int4 numparams
Number of parameters in (new) op.
Definition: subflow.hh:57
virtual Symbol * getSymbol(void) const
Retrieve the formal Symbol associated with this parameter.
Definition: fspec.hh:987
TypeOpIntSrem(TypeFactory *t)
Constructor.
Definition: typeop.cc:1308
uintb value
Constant value of the object (if known)
Definition: cpool.hh:67
void fillResolve(Scope *scope)
Add the ownership ranges of the given Scope to the map.
Definition: database.cc:2763
Simplify expressions involving three-way comparisons.
Definition: ruleaction.hh:1410
virtual void endBlock(int4 id)
End a control-flow element.
Definition: prettyprint.hh:228
MemoryState(Translate *t)
A constructor for MemoryState.
Definition: memstate.hh:171
virtual ContextBitRange & getVariable(const string &nm)=0
Retrieve the context variable description object by name.
@ unknown_model
Set if the PrototypeModel isn't known.
Definition: fspec.hh:1158
void fakeInputSymbols(void)
Make sure all stack inputs have an associated Symbol.
Definition: varmap.cc:1119
Information about the BRANCH op-code.
Definition: typeop.hh:236
Definitions to support a constant pool for deferred compilation languages (i.e. java byte-code)
Toggle whether the decompiler attempts to infer constant pointers.
Definition: options.hh:93
CPUI_FLOAT_ROUND behavior.
Definition: opbehavior.hh:484
@ namerepdirty
The name representative for the HighVariable is dirty.
Definition: variable.hh:47
bool operator!=(const VarnodeData &op2) const
Compare for inequality.
Definition: pcoderaw.hh:76
const TypeField * field
The component object describing the field.
Definition: printc.hh:47
@ CPUI_BOOL_OR
Boolean or (||)
Definition: opcodes.hh:82
CPUI_BOOL_AND behavior.
Definition: opbehavior.hh:334
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:198
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3867
Funcdata * fd
Function being analyzed.
Definition: condexe.hh:132
Flip conditions to match structuring cues.
Definition: ruleaction.hh:924
virtual void emitBlockDoWhile(const BlockDoWhile *bl)=0
Emit a loop structure, check at bottom.
ScopeLocal * localmap
Local variables (symbols in the function scope)
Definition: funcdata.hh:71
string filename
Name of active load-image file.
Definition: sleigh_arch.hh:94
string commentend
Delimiter characters (if any) for the end of a comment.
Definition: printlanguage.hh:240
virtual bool isIndirectStorage(void) const
Is this really a pointer to the true parameter.
Definition: fspec.hh:979
virtual void executeLoad(void)
Standard behavior for a p-code LOAD.
Definition: jumptable.cc:77
virtual ProtoParameter * clone(void) const
Clone the parameter.
Definition: fspec.cc:2405
@ BRANCH
Replace primary CALL or RETURN with suitable BRANCH operation.
Definition: override.hh:45
The pool of temporary storage registers.
Definition: space.hh:203
virtual ~ActionPool(void)
Destructor.
Definition: action.cc:711
virtual void opIntSless(const PcodeOp *op)
Emit a INT_SLESS operator.
Definition: printc.hh:236
BlockGraph & graph
The control-flow graph.
Definition: blockaction.hh:197
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1006
virtual void setCommentFill(const string &fill)
Set the comment fill characters for when line breaks are forced.
Definition: prettyprint.hh:192
uint4 highflags
Dirtiness flags.
Definition: variable.hh:61
virtual void buildAddresses(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable, vector< LoadTable > *loadpoints) const
Construct the explicit list of target addresses (the Address Table) from this model.
Definition: jumptable.cc:1995
list< BlockTrace * >::iterator retireBranch(BranchPoint *bp, FlowBlock *exitblock)
Retire a BranchPoint, updating its parent BlockTrace.
Definition: blockaction.cc:893
@ CPUI_INT_SRIGHT
Right shift, arithmetic (>>)
Definition: opcodes.hh:72
virtual void addRegister(const string &nm, AddrSpace *base, uintb offset, int4 size)
Add a named register to the model for this processor.
Definition: ghidra_translate.hh:44
int4 compareBasic(const TypeCode *op) const
Compare surface characteristics of two TypeCodes.
Definition: type.cc:989
void buildInfoList(void)
Initialize information for each space.
Definition: heritage.cc:2211
@ force_dec
Force decimal printing of constant symbol.
Definition: database.hh:178
void totalReplace(Varnode *vn, Varnode *newvn)
Replace all read references to the first Varnode with a second Varnode.
Definition: funcdata_varnode.cc:1205
PcodeOp * branchTarget(PcodeOp *op) const
Find the target referred to by a given BRANCH or CBRANCH.
Definition: flow.cc:185
virtual bool isTypeLocked(void) const
Is the parameter data-type locked.
Definition: fspec.hh:976
bool trySwitchPull(PcodeOp *op, ReplaceVarnode *rvn)
Determine if the subgraph variable can act as a switch variable for the given BRANCHIND.
Definition: subflow.cc:316
vector< ReplaceVarnode * > worklist
Subgraph variable nodes still needing to be traced.
Definition: subflow.hh:90
Datatype * getSizedType(const Address &addr, int4 sz) const
Get the data-type associated with (a piece of) this.
Definition: database.cc:127
void establishOp(void)
Set-up currentOp and currentBehave.
Definition: emulate.cc:375
BlockInfLoop * newBlockInfLoop(FlowBlock *body)
Build a new BlockInfLoop.
Definition: block.cc:1782
static bool shadowedVarnode(const Varnode *vn)
Determine if given Varnode is shadowed by another Varnode in the same HighVariable.
Definition: merge.cc:1161
set< Address > inline_base
Storage for addresses of functions that are in-lined.
Definition: flow.hh:102
Classes for keeping track of memory state during emulation.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1031
virtual string getSource(void) const =0
Return a string describing the source of the injection (.cspec, prototype model, etc....
ExecutablePcode(Architecture *g, const string &src, const string &nm)
Constructor.
Definition: pcodeinject.cc:103
Datatype * findByIdLocal(const string &nm, uint8 id) const
Search locally by name and id.
Definition: type.cc:1367
virtual void initialize(DocumentStorage &store)
Initialize the translator given XML configuration documents.
Definition: ghidra_translate.cc:33
uintb last
Offset of last byte in this Range.
Definition: address.hh:165
virtual bool executeCbranch(void)
Check if the conditional of a CBRANCH is true.
Definition: emulateutil.cc:219
void parseStackPointer(const Element *el)
Apply stack pointer configuration.
Definition: architecture.cc:924
static Document * readXMLAll(istream &s)
Read a whole response as an XML document.
Definition: ghidra_arch.cc:208
Commute INT_ZEXT with INT_RIGHT: zext(V) >> W => zext(V >> W)
Definition: ruleaction.hh:794
bool operator!=(const EffectRecord &op2) const
Inequality operator.
Definition: fspec.hh:1561
PrintJavaCapability(void)
Singleton constructor.
Definition: printjava.cc:24
static const CoverBlock emptyBlock
Global empty CoverBlock for blocks not covered by this.
Definition: cover.hh:70
ReplaceOp * createOp(OpCode opc, int4 numparam, ReplaceVarnode *outrvn)
Create a logical subgraph operator node given its output variable node.
Definition: subflow.cc:156
Datatype(const Datatype &op)
Construct the base data-type copying low-level properties of another.
Definition: type.hh:90
uintb pointerLowerBound
Offset below which we don't search for pointers.
Definition: space.hh:100
void gatherVarnodes(const Funcdata &fd)
Add stack Varnodes as hints to the collection.
Definition: varmap.cc:889
virtual bool contains(uintb val) const
Return true if the given value is in the set of possible values.
Definition: jumptable.cc:328
Convert a LOAD or STORE to the first element of a structure to a PTRSUB.
Definition: ruleaction.hh:1008
int4 uponPop(State &state, int4 command)
Pop a Varnode from the traversal stack.
Definition: funcdata_varnode.cc:1667
static int4 castInput(PcodeOp *op, int4 slot, Funcdata &data, CastStrategy *castStrategy)
Insert cast to produce the input Varnode to a given PcodeOp if necessary.
Definition: coreaction.cc:2216
Toggle whether a specific Rule is applied in the current Action.
Definition: options.hh:255
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:592
EntryInitData inittype
Initialization data for a SymbolEntry in a rangemap.
Definition: database.hh:113
void addRefPoint(const PcodeOp *ref, const Varnode *vn)
Add a variable read to this Cover.
Definition: cover.cc:504
Eliminate BOOL_XOR: V ^^ W => V != W
Definition: ruleaction.hh:101
@ CALL
Replace primary BRANCH or RETURN with suitable CALL operation.
Definition: override.hh:46
void collectOutputTrialVarnodes(vector< Varnode * > &trialvn)
Definition: fspec.cc:4564
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: action.cc:98
int4 rootVn
The index, within commonVn, of the Varnode at the split point.
Definition: jumptable.hh:70
void printRaw(ostream &s, Architecture *glb) const
Dump a description of the overrides to stream.
Definition: override.cc:238
uintb start
Starting offset of this range of bytes.
Definition: varmap.hh:80
virtual void printTree(ostream &s, int4 level) const
Print tree structure of any blocks owned by this.
Definition: block.cc:583
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:256
virtual void opConstructor(const PcodeOp *op, bool withNew)
Emit an operator constructing an object.
Definition: printc.cc:525
virtual int4 beginReturnType(const Varnode *vn)
Begin a return type declaration.
Definition: prettyprint.hh:231
Funcdata * queryExternalRefFunction(const Address &addr) const
Look-up a function thru an external reference.
Definition: database.cc:1318
TypeOpCallother(TypeFactory *t)
Constructor.
Definition: typeop.cc:676
static bool propagateTypeEdge(TypeFactory *typegrp, PcodeOp *op, int4 inslot, int4 outslot)
Attempt to propagate a data-type across a single PcodeOp edge.
Definition: coreaction.cc:4261
TypeOpFloatInt2Float(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1440
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:327
virtual ~TypeFactory(void)
Destructor.
Definition: type.cc:1357
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3914
void setChunk(const uint1 *val, AddrSpace *spc, uintb off, int4 size)
Set a chunk of data from memory state.
Definition: memstate.cc:727
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1400
void setOpcode(TypeOp *t_op)
Set the opcode for this PcodeOp.
Definition: op.cc:177
void remove(Varnode *vn)
Remove a member Varnode from this.
Definition: variable.cc:258
virtual void opBranch(const PcodeOp *op)=0
Emit a BRANCH operator.
@ f_flip_path
If true, out edges have been flipped since last time path was traced.
Definition: block.hh:90
OpCode opCode
Op-code defining Varnode.
Definition: rangeutil.hh:132
void restoreXmlBody(List::const_iterator iter)
Restore details of the Symbol from XML.
Definition: database.cc:479
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2167
void orderLoopBodies(void)
Identify and label all loop structure for this graph.
Definition: blockaction.cc:1141
virtual void setCategory(Symbol *sym, int4 cat, int4 ind)=0
Set the category and index for the given Symbol.
Varnode * getReplaceVarnode(ReplaceVarnode *rvn)
Build the logical Varnode which will replace its original containing Varnode.
Definition: subflow.cc:1212
int4 consumeSize
Minimum number of bytes to consume with the start address.
Definition: database.hh:253
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: inject_ghidra.hh:44
ConditionMarker(void)
Constructor.
Definition: condexe.cc:18
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:482
void markDead(PcodeOp *op)
Mark the given PcodeOp as dead.
Definition: op.cc:763
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: action.cc:391
bool isHeritageKnown(void) const
Return true if this Varnode is linked into the SSA tree.
Definition: varnode.hh:271
bool intersection(HighVariable *a, HighVariable *b)
Test the intersection of two HighVariables and cache the result.
Definition: merge.cc:1481
list< PcodeOp * >::const_iterator endOp(OpCode opc) const
End of PcodeOp objects with the given op-code.
Definition: funcdata.hh:452
virtual void assignMap(const vector< Datatype * > &proto, bool isinput, TypeFactory &typefactory, vector< ParameterPieces > &res) const
Given list of data-types, map the list positions to storage locations.
Definition: fspec.cc:1083
bool pullBackUnary(OpCode opc, int4 inSize, int4 outSize)
Pull-back this through the given unary operator.
Definition: rangeutil.cc:726
@ big_endian
Space is big endian if set, little endian otherwise.
Definition: space.hh:77
virtual void opFloatCeil(const PcodeOp *op)
Emit a FLOAT_CEIL operator.
Definition: printc.hh:279
virtual void executeBinary(void)
Execute a binary arithmetic/logical operation.
Definition: emulateutil.cc:174
Funcdata * fd
(If non-null) the function which this is the local Scope for
Definition: database.hh:426
JumpTable * installJumpTable(const Address &addr)
Install a new jump-table for the given Address.
Definition: funcdata_block.cc:458
@ is_cpool_transformed
Have we checked for cpool transforms.
Definition: op.hh:98
Varnode * findSpacebaseInput(AddrSpace *id) const
Definition: funcdata.cc:263
int4 getInjectId(void) const
Get the injection id associated with this.
Definition: fspec.hh:1222
bool processBlock(Funcdata &data, BlockBasic *bl)
Search a block for equivalent CPUI_MULTIEQUAL.
Definition: coreaction.cc:811
PcodeOp(int4 s, const SeqNum &sq)
Construct an unattached PcodeOp.
Definition: op.cc:71
LanedIterator const_iterator
Iterator over possible lane sizes for this register.
Definition: transform.hh:105
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2003
TypeOpIntDiv(TypeFactory *t)
Constructor.
Definition: typeop.cc:1248
@ mark_node
Node has already been in queue.
Definition: heritage.hh:174
spacetype getType(void) const
Get the type of space.
Definition: space.hh:289
virtual void opFloatSqrt(const PcodeOp *op)=0
Emit a FLOAT_SQRT operator.
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: fspec.cc:1610
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1695
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:728
virtual Datatype * castStandard(Datatype *reqtype, Datatype *curtype, bool care_uint_int, bool care_ptr_uint) const =0
Does there need to be a visible cast between the given data-types.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8518
int4 widenIteration
The iteration at which widening is attempted.
Definition: rangeutil.hh:235
bool updateHigh(HighVariable *a)
Make sure given HighVariable's Cover is up-to-date.
Definition: merge.cc:1441
void guardLoads(uint4 flags, const Address &addr, int4 size, vector< Varnode * > &write)
Guard LOAD ops in preparation for the renaming algorithm.
Definition: heritage.cc:1201
@ p_register
Unordered parameter passing locations model.
Definition: fspec.hh:344
static uint4 getPositionFromHash(uint8 h)
Retrieve the encoded position from a hash.
Definition: dynamic.cc:499
void truncateSpace(uint4 newsize)
Definition: space.cc:104
static OpToken enum_cat
The concatenation operator for enumerated values.
Definition: printc.hh:114
Varnode * vn
The Varnode at this particular point in the path.
Definition: coreaction.hh:418
BlockCondition * newBlockCondition(FlowBlock *b1, FlowBlock *b2)
Build a new BlockCondition.
Definition: block.cc:1673
statusflags
Boolean properties describing the status of an action.
Definition: action.hh:62
virtual void tagLabel(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a code label identifier.
Definition: prettyprint.cc:276
vector< TypeOp * > inst
Registered p-code instructions.
Definition: architecture.hh:152
TypeOpIntSless(TypeFactory *t)
Constructor.
Definition: typeop.cc:852
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4907
RulePtrFlow(const string &g, Architecture *conf)
Constructor.
Definition: ruleaction.cc:7385
@ CPUI_NEW
Allocate a new object (new)
Definition: opcodes.hh:122
@ f_mark
Generic way to mark a block.
Definition: block.hh:81
Propagate constants through a SEGMENTOP.
Definition: ruleaction.hh:1220
Datatype object representing executable code.
Definition: type.hh:329
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:713
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:530
void generateLoadGuard(StackNode &node, PcodeOp *op, AddrSpace *spc)
Generate a guard record given an indexed LOAD into a stack space.
Definition: heritage.cc:757
bool createLink(ReplaceOp *rop, uintb mask, int4 slot, Varnode *vn)
Add a new variable to the logical subgraph as an input to the given operation.
Definition: subflow.cc:943
virtual void buildConstantPool(DocumentStorage &store)
Build the constant pool.
Definition: ghidra_arch.cc:349
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:134
virtual bool initializeForReading(void) const
Initialize this for iterating over the set of possible values.
Definition: jumptable.cc:336
static OpToken multiply
The multiplication operator.
Definition: printc.hh:78
circularqueue< TokenSplit > tokqueue
The full stream of tokens.
Definition: prettyprint.hh:714
Command to toggle options within the decompiler.
Definition: ghidra_process.hh:222
Simplify multiple INT_ZEXT operations: zext( zext(V) << c ) => zext(V) << c
Definition: ruleaction.hh:804
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:1041
int4 varnodeIndex
Position of the normalized switch Varnode within PathMeld.
Definition: jumptable.hh:349
virtual void resolveArchitecture(void)
Figure out the processor and compiler of the target executable.
Definition: raw_arch.cc:64
VarnodeDefSet::const_iterator beginDef(uint4 fl, const Address &addr) const
Start of (input or free) Varnodes at a given storage address.
Definition: funcdata.hh:348
@ CPUI_SEGMENTOP
Look-up a segmented address.
Definition: opcodes.hh:120
AddrSpace * baseSpace
Space being overlayed.
Definition: space.hh:239
uint4 high_level_index
Creation index of first Varnode created after HighVariables are created.
Definition: funcdata.hh:64
A collection of p-code injection payloads.
Definition: pcodeinject.hh:162
ProtoModel(Architecture *g)
Constructor for use with restoreXml()
Definition: fspec.cc:1753
Class encapsulating the action/behavior of specific pcode opcodes.
Definition: opbehavior.hh:42
bool option_convention
Set to true if we should print calling convention.
Definition: printc.hh:117
virtual Architecture * buildArchitecture(const string &filename, const string &target, ostream *estream)
Build an Architecture given a raw file or data.
Definition: raw_arch.cc:33
BlockWhileDo * newBlockWhileDo(FlowBlock *cond, FlowBlock *cl)
Build a new BlockWhileDo.
Definition: block.cc:1751
void splitPieces(const vector< Varnode * > &vnlist, PcodeOp *insertop, const Address &addr, int4 size, Varnode *startvn)
Build a set of Varnode piece expression at the given location.
Definition: heritage.cc:411
int4 characterizeAsInputParam(const Address &addr, int4 size) const
Decide whether a given storage location could be, or could hold, an input parameter.
Definition: fspec.cc:3404
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:413
string name
Name of function.
Definition: loadimage.hh:38
bool setFallthruBound(Address &bound)
Find end of the next unprocessed region.
Definition: flow.cc:475
int4 getRepeatSlot(const Varnode *vn, int4 firstSlot, list< PcodeOp * >::const_iterator iter) const
Find the slot for a given Varnode, which may be take up multiple input slots.
Definition: op.cc:93
void updateInputNoTypes(const vector< Varnode * > &triallist, ParamActive *activeinput, TypeFactory *factory)
Update input parameters based on Varnode trials, but do not store the data-type.
Definition: fspec.cc:3218
iterator find(Address addr)
Look up if/how given address was heritaged.
Definition: heritage.cc:69
virtual void setNameLock(bool val)=0
Toggle the lock on the name.
static void replaceEdgeMap(vector< BlockEdge > &vec)
Update block references in edges with copy map.
Definition: block.cc:256
PrintCCapability(void)
Initialize the singleton.
Definition: printc.cc:79
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:971
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1142
TypeOpFloatDiv(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1398
SymbolEntry * addMapPoint(Symbol *sym, const Address &addr, const Address &usepoint)
Map a Symbol to a specific address.
Definition: database.cc:1487
void setDef(PcodeOp *op)
Set the defining PcodeOp of this Varnode.
Definition: varnode.cc:351
uintb last
Ending offset of the ParamEntry's range.
Definition: fspec.hh:106
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1440
virtual void opFloatInt2Float(const PcodeOp *op)
Emit a FLOAT_INT2FLOAT operator.
Definition: printc.hh:276
virtual bool isNameUndefined(void) const =0
Is the name of this parameter undefined.
string name
(Human readable) name of the compiler
Definition: sleigh_arch.hh:30
void * Locator
Placeholder for a document locator object.
Definition: xml.hh:71
void overflow(void)
Reset indenting levels to accommodate a token that won't fit.
Definition: prettyprint.cc:582
OpCode assumedOutputExtension(const Address &addr, int4 size, VarnodeData &res) const
Get the type of extension and containing return value location for the given storage.
Definition: fspec.hh:1397
Toggle whether implied extensions (ZEXT or SEXT) are printed.
Definition: options.hh:147
VarnodeDefSet::const_iterator endDef(uint4 fl, const Address &addr) const
End of (input or free) Varnodes at a given storage address.
Definition: funcdata.hh:351
void applyForceGoto(Funcdata &data) const
Push all the force-goto overrides into the function.
Definition: override.cc:194
TypeOpSubpiece(TypeFactory *t)
Constructor.
Definition: typeop.cc:1569
string explain
Definition: error.hh:45
ActionDatabase allacts
Actions that can be applied in this architecture.
Definition: architecture.hh:156
static int4 findFront(int4 blocknum, const vector< BlockVarnode > &list)
Find the first Varnode defined in the BlockBasic of the given index.
Definition: merge.cc:41
int4 getOutIndex(const FlowBlock *bl) const
Get the outgoing edge index for the given FlowBlock.
Definition: block.cc:562
virtual void postSpecFile(void)
Read in image information (which uses translator)
Definition: xml_arch.cc:72
int4 slot
Matching slot within the resource list.
Definition: fspec.hh:848
const PcodeOp * stop
End of the range.
Definition: cover.hh:37
list< SymbolEntry > dynamicentry
Dynamic symbol entries.
Definition: database.hh:733
void freePlaceholderSlot(void)
Free the stack placeholder slot.
Definition: fspec.cc:1436
virtual void getRangeList(AddrSpace *spc, RangeList &res) const
For a given address space, collect all the parameter locations within that space.
Definition: fspec.cc:1008
virtual void setEmulate(Emulate *emu)=0
Associate a particular emulator with breakpoints in this table.
Collapse constant expressions.
Definition: ruleaction.hh:619
Classes for more detailed definitions of user defined p-code operations.
Varnode * createDefUnique(int4 s, Datatype *ct, PcodeOp *op)
Create a temporary Varnode as output of a PcodeOp.
Definition: varnode.cc:1050
bool option_unplaced
Set to true if we should display unplaced comments.
Definition: printc.hh:119
map< int4, Varnode * > replacement
Map from block to replacement Varnode for (current) Varnode.
Definition: condexe.hh:144
CPUI_BOOL_NEGATE behavior.
Definition: opbehavior.hh:320
Information about the INT_NEGATE op-code.
Definition: typeop.hh:415
bool isInvalid(void) const
Is the address invalid?
Definition: address.hh:256
int4 skipLanes
Number of lanes to skip in the global description.
Definition: subflow.hh:172
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:401
string set(const string &nm, const string &p1="", const string &p2="", const string &p3="")
Issue an option command.
Definition: options.cc:98
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:123
bool execute(PcodeOp *op, int4 slot, ParamTrial *t, bool allowFail)
Perform a full ancestor check on a given parameter trial.
Definition: funcdata_varnode.cc:1720
FlowBlock * bottom
Current node being traversed along 1 path from decision point.
Definition: blockaction.hh:129
virtual void markLabelBumpUp(bool bump)
Let hierarchical blocks steal labels of their (first) components.
Definition: block.cc:2983
A function parameter viewed as a name, data-type, and storage address.
Definition: fspec.hh:903
bool evaluatePropagation(FlowBlock *root, FlowBlock *branch)
Can this expression be propagated.
Definition: ruleaction.cc:7831
virtual bool isOverride(void) const
Return true if this model was manually overridden.
Definition: jumptable.hh:380
A composite Datatype object: A "structure" with component "fields".
Definition: type.hh:301
set< string > list
List of group names.
Definition: action.hh:31
void nodeSplitRawDuplicate(BlockBasic *b, BlockBasic *bprime)
Clone all p-code ops from a block into its copy.
Definition: funcdata_block.cc:806
static void savePathXml(ostream &s, const vector< string > &vec)
Save a path with <val> tags.
Definition: database.cc:2474
int4 localcount
Number of times this Action has been performed on the function.
Definition: coreaction.hh:122
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4996
set< Address > readonlyset
Starting address of read-only chunks.
Definition: loadimage_xml.hh:32
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:1091
AddrSpace * getSpaceByShortcut(char sc) const
Get address space from its shortcut.
Definition: translate.cc:538
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2927
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8821
void setupMultiequals(void)
Join the Varnodes in the new joinblock.
Definition: blockaction.cc:2003
uintb consumed
What parts of this varnode are used.
Definition: varnode.hh:143
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:414
virtual Action * getSubAction(const string &specify)
Retrieve a specific sub-action by name.
Definition: action.cc:267
An entry on the reverse polish notation (RPN) stack.
Definition: printlanguage.hh:166
void buildOpUp(const PcodeOp *op)
Move input Varnodes for the given PcodeOp into staging.
Definition: dynamic.cc:149
virtual void fallthruOp(void)
Execute fallthru semantics for the pcode cache.
Definition: emulate.cc:389
union Varnode::@33 temp
Temporary storage for analysis algorithms.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3632
list< PcodeOp * > block_edge2
Destination p-code op (Edges between basic blocks)
Definition: flow.hh:91
@ heritaged
This space is heritaged.
Definition: space.hh:78
Information about the FLOAT_NEG op-code.
Definition: typeop.hh:608
A cheap (efficient) placeholder for a reference to a constant pool record.
Definition: cpool.hh:165
static void makeRec(ProtoParameter *param, Varnode *vn, map< HighVariable *, OpRecommend > &recmap)
Add a recommendation to the database based on a particular sub-function parameter.
Definition: coreaction.cc:2345
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore this from XML stream.
Definition: address.cc:277
type_metatype metaout
The metatype of the output.
Definition: typeop.hh:173
bool rightIsStable
Set to true if right boundary of range didn't change (last iteration)
Definition: rangeutil.hh:185
virtual void findUnnormalized(uint4 maxaddsub, uint4 maxleftright, uint4 maxext)
Recover the unnormalized switch variable.
Definition: jumptable.hh:484
@ blanktoken
For anonymous types.
Definition: printlanguage.hh:162
void grabCaseBasic(FlowBlock *switchbl, const vector< FlowBlock * > &cs)
Build annotated CaseOrder objects.
Definition: block.cc:3053
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:555
virtual bool doPcodeOpBreak(PcodeOpRaw *curop)
Invoke any breakpoints for the given pcode op.
Definition: emulate.cc:72
void tagComment(const char *ptr, EmitXml::syntax_highlight h, const AddrSpace *s, uintb o)
Create a comment string in the generated source code.
Definition: prettyprint.hh:492
virtual int4 instructionLength(const Address &baseaddr) const
Get the length of a machine instruction.
Definition: ghidra_translate.hh:52
@ special_print
Op is marked for special printing.
Definition: op.hh:107
bool isDoNothing(void) const
Should this block should be removed.
Definition: block.cc:2489
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2506
An input or output parameter to a p-code injection payload.
Definition: pcodeinject.hh:33
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1041
@ inherits_sign
Operator token inherits signedness from its inputs.
Definition: typeop.hh:40
virtual void resetSizeLockType(TypeFactory *factory)
Clear this parameter's data-type preserving any size-lock.
Definition: fspec.cc:2399
virtual bool doWidening(const ValueSet &valueSet, CircleRange &range, const CircleRange &newRange)
For an iteration that isn't stabilizing attempt to widen the given ValueSet.
Definition: rangeutil.cc:1833
static OpToken bitwise_not
The bitwise negate operator.
Definition: printc.hh:71
int4 shift
Right-shift amount to apply when unpacking this value from its word.
Definition: globalcontext.hh:34
static void readStringStream(istream &s, string &res)
Receive a string from the client.
Definition: ghidra_arch.cc:88
virtual void adjustVma(long adjust)=0
Adjust load addresses with a global offset.
list< LoadGuard > loadGuard
List of LOAD operations that need to be guarded.
Definition: heritage.hh:214
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:680
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:367
virtual void restoreXml(const Element *el)
Restore this model from an XML stream.
Definition: fspec.cc:1893
virtual bool pushEquate(uintb val, int4 sz, const EquateSymbol *sym, const Varnode *vn, const PcodeOp *op)
Push a constant marked up by and EquateSymbol onto the RPN stack.
Definition: printc.cc:1468
BreakTableCallBack(Translate *t)
Basic breaktable constructor.
Definition: emulate.hh:154
CircleRange(uintb lft, uintb rgt, int4 size, int4 stp)
Construct given specific boundaries.
Definition: rangeutil.cc:177
uintb pcode_right(uintb val, int4 sa)
Definition: address.hh:473
void insertInput(int4 slot)
Make room for a new input Varnode at a specific position.
Definition: op.cc:211
bool testShrink(const Address &newaddr, int4 sz) const
Test if this trial can be made smaller.
Definition: fspec.cc:1333
virtual int4 getSize(void) const
Get the number of bytes occupied by this parameter.
Definition: fspec.hh:975
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:1181
uintm uniqid
Counter for generating unique offsets.
Definition: varnode.hh:329
void setXML(bool val)
Toggle whether the low-level emitter emits XML markup or not.
Definition: prettyprint.cc:1193
OpCode opc
Opcode of the new op.
Definition: subflow.hh:56
bool parentheses(const OpToken *op2)
Determine if the given token should be emitted in its own parenthetic expression.
Definition: printlanguage.cc:267
Symbol * addMapSym(const Element *el)
Add a mapped Symbol from a <mapsym> XML tag.
Definition: database.cc:1503
static OpToken less_equal
The less than or equal operator.
Definition: printc.hh:86
virtual void opIntRem(const PcodeOp *op)=0
Emit a INT_REM operator.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4800
AddrSpace * getSpace(int4 i) const
Get an address space via its index.
Definition: translate.hh:544
int4 res
The meta-command being issued to send back.
Definition: ghidra_process.hh:124
void processCopyTrims(void)
Try to reduce/eliminate COPYs produced by the merge trimming process.
Definition: merge.cc:1265
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:1370
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: condexe.hh:175
TypeOpIntLessEqual(TypeFactory *t)
Constructor.
Definition: typeop.cc:906
Node for depth-first traversal of stack references.
Definition: heritage.hh:179
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1488
string name
Symbol denoting this operation.
Definition: typeop.hh:48
AddrSpace * stackspace
Stack space associated with processor.
Definition: translate.hh:229
void guardReturns(uint4 flags, const Address &addr, int4 size, vector< Varnode * > &write)
Guard global data-flow at RETURN ops in preparation for renaming.
Definition: heritage.cc:1246
list< PcodeOp * >::const_iterator iter
Next PcodeOp to follow.
Definition: heritage.hh:187
Allow type recovery to start happening.
Definition: coreaction.hh:68
void parseProcessorConfig(DocumentStorage &store)
Apply processor specific configuration.
Definition: architecture.cc:1063
Facilities for retrieving symbol information from a Ghidra client.
uint4 crc32tab[]
Table for quickly computing a 32-bit Cyclic Redundacy Check (CRC)
Definition: crc32.cc:20
Address minaddr
Start of actual function range.
Definition: flow.hh:96
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1742
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:626
uint4 dispflags
Flags affecting the display of this symbol.
Definition: database.hh:165
TypeOpPtrsub(TypeFactory *t)
Constructor.
Definition: typeop.cc:1660
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:307
Remove blocks that do nothing.
Definition: coreaction.hh:490
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2861
bool operator<(const SeqNum &op2) const
Compare two sequence numbers with their natural order.
Definition: address.hh:144
Support for decoding different floating-point formats.
tokentype type
The basic token type.
Definition: printlanguage.hh:96
BlockDoWhile * newBlockDoWhile(FlowBlock *condcl)
Build a new BlockDoWhile.
Definition: block.cc:1767
virtual void endReturnType(int4 id)
End a return type declaration.
Definition: prettyprint.cc:933
OpCode opcode
The op-code value.
Definition: typeop.hh:45
virtual void opFloatLessEqual(const PcodeOp *op)
Emit a FLOAT_LESSEQUAL operator.
Definition: printc.hh:267
static int4 testCompareEquivalence(PcodeOp *lessop, PcodeOp *lessequalop)
Make sure comparisons match properly for a three-way.
Definition: ruleaction.cc:8208
virtual void print(const char *str, syntax_highlight hl=no_color)
Emit other (more unusual) syntax as part of source code generation.
Definition: prettyprint.hh:256
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:337
int4 overlap(const Varnode &op) const
Return relative point of overlap between two Varnodes.
Definition: varnode.cc:170
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl, const Datatype *c, int4 off)
Construct a token for a field name.
Definition: printlanguage.hh:215
Datatype * typecache[9][8]
Matrix of the most common atomic data-types.
Definition: type.hh:387
void assignShortcut(AddrSpace *spc)
Select a shortcut character for a new space.
Definition: translate.cc:451
int4 size
Size of the range in bytes.
Definition: fspec.hh:68
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:94
void replaceUsingMap(void)
Update references to other blocks using getCopyMap()
Definition: block.cc:267
int4 getBoundary(int4 bytePos) const
Get index of lane that starts at the given byte position.
Definition: transform.cc:96
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:797
Factory and static initializer for the "java-language" back-end to the decompiler.
Definition: printjava.hh:28
@ incidental_copy
Treat this as incidental for parameter recovery algorithms.
Definition: op.hh:110
bool checkInputSplit(const Address &loc, int4 size, int4 splitpoint) const
Check if it makes sense to split a single storage location into two input parameters.
Definition: fspec.hh:1327
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:344
Set the prototype model to use when evaluating the parameters of the current function.
Definition: options.hh:237
void parseExtraRules(DocumentStorage &store)
Apply any Rule tags.
Definition: architecture.cc:1199
bool syncVarnodesWithSymbols(const ScopeLocal *lm, bool typesyes)
Update Varnode properties based on (new) Symbol information.
Definition: funcdata_varnode.cc:804
vector< FlowBlock * > merge
Calculate merge points (blocks containing phi-nodes)
Definition: heritage.hh:212
bool isConstructor(void) const
Is this prototype for a class constructor method.
Definition: fspec.hh:1249
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1001
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1330
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:46
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: op.cc:55
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:988
@ CPUI_FLOAT_EQUAL
Floating-point comparison, equality (==)
Definition: opcodes.hh:86
@ rem_formed
The trial is built out of a remainder operation.
Definition: fspec.hh:166
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:866
void parseNoHighPtr(const Element *el)
Apply memory alias configuration.
Definition: architecture.cc:1012
void printBlockTree(ostream &s) const
Print a description of control-flow structuring to a stream.
Definition: funcdata_block.cc:25
void expand(int4 amount)
Expand the (maximum) size of the queue.
Definition: prettyprint.hh:665
uintb offset
Offset relative to base.
Definition: heritage.hh:185
Classes for processing architecture configuration options.
Class for tracing changes of precision in floating point variables.
Definition: subflow.hh:150
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:641
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:312
OpStackElement(Varnode *v)
Constructor.
Definition: coreaction.cc:2651
Transform INT_LESS of 0 or 1: V < 1 => V == 0, V <= 0 => V == 0
Definition: ruleaction.hh:288
virtual bool foldInOneGuard(Funcdata *fd, GuardRecord &guard, JumpTable *jump)
Eliminate the given guard to this switch.
Definition: jumptable.cc:1506
static void partitionPrepend(ValueSet *vertex, Partition &part)
Prepend a vertex to a partition.
Definition: rangeutil.hh:387
static OpToken orequal
The in-place logical or operator.
Definition: printc.hh:108
@ highlevel_on
Set if Varnodes have HighVariables assigned.
Definition: funcdata.hh:47
virtual void assignMap(const vector< Datatype * > &proto, bool isinput, TypeFactory &typefactory, vector< ParameterPieces > &res) const =0
Given list of data-types, map the list positions to storage locations.
@ endpoint
An (artificial) boundary to the range of bytes getting analyzed.
Definition: varmap.hh:77
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:431
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4050
bool containedBy(const Address &addr, int4 sz) const
Is this entry contained by the given range.
Definition: fspec.cc:77
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:453
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3520
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1341
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)=0
Restore the model from an XML stream.
A SLEIGH based implementation of the Emulate interface.
Definition: emulate.hh:296
@ push_patch
Convert an operator output to the logical value.
Definition: subflow.hh:71
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1152
PcodeOpRaw * currentOp
Current op to execute.
Definition: emulate.hh:246
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3085
bool operator==(const ProtoParameter &op2) const
Compare storage location and data-type for equality.
Definition: fspec.hh:945
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2690
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1098
static OpToken boolean_not
The boolean not operator.
Definition: printc.hh:72
virtual string buildUndefinedName(void) const
Build a formal undefined name, used internally when a Symbol is not given a name.
Definition: database_ghidra.hh:74
@ TYPE_SPACEBASE
Placeholder for symbol/type look-up calculations.
Definition: type.hh:35
Large scale transformations applied to the varnode/op graph.
Definition: action.hh:50
@ error_reinterpreted
Throw an exception for flow into previously encountered data at a difference cut.
Definition: flow.hh:62
A class for generating the control-flow structure for a single function.
Definition: flow.hh:56
PcodeOp * cloneOp(const PcodeOp *op, const SeqNum &seq)
Definition: funcdata_op.cc:566
static void propagateConsumed(vector< Varnode * > &worklist)
Propagate the consumed value for one Varnode.
Definition: coreaction.cc:3096
Varnode * vn
Varnode being shrunk.
Definition: subflow.hh:44
virtual void docSingleGlobal(const Symbol *sym)
Emit the declaration for a single (global) Symbol.
Definition: printc.cc:2240
virtual int4 characterizeAsParam(const Address &loc, int4 size) const
Characterize whether the given range overlaps parameter storage.
Definition: fspec.cc:469
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:333
Information about the INT_SUB op-code.
Definition: typeop.hh:375
virtual Datatype * getType(void) const
Get the data-type associate with this.
Definition: fspec.hh:973
static bool compare(const StackEqn &a, const StackEqn &b)
Order two equations.
Definition: coreaction.cc:52
uint4 flags
Behavior properties.
Definition: action.hh:82
void stopIndent(int4 id)
Create an "end an indent level" command.
Definition: prettyprint.hh:555
Varnode * bool3vn
If the second param to binaryop is defined by BOOL_NEGATE, this is the unnegated Varnode.
Definition: condexe.hh:38
virtual void emitFunctionDeclaration(const Funcdata *fd)=0
Emit a function declaration.
@ force_char
Force integer to be printed as a character constant.
Definition: database.hh:181
@ is_destructor
Referenced method is a destructor.
Definition: cpool.hh:60
Address spacebase
Starting address of the stack-pointer.
Definition: coreaction.cc:35
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:285
virtual Varnode * foldInNormalization(Funcdata *fd, PcodeOp *indop)
Do normalization of the given switch specific to this model.
Definition: jumptable.hh:332
uint4 wholeCount
Number of SymbolEntries that map to the whole Symbol.
Definition: database.hh:170
virtual SymbolEntry * addDynamicMapInternal(Symbol *sym, uint4 exfl, uint8 hash, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a dynamic hash.
Definition: database.cc:1761
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:716
virtual void opConstructor(const PcodeOp *op, bool withNew)=0
Emit an operator constructing an object.
A class for analyzing parameters to a sub-function call.
Definition: fspec.hh:1436
void zero_extend(intb &val, int4 bit)
Clear all bits above given bit.
Definition: address.cc:639
virtual bool isSubpieceCast(Datatype *outtype, Datatype *intype, uint4 offset) const
Is truncating an input data-type, producing an output data-type, considered a cast.
Definition: cast.cc:306
void reset(int4 maxdepth)
Reset to an empty queue.
Definition: heritage.cc:97
void markNotMapped(AddrSpace *spc, uintb first, int4 sz, bool param)
Mark a specific address range is not mapped.
Definition: varmap.cc:354
Mark Varnode objects that hold stack-pointer values and set-up special data-type.
Definition: coreaction.hh:264
virtual void setPage(uintb addr, const uint1 *val, int4 skip, int4 size)
Write data into a memory page.
Definition: memstate.cc:134
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1256
int4 maxlinesize
Maximum number of characters allowed in a line.
Definition: prettyprint.hh:707
virtual void opIntAnd(const PcodeOp *op)
Emit a INT_AND operator.
Definition: printc.hh:250
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: double.cc:2942
static const Scope * stackExternalRef(const Scope *scope1, const Scope *scope2, const Address &addr, ExternRefSymbol **addrmatch)
Definition: database.cc:972
@ f_loop_edge
Edge completes a loop, removing these edges gives you a DAG.
Definition: block.hh:97
void gatherOpen(const Funcdata &fd)
Add pointer references as hints to the collection.
Definition: varmap.cc:940
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:612
PcodeOp * assistOp
The jumpassist PcodeOp.
Definition: jumptable.hh:473
void applyDeadCodeDelay(Funcdata &data) const
Apply any dead-code delay overrides.
Definition: override.cc:207
uint8 hash
if (hash==0) there is no normalized switch (use trivial model)
Definition: jumptable.hh:431
Varnode * findVarnode(const Funcdata *fd, const Address &addr, uint8 h)
Given an address and hash, find the unique matching Varnode.
Definition: dynamic.cc:396
void extendToContainer(const LoopBody &container, vector< FlowBlock * > &body) const
Find blocks in containing loop that aren't in this.
Definition: blockaction.cc:44
Commute SUBPIECE and INT_ZEXT: sub(zext(V),c) => zext(sub(V,c))
Definition: ruleaction.hh:743
uint1 * load(int4 size, const Address &addr)
Load a chunk of image.
Definition: loadimage.cc:27
PcodeOp * loneDescend(void) const
Return unique reading PcodeOp, or null if there are zero or more than 1.
Definition: varnode.cc:569
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:341
bool leftIsStable
Set to true if left boundary of range didn't change (last iteration)
Definition: rangeutil.hh:133
Translate * trans
Architecture information about memory spaces.
Definition: memstate.hh:150
@ modified
This op has been modified by the current action.
Definition: op.hh:108
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:320
void intersectList(vector< int4 > &listout, const Cover &op2, int4 level) const
Generate a list of blocks that intersect.
Definition: cover.cc:305
Database of root Action objects that can be used to transform a function.
Definition: action.hh:294
bool calculated
Have aliases been calculated.
Definition: varmap.hh:121
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:291
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2563
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:680
void opInsertInput(PcodeOp *op, Varnode *vn, int4 slot)
Insert a new Varnode into the operand list for the given PcodeOp.
Definition: funcdata_op.cc:281
uintb localBoundary
Boundary offset separating locals and parameters.
Definition: varmap.hh:123
@ is_constructor
Function is an (object-oriented) constructor.
Definition: fspec.hh:1159
uintm getCseHash(void) const
Return hash indicating possibility of common subexpression elimination.
Definition: op.cc:131
virtual int4 flipInPlaceTest(vector< PcodeOp * > &fliplist) const
Test normalizing the conditional branch in this.
Definition: block.cc:2756
maptype::iterator iterator
A partmap iterator is an iterator into the map.
Definition: partmap.hh:51
virtual void saveXml(ostream &s) const
Serialize the entire database to an XML stream.
Definition: ghidra_context.hh:66
void getPieces(PrototypePieces &pieces) const
Get the raw pieces of the prototype.
Definition: fspec.cc:3006
Translate * trans
The translator.
Definition: emulate.hh:139
FlowBlock * getStartBlock(void) const
Get the entry point FlowBlock.
Definition: block.cc:1549
TypeOpIntLess(TypeFactory *t)
Constructor.
Definition: typeop.cc:888
PcodeOp * newOpBefore(PcodeOp *follow, OpCode opc, Varnode *in1, Varnode *in2, Varnode *in3=(Varnode *) 0)
Allocate a new PcodeOp with sequence number.
Definition: funcdata_op.cc:606
virtual void adjustTypeOperators(void)=0
Set basic data-type information for p-code operators.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4853
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1184
virtual void opBoolOr(const PcodeOp *op)
Emit a BOOL_OR operator.
Definition: printc.hh:263
int4 intersectByBlock(int4 blk, const Cover &op2) const
Characterize the intersection on a specific block.
Definition: cover.cc:342
uintb getLabel(int4 i, int4 j) const
Get a specific label associated with a case block.
Definition: block.hh:665
virtual void opIntEqual(const PcodeOp *op)
Emit a INT_EQUAL operator.
Definition: printc.hh:234
Description of a context variable within the disassembly context blob.
Definition: globalcontext.hh:30
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4091
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:371
uintb extravalue
The extra value.
Definition: jumptable.hh:204
int4 depth
How deep in a fall-thru chain we are.
Definition: block.hh:637
static const uint1 * unpackVarnodeData(const uint1 *ptr, VarnodeData &v, const AddrSpaceManager *trans)
Helper function for unpacking a varnode from a pcode byte stream.
Definition: translate.cc:946
TypePointer * getTypePointerNoDepth(int4 s, Datatype *pt, uint4 ws)
Construct a depth limited pointer data-type.
Definition: type.cc:1786
void setCurrentOp(int4 i)
Set the current executing p-code op by index.
Definition: emulateutil.hh:163
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2819
std::multiset< AddrRange > tree
The underlying multiset of sub-ranges.
Definition: rangemap.hh:128
VarnodeData defaultReturnAddr
Default storage location of return address (for current function)
Definition: architecture.hh:139
uint4 hasEffect(const Address &addr, int4 size) const
Determine side-effect of this on the given memory range.
Definition: fspec.cc:1885
Compare two Datatype pointers for equivalence of their description.
Definition: type.hh:132
virtual void tagField(const char *ptr, syntax_highlight hl, const Datatype *ct, int4 off)
Emit an identifier for a field within a structured data-type.
Definition: prettyprint.hh:248
virtual bool checkIntPromotionForCompare(const PcodeOp *op, int4 slot) const
Check if integer promotion forces a cast for the given comparison op and slot.
Definition: cast.cc:28
virtual void opFloatLessEqual(const PcodeOp *op)=0
Emit a FLOAT_LESSEQUAL operator.
Registration point and dispatcher for commands sent to the decompiler.
Definition: ghidra_process.hh:38
Exception indicating data was not available.
Definition: loadimage.hh:29
const FlowBlock * condBlock
Conditional block determining if zero is set or not.
Definition: condexe.hh:217
bool trialSetPtrFlow(PcodeOp *op)
Definition: ruleaction.cc:7412
int4 depth
Depth of BranchPoints from the root.
Definition: blockaction.hh:105
static void propagateRef(Funcdata &data, Varnode *vn, const Address &addr)
Try to propagate a pointer data-type to known aliases.
Definition: coreaction.cc:4460
bool cacheDirty
Is flagbaseDefault different from cache.
Definition: database_ghidra.hh:41
Class holding a particular widening strategy for the ValueSetSolver iteration algorithm.
Definition: rangeutil.hh:202
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:746
virtual SymbolEntry * findClosestFit(const Address &addr, int4 size, const Address &usepoint) const
Find Symbol which is the closest fit to the given memory range.
Definition: database.cc:2147
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.cc:19
int4 slot
Slot containing the input Varnode or -1 for the p-code op output.
Definition: dynamic.hh:32
virtual void executeUnary(void)=0
Execute a unary arithmetic/logical operation.
PcodeOp * op
An op in the container.
Definition: jumptable.hh:69
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:367
virtual void renameSymbol(Symbol *sym, const string &newname)
Rename a Symbol within this Scope.
Definition: database_ghidra.hh:106
void putRecord(const vector< uintb > &refs, uint4 tag, const string &tok, Datatype *ct)
A a new constant pool record to this database.
Definition: cpool.cc:157
bool isDirty
Set to true if a node in this component has changed this iteration.
Definition: rangeutil.hh:163
vector< OpBehavior * > inst
Collected behaviors for the ExecutablePcode payloads.
Definition: inject_ghidra.hh:82
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:204
bool functionalEquality(Varnode *vn1, Varnode *vn2)
Determine if two Varnodes hold the same value.
Definition: op.cc:1059
Varnode * vn
The root Varnode.
Definition: coreaction.hh:1027
@ f_interior_gotoout
The block has an unstructured jump out of interior.
Definition: block.hh:84
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8385
void clearCache(void)
Clear the p-code cache.
Definition: emulate.cc:339
virtual void saveXml(ostream &s) const =0
Serialize the entire database to an XML stream.
FlowBlock * top
FlowBlock that embodies the branch point.
Definition: blockaction.hh:103
virtual SymbolEntry * findOverlap(const Address &addr, int4 size) const
Find first Symbol overlapping the given memory range.
Definition: database_ghidra.hh:90
virtual void opBranchind(const PcodeOp *op)=0
Emit a BRANCHIND operator.
Exception that mirrors exceptions thrown by the Ghidra client.
Definition: ghidra_arch.hh:33
bool rangeLocked
True if the subset of addresses mapped to this scope has been locked.
Definition: varmap.hh:188
virtual InjectContext & getCachedContext(void)=0
Retrieve a reusable context object for this library.
virtual bool isFileMatch(const string &filename) const
Determine if this extension can handle this file.
Definition: xml_arch.cc:33
virtual void pushTypeEnd(const Datatype *ct)
Push the tail ends of a data-type declaration onto the RPN stack.
Definition: printc.cc:228
static bool compareByEntryAddress(const FuncCallSpecs *a, const FuncCallSpecs *b)
Compare FuncCallSpecs by function entry address.
Definition: fspec.hh:1527
Find a prototype for each sub-function.
Definition: coreaction.hh:623
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:845
An XML element. A node in the DOM tree.
Definition: xml.hh:150
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:721
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:513
static uintb gatherConsumedReturn(Funcdata &data)
Determine how the return values for the given function are consumed.
Definition: coreaction.cc:3384
void checkstring(void)
Enforce whitespace for a content token.
Definition: prettyprint.cc:807
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:231
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl, const PcodeOp *o)
Construct a token with an associated PcodeOp.
Definition: printlanguage.hh:219
uintb useoffset
Offset into the sub-sorting address space.
Definition: database.hh:86
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3342
virtual bool unify(Funcdata &data, PcodeOp *op, vector< Varnode * > &bindlist) const
Gather the formal input Varnode objects given the root PcodeOp.
Definition: userop.cc:127
void deindirect(Funcdata &data, Funcdata *newfd)
Convert this call site from an indirect to a direct function call.
Definition: fspec.cc:4476
int4 size
Number of words in a context blob (for this architecture)
Definition: globalcontext.hh:273
istream & sin
The input stream from the Ghidra client.
Definition: ghidra_process.hh:73
virtual void addSymbolInternal(Symbol *sym)
Put a Symbol into the name map.
Definition: database.cc:1699
void labelExitEdges(const vector< FlowBlock * > &body)
Label edges that exit the loop.
Definition: blockaction.cc:263
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1223
static int4 transformPtr(PcodeOp *bottom_op, PcodeOp *ptr_op, int4 slot, Funcdata &data)
Rewrite a pointer expression using PTRSUB and PTRADD.
Definition: ruleaction.cc:5757
int4 boundary(const PcodeOp *point) const
Characterize given point as boundary.
Definition: cover.cc:127
static Varnode * quasiCopy(Varnode *vn, int4 &bitsPreserved)
Compute the source of a quasi-COPY chain for the given Varnode.
Definition: jumptable.cc:675
Architecture * glb
The architecture owning the segmented space.
Definition: architecture.hh:283
Simplify INT_EQUAL applied to 0: 0 == V + W * -1 => V == W or 0 == V + c => V == -c
Definition: ruleaction.hh:975
void createInstruction(const Address &addr)
Cache pcode for instruction at given address.
Definition: emulate.cc:364
Helper class for not doing any sub-sorting of overlapping ScopeMapper ranges.
Definition: database.hh:798
void clearUnlocked(Scope *scope)
Clear unlocked Symbols owned by the given Scope.
Definition: database.cc:2843
Information about the FLOAT_SUB op-code.
Definition: typeop.hh:601
CircleRange range
Range of values or offsets in this set.
Definition: rangeutil.hh:136
int4 endbit
Ending bit of the value within its word.
Definition: globalcontext.hh:33
uint4 flags
Properties enabled with this Rule.
Definition: action.hh:203
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2952
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl, const PcodeOp *o, const Funcdata *f)
Construct a token for a function name.
Definition: printlanguage.hh:227
virtual void pushTypeStart(const Datatype *ct, bool noident)
Push part of a data-type declaration onto the RPN stack, up to the identifier.
Definition: printc.cc:179
static OpToken bitwise_and
The logical and operator.
Definition: printc.hh:91
void parseOne(const Element *el)
Unwrap and execute a single option XML tag.
Definition: options.cc:111
@ CPUI_FLOAT_SQRT
Floating-point square root (sqrt)
Definition: opcodes.hh:99
CPUI_INT_CARRY behavior.
Definition: opbehavior.hh:205
void issueWarning(Architecture *glb)
If enabled, print a warning that this Rule has been applied.
Definition: action.cc:621
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:611
uint2 addlflags
Additional flags.
Definition: varnode.hh:127
bool ruleBlockIfNoExit(FlowBlock *bl)
Attempt to apply BlockIf where the body does not exit.
Definition: blockaction.cc:1461
virtual JumpValues * clone(void) const
Clone this iterator.
Definition: jumptable.cc:368
void setBigEndian(bool val)
Set general endianness to big if val is true.
Definition: translate.hh:552
void mergeByDatatype(VarnodeLocSet::const_iterator startiter, VarnodeLocSet::const_iterator enditer)
Try to merge all HighVariables in the given range that have the same data-type.
Definition: merge.cc:298
uintb minimalmask(uintb val)
Calculate smallest mask that covers the given value.
Definition: address.hh:493
virtual void removeSymbolMappings(Symbol *symbol)=0
Remove all SymbolEntrys from the given Symbol.
A basic block for p-code operations.
Definition: block.hh:363
TypeVoid * getTypeVoid(void)
Get the "void" data-type.
Definition: type.cc:1623
bool unblockedMulti(int4 outslot) const
Check if this block can be removed without introducing inconsistencies.
Definition: block.cc:2427
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:453
@ typelock
The Dataype of the Varnode is locked.
Definition: varnode.hh:82
Scope * createNewScope(const string &nm, Scope *par) const
Create a global namespace Scope.
Definition: database_ghidra.cc:40
Symbol(Scope *sc, const string &nm, Datatype *ct)
Construct given a name and data-type.
Definition: database.hh:187
TypeOp * opcode
Pointer to class providing behavioral details of the operation.
Definition: op.hh:113
@ condexe_effect
This trial may be affected by conditional execution.
Definition: fspec.hh:168
_recordtype::subsorttype subsorttype
The data-type used for subsorting.
Definition: rangemap.hh:68
@ CPUI_CALLIND
Call through an indirect address.
Definition: opcodes.hh:45
virtual void opSegmentOp(const PcodeOp *op)
Definition: printc.cc:857
const ActionGroupList & getGroup(const string &grp) const
Get a specific grouplist by name.
Definition: action.cc:967
@ coverdirty
The cover for the HighVariable is dirty.
Definition: variable.hh:49
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5357
@ indcreate_formed
The trial is built out of an indirect creation.
Definition: fspec.hh:167
PcodeOp * op
The PcodeOp at the point of the value set read.
Definition: rangeutil.hh:180
bool isdefault
Set to true to treat this as the default language.
Definition: printlanguage.hh:43
virtual Symbol * getSymbol(void) const =0
Retrieve the formal Symbol associated with this parameter.
virtual void buildCommentDB(DocumentStorage &store)
Build the comment database.
Definition: architecture.cc:577
vector< uintb > masklist
Masks for each bitfield within the enum.
Definition: type.hh:281
Set the current language emitted by the decompiler.
Definition: options.hh:243
bool ruleBlockIfElse(FlowBlock *bl)
Attempt to apply a 3 component form of BlockIf.
Definition: blockaction.cc:1396
virtual void emitBlockLs(const BlockList *bl)
Emit a sequence of blocks.
Definition: printc.cc:2394
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2893
static AddrSpace * getSpaceFromConst(const Address &addr)
Recover an encoded address space from an address.
Definition: address.hh:452
Information about the CBRANCH op-code.
Definition: typeop.hh:244
bool directsplit
True if this the direct split variation.
Definition: condexe.hh:143
virtual void opFloatNeg(const PcodeOp *op)
Emit a FLOAT_NEG operator.
Definition: printc.hh:273
bool doTrace(void)
Trace split through data-flow, constructing transform.
Definition: subflow.cc:1696
JumpTable(Architecture *g, Address ad=Address())
Constructor.
Definition: jumptable.cc:2206
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:228
virtual bool possibleParam(const Address &loc, int4 size) const =0
Does the given storage location make sense as a parameter.
void addSpacebase(AddrSpace *basespace, const string &nm, const VarnodeData &ptrdata, int4 truncSize, bool isreversejustified, bool stackGrowth)
Create a new space and associated pointer.
Definition: architecture.cc:480
virtual bool pushPtrCharConstant(uintb val, const TypePointer *ct, const Varnode *vn, const PcodeOp *op)
Attempt to push a quoted string representing a given constant pointer onto the RPN stack.
Definition: printc.cc:1357
static void restorePathXml(vector< string > &vec, const Element *el)
Restore path from <val> tags.
Definition: database.cc:2488
virtual ExternRefSymbol * findExternalRef(const Address &addr) const
Find an external reference at the given address.
Definition: database_ghidra.cc:305
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7927
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2352
virtual const uintm * getContext(const Address &addr, uintb &first, uintb &last) const
Get the context blob of values associated with a given address and its bounding offsets.
Definition: ghidra_context.hh:62
virtual void opNewOp(const PcodeOp *op)=0
Emit a NEW operator.
Priority queue for the phi-node (MULTIEQUAL) placement algorithm.
Definition: heritage.hh:64
bool isCallOrBranch(void) const
Return true if this op is a call or branch.
Definition: op.hh:176
@ end
A token that ends a printing group.
Definition: prettyprint.hh:283
void analyzeGuards(BlockBasic *bl, int4 pathout)
Analyze CBRANCHs leading up to the given basic-block as a potential switch guard.
Definition: jumptable.cc:1004
static bool noInterveningStatement(PcodeOp *first, int4 path, PcodeOp *last)
Check if there is meaningful activity between two branch instructions.
Definition: block.cc:2585
void addCase(FlowBlock *switchbl, FlowBlock *bl, uint4 gt)
Add a new case to this switch.
Definition: block.cc:3024
void setVarnodeProperties(Varnode *vn) const
Look-up boolean properties and data-type information.
Definition: funcdata_varnode.cc:23
virtual Address resolve(uintb val, int4 sz, const Address &point, uintb &fullEncoding)
Virtual destructor
Definition: architecture.cc:1255
int4 numdesc
Number of descendants of this block in spanning tree (+1)
Definition: block.hh:113
heritage_flags
Extra boolean properties on basic blocks for the Augmented Dominator Tree.
Definition: heritage.hh:172
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:272
breakflags
Break points associated with an Action.
Definition: action.hh:71
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:966
int4 camethruposta_slot
init or pre slot to use, for data-flow thru post
Definition: condexe.hh:139
virtual void reset(Funcdata &data)
Reset this Rule.
Definition: double.cc:2859
An address table index and its corresponding out-edge.
Definition: jumptable.hh:501
virtual SymbolEntry * addSymbol(const string &name, Datatype *ct, const Address &addr, const Address &usepoint)
Add a new Symbol to this Scope, given a name, data-type, and a single mapping.
Definition: database.cc:1471
VarnodeDefSet def_tree
Varnodes sorted by def then location.
Definition: varnode.hh:332
virtual void registerInject(int4 injectid)
Finalize a payload within the library, once the payload is initialized.
Definition: inject_ghidra.cc:174
int4 maxpass
Number of passes before we assume we have seen all params.
Definition: fspec.hh:228
bool andOrComplement(PcodeOp *bin1op, PcodeOp *bin2op)
Check if given p-code ops are complements where one is an BOOL_AND and the other is an BOOL_OR.
Definition: condexe.cc:262
void splitJoinLevel(vector< Varnode * > &lastcombo, vector< Varnode * > &nextlev, JoinRecord *joinrec)
Perform one level of Varnode splitting to match a JoinRecord.
Definition: heritage.cc:1638
Placeholder node for Varnode holding a smaller logical value.
Definition: subflow.hh:42
uintb collideskip
How many slots to skip after a hashtable collision.
Definition: memstate.hh:131
virtual Datatype * getType(void) const =0
Get the data-type associate with this.
bool operator==(const SeqNum &op2) const
Compare two sequence numbers for equality.
Definition: address.hh:138
int4 typeOrderBool(const Datatype &op) const
Order this with -op-, treating bool data-type as special.
Definition: type.hh:457
void addRecommendName(Symbol *sym)
Convert the given symbol to a name recommendation.
Definition: varmap.cc:1295
OpCode opc
OpCode constructing the boolean value.
Definition: ruleaction.hh:1353
Address baseaddr
Address of instruction causing inject.
Definition: pcodeinject.hh:59
Information about the CALL op-code.
Definition: typeop.hh:261
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:353
Description of a large Varnode that needs to be traced (in the worklist)
Definition: subflow.hh:167
FuncCallSpecs * getCallSpecs(const PcodeOp *op) const
Get the call specification associated with a CALL op.
Definition: funcdata.cc:406
Initialization data for a SymbolEntry to facilitate a rangemap.
Definition: database.hh:67
void a_v_u(ostream &s, const string &attr, uintb val)
Output the given unsigned integer as an XML attribute value.
Definition: xml.hh:354
Distribute BOOL_NEGATE: !(V && W) => !V || !W
Definition: ruleaction.hh:258
Class for categorizing and rebuilding a boolean expression.
Definition: ruleaction.hh:1351
string tspecxml
Stripped down .sla file passed from Ghidra.
Definition: ghidra_arch.hh:66
void endReturnType(int4 id)
Create an "end return type declaration" command.
Definition: prettyprint.hh:396
static uintb calcDivisor(uintb n, uint8 y, int4 xsize)
Calculate the divisor.
Definition: ruleaction.cc:6857
void findUnprocessed(void)
Add any remaining un-followed addresses to the unprocessed list.
Definition: flow.cc:823
const PcodeOp * op
A p-code operation associated with the token.
Definition: printlanguage.hh:198
@ CPUI_BOOL_NEGATE
Boolean negate (!)
Definition: opcodes.hh:79
void restoreXmlCoreTypes(const Element *el)
Initialize basic type names.
Definition: type.cc:2202
void newValueSet(Varnode *vn, int4 tCode)
Allocate storage for a new ValueSet.
Definition: rangeutil.cc:1939
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:603
@ blocks_unreachable
Set if at least one basic block is currently unreachable.
Definition: funcdata.hh:49
virtual SymbolEntry * findAddr(const Address &addr, const Address &usepoint) const
Find a Symbol at a given address and usepoint.
Definition: database_ghidra.cc:264
AddrSpace * base
Pointer to our address space.
Definition: address.hh:48
PcodeOpBank obank
Container of PcodeOp objects for this function.
Definition: funcdata.hh:77
static void propagateOneType(TypeFactory *typegrp, Varnode *vn)
Propagate a data-type starting from one Varnode across the function.
Definition: coreaction.cc:4424
virtual bool foldInGuards(Funcdata *fd, JumpTable *jump)
Eliminate any guard code involved in computing the switch destination.
Definition: jumptable.cc:2066
bool init2a_true
Does true branch (in terms of iblock) go to path pre a.
Definition: condexe.hh:137
virtual int4 numSpacebase(void) const
Number of base registers associated with this space.
Definition: translate.cc:83
virtual void opFloatLess(const PcodeOp *op)=0
Emit a FLOAT_LESS operator.
virtual const VarnodeData & getRegister(const string &nm) const
Get a register as VarnodeData given its name.
Definition: sleighbase.cc:92
int4 size
Definition: fspec.hh:849
Information about the FLOAT_LESSEQUAL op-code.
Definition: typeop.hh:566
void set(Varnode *v)
Set this as representing the given Varnode.
Definition: merge.cc:22
virtual void startPrefixMapping(const string &prefix, const string &uri)
Start a new prefix to namespace URI mapping.
Definition: xml.hh:227
static AddrSpace * checkSpacebase(Architecture *glb, PcodeOp *op, uintb &offoff)
Check if STORE or LOAD is off of a spacebase + constant.
Definition: ruleaction.cc:3897
void setVariableDefault(const string &nm, uintm val)
Provide a default value for a context variable.
Definition: globalcontext.cc:109
bool createCompareBridge(PcodeOp *op, ReplaceVarnode *inrvn, int4 slot, Varnode *othervn)
Extend the logical subgraph through a given comparison operator if possible.
Definition: subflow.cc:977
virtual void getRegionToChangePoint(vector< uintm * > &res, const Address &addr, int4 num, uintm mask)
Grab the context blob(s) starting at the given address up to the first point of change.
Definition: globalcontext.cc:458
@ status_actionbreak
Completed full action last time but indicated action break.
Definition: action.hh:68
bool isoutputactive
Are we actively trying to recover output parameters.
Definition: fspec.hh:1450
virtual void clearUnlockedCategory(int4 cat)
Clear unlocked symbols of the given category from this scope.
Definition: database_ghidra.hh:101
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3592
map< VarnodeData, string > addr2nm
Mapping rom Varnode to register name.
Definition: ghidra_translate.hh:37
Classes for describing the behavior of individual p-code operations.
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore the state of this database object from a serialized XML stream.
Definition: ghidra_context.hh:54
virtual ProtoParameter * getInput(int4 i)
Get the i-th input parameter (or NULL if it doesn't exist)
Definition: fspec.cc:2662
Lowest level operation of the p-code language.
Definition: op.hh:58
Abstract class for converting native constants to addresses.
Definition: translate.hh:140
void setPrototype(const PrototypePieces &pieces)
Set the prototype for a particular function.
Definition: architecture.cc:325
bool pushForwardTrinary(OpCode opc, const CircleRange &in1, const CircleRange &in2, const CircleRange &in3, int4 inSize, int4 outSize, int4 maxStep)
Push this range forward through a trinary operation.
Definition: rangeutil.cc:1367
virtual void restoreXml(const Element *el, ProtoModel *model)
Restore any internal parameter descriptions from an XML stream.
Definition: fspec.cc:2589
static AddrSpace * searchForLoadStore(Varnode *vn, PcodeOp *op)
Make a limited search from a constant for a LOAD or STORE so we can see the AddrSpace being accessed.
Definition: coreaction.cc:944
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: condexe.hh:229
CPUI_INT_EQUAL behavior.
Definition: opbehavior.hh:131
void buildCopy(const BlockGraph &graph)
Build a copy of a BlockGraph.
Definition: block.cc:1818
@ spacebase_ptr
Loads or stores from a dynamic pointer into a spacebase.
Definition: op.hh:95
Datatype * type
The datatype of the parameter.
Definition: fspec.hh:296
static void funcLinkInput(FuncCallSpecs *fc, Funcdata &data)
Set up the parameter recovery process for a single sub-function call.
Definition: coreaction.cc:1404
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:673
_type * cache
An array of the template object.
Definition: prettyprint.hh:606
char getShortcut(void) const
Get the shortcut character for the address space.
Definition: address.hh:307
virtual void opFloatAdd(const PcodeOp *op)=0
Emit a FLOAT_ADD operator.
Convert "shift and add" to PIECE: (zext(V) << 16) + zext(W) => concat(V,W)
Definition: ruleaction.hh:609
AddrSpaceManager * manage
Underlying address space manager.
Definition: varnode.hh:326
TransformVar * setReplacement(Varnode *vn)
Find or build the placeholder objects for a Varnode that needs to be split.
Definition: subflow.cc:1433
static PcodeOp * detectThreeWay(PcodeOp *op, bool &isPartial)
Detect a three-way calculation.
Definition: ruleaction.cc:8283
OpCode get_opcode(const string &nm)
Convert a name string to the matching OpCode.
Definition: opcodes.cc:66
void setContext(const Address &addr, int4 num, uintm mask, uintm value)
Change the value of a context variable at the given address with no bound.
Definition: globalcontext.cc:601
virtual void emitTypeDefinition(const Datatype *ct)
Emit the definition of the given data-type.
Definition: printc.cc:1978
Create symbols that map out the local stack-frame for the function.
Definition: coreaction.hh:827
virtual bool sanityCheck(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable)
Perform a sanity check on recovered addresses.
Definition: jumptable.hh:451
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3980
virtual void setNameLock(bool val)
Toggle the lock on the name.
Definition: fspec.cc:2383
bool doesDeadcode(void) const
Return true if dead code analysis should be done on this space.
Definition: space.hh:393
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
Varnode * vn
The Varnode being restricted.
Definition: jumptable.hh:135
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:524
void saveXml(ostream &s) const
Save this to a stream as an XML tag.
Definition: address.hh:426
void opUninsert(PcodeOp *op)
Remove the given PcodeOp from its basic block.
Definition: funcdata_op.cc:162
void finalInputCheck(void)
Make final activity check on trials that might have been affected by conditional execution.
Definition: fspec.cc:4592
@ unaffected
Input which is unaffected by the function.
Definition: varnode.hh:93
long adjustvma
How much to adjust the virtual memory address.
Definition: bfd_arch.hh:39
A stack equation.
Definition: coreaction.cc:22
const string & getValue(const string &qualifiedName) const
Get the value of the attribute with the given qualified name.
Definition: xml.hh:64
void setStride(int4 newStep, uintb rem)
Set a new step on this range.
Definition: rangeutil.cc:705
bool operator<(const JoinRecord &op2) const
Compare records lexigraphically by pieces.
Definition: translate.cc:158
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore constant pool records from an XML stream.
Definition: cpool_ghidra.cc:62
A storage location for a particular Symbol.
Definition: database.hh:51
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1683
static OpToken shift_right
The right shift operator.
Definition: printc.hh:84
Create symbols that map out the local stack-frame for the function.
Definition: coreaction.hh:812
Varnode * findMatch(PcodeOp *op)
Find a matching Varnode in the root expression producing the given CBRANCH boolean.
Definition: condexe.cc:106
void addComparePatch(ReplaceVarnode *in1, ReplaceVarnode *in2, PcodeOp *op)
Mark subgraph variables flowing into a comparison operation.
Definition: subflow.cc:1137
virtual const VarnodeData & getSpacebaseFull(int4 i) const
Return original spacebase register before truncation.
Definition: space.hh:463
int4 extrapop
Extra bytes popped from stack.
Definition: fspec.hh:1166
int4 numHeritagePasses(AddrSpace *spc) const
Get the number times heritage was performed for the given address space.
Definition: heritage.cc:2344
uintb getVarnodeValue(VarnodeData *vn) const
Retrieve the value of a Varnode from the current machine state.
Definition: emulateutil.cc:363
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:290
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:506
vector< ReplaceVarnode * > input
Varnode inputs.
Definition: subflow.hh:59
void initialize(void)
Create the initial BranchPoint and BlockTrace objects.
Definition: blockaction.cc:960
list< PcodeOp * >::const_iterator endAlive(void) const
End of all PcodeOps marked as alive.
Definition: op.hh:294
@ ptrflow
If this varnode flows to or from a pointer.
Definition: varnode.hh:117
virtual void pushTypeEnd(const Datatype *ct)
Push the tail ends of a data-type declaration onto the RPN stack.
Definition: printjava.cc:94
void printLocalRange(ostream &s) const
Print description of memory ranges associated with local scopes.
Definition: funcdata.cc:542
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:252
A description of the body of a loop.
Definition: blockaction.hh:44
Merge range conditions of the form: V s< c, c s< V, V == c, V != c
Definition: ruleaction.hh:298
BlockGoto * newBlockGoto(FlowBlock *bl)
Build a new BlockGoto.
Definition: block.cc:1602
bool propagateFlowToReads(Varnode *vn)
Propagate ptrflow property to given Varnode and to descendant PcodeOps.
Definition: ruleaction.cc:7456
uint4 flowoptions
options passed to flow following engine
Definition: architecture.hh:132
void setConstructor(bool val)
Toggle whether this prototype is a constructor method.
Definition: fspec.hh:1254
virtual uint4 getType(void) const =0
Get the type of parameter list.
void replaceInEdge(int4 num, FlowBlock *b)
Make an incoming edge flow from a given block.
Definition: block.cc:148
void saveXml(ostream &s) const
Save the edge to an XML stream.
Definition: block.cc:22
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:431
PrintLanguage * print
Current high-level language printer.
Definition: architecture.hh:149
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: double.cc:2936
tagtype
Possible types of Atom.
Definition: printlanguage.hh:155
uint4 flags
Collection of block_flags.
Definition: block.hh:107
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:453
uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: typeop.hh:68
list< FloatingEdge > likelygoto
The current likely goto list.
Definition: blockaction.hh:193
Compare two Datatype pointers: first by name, then by id.
Definition: type.hh:141
@ CPUI_INT_ZEXT
Zero extension.
Definition: opcodes.hh:58
void truncatePaths(int4 cutPoint)
Truncate all paths at the given new Varnode.
Definition: jumptable.cc:857
void printRaw(ostream &s) const
Write a text description of to the given stream.
Definition: rangeutil.cc:1807
bool refinement(const Address &addr, int4 size, const vector< Varnode * > &readvars, const vector< Varnode * > &writevars, const vector< Varnode * > &inputvars)
Find the common refinement of all reads and writes in the address range.
Definition: heritage.cc:1481
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7921
bool isempty
true if set is empty
Definition: rangeutil.hh:52
static void shutDown(void)
Release all GhidraCommand resources.
Definition: ghidra_process.cc:483
virtual void opIntSlessEqual(const PcodeOp *op)=0
Emit a INT_SLESSEQUAL operator.
@ reverse_stack
Slots (for non-exlusion entries) are allocated in reverse order.
Definition: fspec.hh:52
virtual bool doEmitWideCharPrefix(void) const
Return true if this language requires a prefix when expressing wide characters.
Definition: printc.cc:1208
static map< string, GhidraCommand * > commandmap
The central map from name to Ghidra command.
Definition: ghidra_process.hh:40
TypeArray(const TypeArray &op)
Construct from another TypeArray.
Definition: type.hh:255
Address addr
Storage address of the parameter.
Definition: fspec.hh:295
ReplaceOp * def
Defining op for new Varnode.
Definition: subflow.hh:48
bool operator<(const ParamTrial &b) const
Sort trials in formal parameter order.
Definition: fspec.cc:1355
static OpToken boolean_or
The boolean or operator.
Definition: printc.hh:95
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1111
An interface into a particular binary executable image.
Definition: loadimage.hh:71
bool operator==(const VarnodeData &op2) const
Compare for equality.
Definition: pcoderaw.hh:66
virtual Scope * buildGlobalScope(void)
Build the global scope for this executable.
Definition: ghidra_arch.cc:299
A parameter with a formal backing Symbol.
Definition: fspec.hh:1052
uintb getTrackedValue(const VarnodeData &mem, const Address &point) const
Get the value of a tracked register at a specific address.
Definition: globalcontext.cc:229
ArchitectureGhidra * ghidra
The Architecture on which to perform the command.
Definition: ghidra_process.hh:75
Datatype * downChain(Datatype *ptrtype, uintb &off)
Find a sub-type matching a pointer and offset.
Definition: type.cc:1886
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1218
CircleRange equationConstraint
Constraint associated with the equation.
Definition: rangeutil.hh:182
int4 status
Meta-command to system (0=wait for next command, 1=terminate process)
Definition: ghidra_process.hh:76
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3278
virtual void tagType(const char *ptr, syntax_highlight hl, const Datatype *ct)
Emit a data-type identifier.
Definition: prettyprint.hh:246
bool setupCallindSpecs(PcodeOp *op, bool tryoverride, FuncCallSpecs *fc)
Set up the FuncCallSpecs object for a new indirect call site.
Definition: flow.cc:691
@ CPUI_INT_RIGHT
Right shift, logical (>>)
Definition: opcodes.hh:71
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1234
Architecture * glb
The Architecture to which the injection payloads apply.
Definition: pcodeinject.hh:164
int4 left
Index within the array of the leftmost object in the queue.
Definition: prettyprint.hh:607
BlockGraph bblocks
Unstructured basic blocks.
Definition: funcdata.hh:78
FspecSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Constructor.
Definition: fspec.cc:1556
Replace (casttosmall)(casttobig)V with identity or with single cast.
Definition: ruleaction.hh:1377
vector< Action * > list
List of actions to perform in the group.
Definition: action.hh:144
The unicode data-type: i.e. wchar.
Definition: type.hh:189
virtual int4 oneInstruction(PcodeEmit &emit, const Address &baseaddr) const
Transform a single machine instruction into pcode.
Definition: sleigh.cc:618
int4 wholeSize
Size of the region being split in bytes.
Definition: transform.hh:127
virtual bool sanityCheck(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable)
Perform a sanity check on recovered addresses.
Definition: jumptable.cc:1447
vector< vector< FlowBlock * > > domchild
Parent->child edges in dominator tree.
Definition: heritage.hh:204
static bool checkIndirectUse(Varnode *vn)
Check if the given Varnode only flows into call-based INDIRECT ops.
Definition: funcdata_varnode.cc:635
bool traceForward(ReplaceVarnode *rvn)
Trace the logical data-flow forward for the given subgraph variable.
Definition: subflow.cc:335
JumpModel * origmodel
Initial jump table model, which may be incomplete.
Definition: jumptable.hh:510
void extend(vector< FlowBlock * > &body) const
Extend body (to blocks that never exit)
Definition: blockaction.cc:143
@ record_jumploads
Indicate that any jump table recovery should record the table structure.
Definition: flow.hh:71
Look for common sub-expressions (built out of a restricted set of ops)
Definition: ruleaction.hh:71
virtual void opFloatNeg(const PcodeOp *op)=0
Emit a FLOAT_NEG operator.
Address addr
The starting address of the storage location.
Definition: varmap.hh:30
virtual void opIntOr(const PcodeOp *op)=0
Emit a INT_OR operator.
AddrSpace * space
Address space containing the local stack.
Definition: varmap.hh:183
virtual uintb getValue(void) const
Get the current value.
Definition: jumptable.cc:294
Toggle whether a warning should be issued if a specific action/rule is applied.
Definition: options.hh:117
PrintJavaCapability & operator=(const PrintJavaCapability &op)
Not implemented.
Mark/unmark a specific function as inline.
Definition: options.hh:99
Varnode * normqvn
Varnode representing the normalized switch variable.
Definition: jumptable.hh:180
JoinRecord * joinrec
Non-null if this is logical variable from joined pieces.
Definition: fspec.hh:72
virtual bool isReversible(void) const =0
Return true if the current value can be reversed to get a label.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:504
uintb val
A possible constant second input.
Definition: userop.hh:171
Convert PIECE to INT_ZEXT where appropriate: V & concat(W,X) => zext(X)
Definition: ruleaction.hh:328
string name
Identifier for capability and associated commands.
Definition: ghidra_process.hh:41
virtual void emitBlockSwitch(const BlockSwitch *bl)
Emit a switch structure.
Definition: printc.cc:2827
VarnodeData address
The memory range affected.
Definition: fspec.hh:314
static PcodeOp * findSubstitute(Varnode *in1, Varnode *in2, BlockBasic *bb, PcodeOp *earliest)
Find a previously existing MULTIEQUAL taking given inputs.
Definition: ruleaction.cc:1074
@ size_typelock
Only the size of the symbol is typelocked.
Definition: database.hh:182
bool isCommutative(void) const
Return true if this op-code is commutative.
Definition: typeop.cc:169
virtual void loadFill(uint1 *ptr, int4 size, const Address &addr)
Get data from the LoadImage.
Definition: loadimage.cc:82
virtual void reset(Funcdata &data)
Reset this Rule.
Definition: action.cc:633
VarnodeData * getOutput(void) const
Retrieve the output varnode for this op.
Definition: pcoderaw.hh:182
@ CPUI_BOOL_AND
Boolean and (&&)
Definition: opcodes.hh:81
Manager/container for description objects (UserPcodeOp) of user defined p-code ops.
Definition: userop.hh:250
Scope * resolveScope(const vector< string > &subnames) const
Look-up a Scope by name.
Definition: database.cc:2901
Class representing a term in an additive expression.
Definition: coreaction.hh:1038
virtual void emitBlockCopy(const BlockCopy *bl)
Emit a basic block (with any labels)
Definition: printc.cc:2372
void a_v(ostream &s, const string &attr, const string &val)
Output an XML attribute name/value pair to stream.
Definition: xml.hh:330
TypeOpIntAdd(TypeFactory *t)
Constructor.
Definition: typeop.cc:976
Information about the INT_NOTEQUAL op-code.
Definition: typeop.hh:309
VarnodeData loc
Storage details of the register being tracked.
Definition: globalcontext.hh:69
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:168
virtual void opIntCarry(const PcodeOp *op)
Emit a INT_CARRY operator.
Definition: printc.hh:244
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:334
@ warnings_on
A warning is issued if this rule is applied.
Definition: action.hh:198
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)
Establish name, data-type, storage of a specific input parameter.
Definition: fspec.cc:2619
Exception thrown for a thunk mechanism that looks like a jump-table.
Definition: jumptable.hh:28
VarnodeDefSet::const_iterator beginDef(uint4 fl) const
Start of Varnodes with a given definition property.
Definition: funcdata.hh:342
bool doTrace(void)
Trace logical value through data-flow, constructing transform.
Definition: subflow.cc:1302
virtual string getSource(void) const
Return a string describing the source of the injection (.cspec, prototype model, etc....
Definition: pcodeinject.hh:146
bool checkInputJoin(const Address &hiaddr, int4 hisz, const Address &loaddr, int4 losz) const
Check if the given two input storage locations can represent a single logical parameter.
Definition: fspec.hh:1316
uint4 nameDedup
id to distinguish symbols with the same name
Definition: database.hh:161
bool isCalculatedBool(void) const
Return true if output is 1-bit boolean.
Definition: op.hh:204
void markLanedVarnode(Varnode *vn, const LanedRegister *lanedReg)
Mark Varnode as potential laned register.
Definition: funcdata_varnode.cc:288
Node in a depth first traversal of ancestors.
Definition: funcdata.hh:568
int4 slotbase
Slot where next parameter will go.
Definition: fspec.hh:225
@ force_oct
Force octal printing of constant symbol.
Definition: database.hh:179
uint4 count_tests
Number of times apply() has been called.
Definition: action.hh:83
Datatype * setName(Datatype *ct, const string &n)
Set the given types name.
Definition: type.cc:1466
virtual LabSymbol * findCodeLabel(const Address &addr) const =0
Find a label Symbol at the given address.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:229
virtual void removeRange(AddrSpace *spc, uintb first, uintb last)
Remove a memory range from the ownership of this Scope.
Definition: database_ghidra.hh:48
bool isConstant(void) const
Is this a constant value.
Definition: address.hh:412
vector< IndexPair > block2addr
Map from basic-blocks to address table index.
Definition: jumptable.hh:512
virtual void setMaxLineSize(int4 mls)
Provide a maximum line size to the pretty printer.
Definition: prettyprint.hh:179
FuncProto(void)
Constructor.
Definition: fspec.cc:2920
void clearFlags(uint4 fl) const
Internal method for clearing boolean attributes.
Definition: varnode.cc:338
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3629
virtual SymbolEntry * findOverlap(const Address &addr, int4 size) const
Find first Symbol overlapping the given memory range.
Definition: database.cc:2255
Definitions for high-level variables.
virtual FlowBlock * getSplitPoint(void)
Get the leaf splitting block.
Definition: block.hh:430
AddrSpace * getUniqueSpace(void) const
Get the temporary register space for this processor.
Definition: translate.hh:481
@ comm_t
Part of a comment block.
Definition: prettyprint.hh:314
vector< uint4 > flags
Block properties for phi-node placement algorithm.
Definition: heritage.hh:206
vector< EffectRecord >::const_iterator effectEnd(void) const
Get iterator to end of EffectRecord list.
Definition: fspec.cc:3366
All paths from a (putative) switch variable to the CPUI_BRANCHIND.
Definition: jumptable.hh:63
@ EXECUTABLEPCODE_TYPE
Injection running as a stand-alone p-code script.
Definition: pcodeinject.hh:84
type_metatype string2metatype(const string &metastring)
Convert string to type meta-type.
Definition: type.cc:174
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1064
Information about the INSERT op-code.
Definition: typeop.hh:782
void setflags(void)
Set unicode property flags.
Definition: type.cc:340
Class for shrinking big Varnodes carrying smaller logical values.
Definition: subflow.hh:39
virtual bool isHiddenReturn(void) const =0
Is this a pointer to storage for a return value.
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1868
SplitFlow(Funcdata *f, Varnode *root, int4 lowSize)
Constructor.
Definition: subflow.cc:1686
TypeOpInt2Comp(TypeFactory *t)
Constructor.
Definition: typeop.cc:1049
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:353
CPUI_FLOAT_NEG behavior.
Definition: opbehavior.hh:420
virtual const CPoolRecord * getRecord(const vector< uintb > &refs) const =0
Retrieve a constant pool record (CPoolRecord) given a reference to it.
void removeFromFlow(FlowBlock *bl)
Remove given FlowBlock preserving flow in this.
Definition: block.cc:1445
void transferVarnodeProperties(Varnode *vn, Varnode *newVn, int4 lsbOffset)
Copy properties from an existing Varnode to a new Varnode.
Definition: funcdata_varnode.cc:490
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:173
VarnodeLocSet::const_iterator beginLoc(void) const
Start of all Varnodes sorted by storage.
Definition: funcdata.hh:298
virtual Translate * buildTranslator(DocumentStorage &store)=0
Build the Translator object.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:430
static int4 readCommand(istream &sin, ostream &out)
Dispatch a Ghidra command.
Definition: ghidra_process.cc:459
uintb b
The second integer in a reference (or zero)
Definition: cpool.hh:168
void paramshiftModifyStart(void)
Prepend any extra parameters if a paramshift is required.
Definition: fspec.cc:4914
@ readonly
read only section
Definition: loadimage.hh:51
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database.cc:2081
OpCode opcode
the internal enumeration for pcode types
Definition: opbehavior.hh:43
CPUI_FLOAT_LESSEQUAL behavior.
Definition: opbehavior.hh:372
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2431
virtual Datatype * castStandard(Datatype *reqtype, Datatype *curtype, bool care_uint_int, bool care_ptr_uint) const
Does there need to be a visible cast between the given data-types.
Definition: cast.cc:363
TypeChar(const string &n)
Construct a char (always 1-byte) given a name.
Definition: type.hh:181
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2532
virtual void restoreXml(DocumentStorage &store)
Restore the Architecture state from an XML stream.
Definition: bfd_arch.cc:141
static bool mergeTestAdjacent(HighVariable *high_out, HighVariable *high_in)
Adjacency tests for merging Varnodes that are input or output to the same p-code op.
Definition: merge.cc:125
int4 collect(Address addr, int4 size, vector< Varnode * > &read, vector< Varnode * > &write, vector< Varnode * > &input) const
Collect free reads, writes, and inputs in the given address range.
Definition: heritage.cc:159
@ IPTR_JOIN
Special virtual space to represent split variables.
Definition: space.hh:35
Address useaddr
The code address at the point of use.
Definition: varmap.hh:31
static OpToken unary_plus
The unary plus operator.
Definition: printc.hh:74
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: double.cc:2871
int4 depth
Nested depth of this loop.
Definition: blockaction.hh:47
Look for conditional branch expressions that have been split and rejoin them.
Definition: blockaction.hh:335
uintm mask
Mask to apply (after shifting) when unpacking this value from its word.
Definition: globalcontext.hh:35
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2934
map< HighEdge, bool > highedgemap
A cache of intersection tests, sorted by HighVariable pair.
Definition: merge.hh:82
Varnode * normalizeReadSize(Varnode *vn, const Address &addr, int4 size)
Normalize the size of a read Varnode, prior to heritage.
Definition: heritage.cc:226
Description of a LOAD operation that needs to be guarded.
Definition: heritage.hh:105
void shrink(int4 i, const Address &addr, int4 sz)
Shrink the given trial to a new given range.
Definition: fspec.hh:270
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:672
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:660
static uint4 getTotalFromHash(uint8 h)
Retrieve the encoded collision total from a hash.
Definition: dynamic.cc:508
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2258
bool operator<(const VarnodeData &op2) const
An ordering for VarnodeData.
Definition: pcoderaw.hh:56
void setEmulate(Emulate *emu)
Associate a particular emulator with this breakpoint.
Definition: emulate.hh:123
virtual SymbolEntry * addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a memory range.
Definition: database_ghidra.cc:397
A block with multiple edges out, at least one of which is an unstructured (goto) branch.
Definition: block.hh:468
int4 count
Number of changes made by this action so far.
Definition: action.hh:79
Information about the INDIRECT op-code.
Definition: typeop.hh:679
virtual void insert(uintb addr, uintb val)=0
Insert a word in memory bank at an aligned location.
@ postsurround
Function or array operator form.
Definition: printlanguage.hh:87
bool isbadjumptable
Was the call originally a jump-table we couldn't recover.
Definition: fspec.hh:1451
Exception for bad instruction data.
Definition: translate.hh:50
void collect(void)
Collect all the terms in the expression.
Definition: coreaction.cc:4669
bool setInputBytesConsumed(int4 slot, int4 val) const
Set the estimated number of bytes within the given parameter that are consumed.
Definition: fspec.cc:4902
void setStartBlock(FlowBlock *bl)
Set the entry point FlowBlock for this graph.
Definition: block.cc:1525
@ global_color
Global variable identifiers.
Definition: prettyprint.hh:95
void print(ostream &s) const
Dump a description of this cover to stream.
Definition: cover.cc:554
vector< uintb > label
The case label for each explicit target.
Definition: jumptable.hh:513
@ CPUI_FLOAT_FLOOR
Round towards -infinity.
Definition: opcodes.hh:105
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4433
virtual void saveXml(ostream &s) const
Save all records in this container to an XML stream.
Definition: cpool.cc:220
string printstring
The printing output configuration to toggle.
Definition: ghidra_process.hh:205
virtual void executeCallind(void)
Standard behavior for a CALLIND.
Definition: jumptable.cc:109
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:881
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2943
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:1225
Description of the indirect effect a sub-function has on a memory range.
Definition: fspec.hh:305
uint4 opproc
Number of PcodeOps processed in the markop list so far.
Definition: dynamic.hh:62
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: action.cc:536
int4 openGroup(void)
Create a "start a printing group" command.
Definition: prettyprint.hh:535
HighVariable * a
First HighVariable of the pair.
Definition: merge.hh:31
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:420
virtual bool possibleParamWithSlot(const Address &loc, int4 size, int4 &slot, int4 &slotsize) const
Pass-back the slot and slot size for the given storage location as a parameter.
Definition: fspec.cc:932
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:691
A pair of Varnode objects that have been split (and should be merged)
Definition: blockaction.hh:234
PathMeld pathMeld
Set of PcodeOps and Varnodes producing the final target addresses.
Definition: jumptable.hh:347
@ startmark
This op is the first in its instruction.
Definition: op.hh:81
int4 parenlevel
Current depth of parentheses.
Definition: prettyprint.hh:81
Create symbols for any discovered global variables in the function.
Definition: coreaction.hh:838
virtual void opExtractOp(const PcodeOp *op)
Emit an EXTRACT operator.
Definition: printc.cc:977
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1493
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:692
void setOverride(const vector< Address > &addrtable, const Address &naddr, uintb h, uintb sv)
Force manual override information on this jump-table.
Definition: jumptable.cc:2292
uint4 label
Label of the edge.
Definition: block.hh:45
bool isfullychecked
True if all trials are fully examined (and no new trials are expected)
Definition: fspec.hh:229
vector< int4 > indentstack
Space available for currently active nesting levels.
Definition: prettyprint.hh:705
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:864
void registerTrial(const Address &addr, int4 sz)
Add a new trial to the container.
Definition: fspec.cc:1404
FuncProto * proto
If non-null, this describes the prototype of the underlying function.
Definition: type.hh:332
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2242
vector< const Varnode * > vnedge
A staging area for Varnodes before formally adding to the sub-graph.
Definition: dynamic.hh:67
void insertFlowOverride(const Address &addr, uint4 type)
Mark a branch instruction with a different flow type.
Definition: override.cc:138
Normalize sign-bit extraction: V >> 0x1f => (V s>> 0x1f) * -1
Definition: ruleaction.hh:568
const Element * getTag(const string &nm) const
Retrieve a registered XML Element by name.
virtual bool unify(Funcdata &data, PcodeOp *op, vector< Varnode * > &bindlist) const =0
Gather the formal input Varnode objects given the root PcodeOp.
@ data
data only
Definition: loadimage.hh:50
block_type
The possible block types.
Definition: block.hh:64
int4 getMinimumLanedRegisterSize(void) const
Get the minimum size of a laned register in bytes.
Definition: architecture.cc:250
Architecture * glb
The address space manager.
Definition: ruleaction.hh:1265
@ const_color
Constant values.
Definition: prettyprint.hh:93
int4 baseinsize
The size in bytes of the base or segment value.
Definition: userop.hh:202
virtual void docAllGlobals(void)
Emit declarations of global variables.
Definition: printc.cc:2230
list< PcodeOp * >::iterator basiciter
Iterator within basic block.
Definition: op.hh:118
virtual void emitBlockInfLoop(const BlockInfLoop *bl)
Emit an infinite loop structure.
Definition: printc.cc:2639
Apply any overridden forced gotos.
Definition: coreaction.hh:134
A collection of parameter descriptions backed by Symbol information.
Definition: fspec.hh:1080
void setSymbolEntry(SymbolEntry *entry)
Attach a Symbol to this Varnode.
Definition: varnode.cc:386
char shortcut
Shortcut character for printing.
Definition: space.hh:101
@ CPUI_INT_SREM
Remainder/modulo, signed (%)
Definition: opcodes.hh:77
@ TYPE_PTR
Pointer data-type.
Definition: type.hh:43
TypeOpIntSub(TypeFactory *t)
Constructor.
Definition: typeop.cc:990
void eliminateInDups(FlowBlock *bl)
Eliminate duplicate in edges from given block.
Definition: block.cc:416
virtual void opIntLeft(const PcodeOp *op)=0
Emit a INT_LEFT operator.
int4 containVarnodeDef(const Varnode *vn) const
Check the definition of a Varnode for containment.
Definition: cover.cc:391
Definition: paramid.hh:64
void complement(void)
Set this to the complement of itself.
Definition: rangeutil.cc:36
bool getHalt(void) const
Get the halt state of the emulator.
Definition: emulate.hh:224
Varnode * createStackRef(AddrSpace *spc, uintb off, PcodeOp *op, Varnode *stackptr, bool insertafter)
Create an INT_ADD PcodeOp calculating an offset to the spacebase register.
Definition: funcdata_op.cc:429
void setHalt(bool val)
Set the halt state of the emulator.
Definition: emulate.hh:214
void buildParamList(const string &strategy)
Establish the main resource lists for input and output parameters.
Definition: fspec.cc:1737
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1109
list< FloatingEdge >::iterator likelyiter
Iterator to the next most likely goto edge.
Definition: blockaction.hh:194
bool operator==(const MapIterator &op2) const
Equality operator.
Definition: database.hh:365
int4 precedence
Precedence level of this token (higher binds more tightly)
Definition: printlanguage.hh:94
A pcode-based emulator interface.
Definition: emulate.hh:168
Information about the INT_SLESSEQUAL op-code.
Definition: typeop.hh:325
Contents of the <language> tag in a .ldefs file.
Definition: sleigh_arch.hh:49
Information about the BRANCHIND op-code.
Definition: typeop.hh:253
virtual void opInt2Comp(const PcodeOp *op)
Emit a INT_2COMP operator.
Definition: printc.hh:247
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:469
vector< LoadTable > loadpoints
The set of collected LOAD records.
Definition: jumptable.hh:104
CastStrategy * castStrategy
The strategy for emitting explicit case operations.
Definition: printlanguage.hh:243
bool traceForward(TransformVar *rvn)
Try to trace the pair of logical values, forward, through ops that read them.
Definition: subflow.cc:1511
uintb first
Starting offset of the ParamEntry's range.
Definition: fspec.hh:105
void opSetInput(PcodeOp *op, Varnode *vn, int4 slot)
Set a specific input operand for the given PcodeOp.
Definition: funcdata_op.cc:102
@ f_defaultswitch_edge
This is default edge from switchblock.
Definition: block.hh:98
void forceOutputNum(int4 i)
Force number of outputs.
Definition: block.cc:805
PcodeEmit * emitter
Emitter (allocated temporarily) for initializing the emulator.
Definition: pcodeinject.hh:141
void eliminateIntersect(Varnode *vn, const vector< BlockVarnode > &blocksort)
Eliminate intersections of given Varnode with other Varnodes in a list.
Definition: merge.cc:417
A pending data-flow node; waiting to be placed on the reverse polish notation stack.
Definition: printlanguage.hh:179
@ hasphysical
Has physical memory associated with it.
Definition: space.hh:85
linetype first
Start of the disjoint sub-range.
Definition: rangemap.hh:78
An enumerated Datatype object: an integer with named values.
Definition: type.hh:277
void processHighRedundantCopy(HighVariable *high)
Mark COPY ops into the given HighVariable that are redundant.
Definition: merge.cc:1235
@ force_scinote
Force scientific notation for floats.
Definition: printlanguage.hh:141
virtual bool negateCondition(bool toporbottom)
Flip the condition computed by this.
Definition: block.cc:2237
PcodeOp * op
The LOAD op.
Definition: heritage.hh:107
virtual void clear(void)=0
Clear all symbols from this scope.
bool pushForwardBinary(OpCode opc, const CircleRange &in1, const CircleRange &in2, int4 inSize, int4 outSize, int4 maxStep)
Push this range forward through a binary operation.
Definition: rangeutil.cc:1165
@ spacebase
This is a base register for an address space.
Definition: varnode.hh:94
vector< FlowBlock * > tails
(Possibly multiple) nodes with back edge returning to the head
Definition: blockaction.hh:46
P-code emitter that dumps its raw Varnodes and PcodeOps to an in memory cache.
Definition: emulate.hh:278
VarnodeLocSet::const_iterator endLoc(int4 s, const Address &addr, const Address &pc, uintm uniq=~((uintm) 0)) const
End of Varnodes matching storage and definition address.
Definition: funcdata.hh:332
void clear(void)
Reset to an empty container.
Definition: fspec.cc:1391
vector< BranchPoint * > branchlist
Current set of BranchPoints that have been traced.
Definition: blockaction.hh:156
VarnodeDefSet::iterator defiter
Iterator into VarnodeBank sorted by definition.
Definition: varnode.hh:136
Information about the CALLOTHER op-code (user defined p-code operations)
Definition: typeop.hh:281
@ active
Trial looks active (hint that it is used)
Definition: fspec.hh:163
virtual int4 beginDocument(void)
Begin a whole document of output.
Definition: prettyprint.cc:846
void snipReads(Varnode *vn, list< PcodeOp * > &markedop)
Snip off set of read p-code ops for a given Varnode.
Definition: merge.cc:369
int4 beginVarDecl(const Symbol *sym)
Create a "begin variable declaration" command.
Definition: prettyprint.hh:403
@ begin_comment
Start of a comment block.
Definition: prettyprint.hh:288
virtual void openSymbols(void) const
Prepare to read symbols.
Definition: loadimage_xml.cc:230
ParamActive activeoutput
Info for recovering output parameters.
Definition: fspec.hh:1447
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:410
map< string, int4 > callMechFixupMap
Map of registered mechanism names to injection id.
Definition: pcodeinject.hh:169
_recordtype::inittype inittype
The data-type containing initialization data for records.
Definition: rangemap.hh:69
void copySymbolIfValid(const Varnode *vn)
Copy symbol info from vn if constant value matches.
Definition: varnode.cc:455
virtual void tagFuncName(const char *ptr, syntax_highlight hl, const Funcdata *fd, const PcodeOp *op)
Emit a function identifier.
Definition: prettyprint.hh:244
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:615
void clearJumpTables(void)
Clear any jump-table information.
Definition: funcdata_block.cc:40
void buildNameType(void)
Create a name and data-type for the Symbol.
Definition: database.cc:703
HighVariable * assignHigh(Varnode *vn)
Assign a new HighVariable to a Varnode.
Definition: funcdata_varnode.cc:46
int4 minimumPointerSize
Smallest size of a pointer into this space (in bytes)
Definition: space.hh:106
bool allowSubpieceTerminator
true if we allow lanes to be cast (via SUBPIECE) to a smaller integer size
Definition: subflow.hh:177
PcodeOp * allocateCopyTrim(Varnode *inVn, Datatype *ct, const Address &addr)
Allocate COPY PcodeOp designed to trim an overextended Cover.
Definition: merge.cc:350
virtual void endFuncProto(int4 id)
End a function prototype declaration.
Definition: prettyprint.cc:990
void restoreXml(const Element *el, BlockMap &resolver)
Restore this from an XML stream.
Definition: block.cc:2393
static GhidraDecompCapability ghidraDecompCapability
Singleton instance.
Definition: ghidra_process.hh:53
XmlArchitectureCapability(void)
Singleton.
Definition: xml_arch.cc:21
void parseProtoEval(const Element *el)
Apply prototype evaluation configuration.
Definition: architecture.cc:747
virtual bool emitScopeVarDecls(const Scope *scope, int4 cat)
Emit all the variable declarations for a given scope.
Definition: printc.cc:2127
@ end_indent
End of a nesting level.
Definition: prettyprint.hh:287
void clearAnalysis(Funcdata *fd)
Clear analysis specific to a function.
Definition: architecture.cc:270
virtual void tagLabel(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a code label identifier.
Definition: prettyprint.hh:253
SegmentedResolver(Architecture *g, AddrSpace *sp, SegmentOp *sop)
Definition: architecture.hh:291
virtual void opExtractOp(const PcodeOp *op)=0
Emit an EXTRACT operator.
void floatExtensionWrite(Varnode *vn, JoinRecord *joinrec)
Create float extension from a lower precision join-space Varnode.
Definition: heritage.cc:1812
TypeOpCopy(TypeFactory *t)
Constructor.
Definition: typeop.cc:329
virtual bool isOverride(void) const
Return true if this model was manually overridden.
Definition: jumptable.hh:480
void destroy(PcodeOp *op)
Destroy/retire the given PcodeOp.
Definition: op.cc:724
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:578
Get rid of registers with trash values.
Definition: coreaction.hh:797
void remapVarnode(Varnode *vn, Symbol *sym, const Address &usepoint)
Remap a Symbol to a given Varnode using a static mapping.
Definition: funcdata_varnode.cc:944
const PcodeOp * start
Beginning of the range.
Definition: cover.hh:36
@ funcname_color
Function identifiers.
Definition: prettyprint.hh:91
ParamEntry * entry
Underlying ParamEntry being assigned to the ParamEntryRange.
Definition: fspec.hh:114
virtual void opIntZext(const PcodeOp *op, const PcodeOp *readOp)=0
Emit a INT_ZEXT operator.
void clearVisitCount(void)
Definition: blockaction.cc:933
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:646
virtual void clearOutput(void)=0
Clear the return value to TYPE_VOID.
virtual SymbolEntry * findContainer(const Address &addr, int4 size, const Address &usepoint) const
Find the smallest Symbol containing the given memory range.
Definition: database_ghidra.cc:284
void parseIncidentalCopy(const Element *el)
Apply incidental copy configuration.
Definition: architecture.cc:882
void doLiveInject(InjectPayload *payload, const Address &addr, BlockBasic *bl, list< PcodeOp * >::iterator pos)
Inject p-code from a payload into this live function.
Definition: funcdata.cc:804
Infrastructure for discovering code extensions to the decompiler.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4990
@ functoken
Emit atom as function name.
Definition: printlanguage.hh:158
string name
The local symbol name recommendation.
Definition: varmap.hh:52
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database_ghidra.hh:77
bool setBreakPoint(uint4 tp, const string &specify)
Set a breakpoint on this action.
Definition: action.cc:169
@ dead
This operation is dead.
Definition: op.hh:72
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:520
void updateSymbol(void) const
(Re)derive the Symbol and offset for this from member Varnodes
Definition: variable.cc:162
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:632
void removeFromFlowSplit(BlockBasic *bl, bool swap)
Remove a basic block splitting its control-flow into two distinct paths.
Definition: funcdata_block.cc:944
bool hasCover(void) const
Determine if this HighVariable has an associated cover.
Definition: variable.hh:126
vector< PcodeOpEdge * > sorter
An array of references to terms for quick sorting.
Definition: coreaction.hh:1059
void resolveExtraPop(void)
Assuming this prototype is locked, calculate the extrapop.
Definition: fspec.cc:3117
Address operator-(int4 off) const
Decrement address by a number of bytes.
Definition: address.hh:404
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:459
int4 maxIterations
Maximum number of iterations before forcing termination.
Definition: rangeutil.hh:297
linetype b
End of full range occupied by the entire recordtype.
Definition: rangemap.hh:81
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:303
vector< string > innames
Identifiers for input types.
Definition: fspec.hh:1132
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: action.cc:890
A simple node used to dynamically define a sequence of operations.
Definition: userop.hh:169
virtual uintb getSize(void) const =0
Return the number of values the variables can take.
void sanityCheck(Funcdata *fd)
Perform sanity check on recovered address targets.
Definition: jumptable.cc:2123
virtual bool unjustifiedContainer(const Address &loc, int4 size, VarnodeData &res) const
Check if the given storage location looks like an unjustified parameter.
Definition: fspec.cc:980
void build(void)
Initialize the Emulate object with the snippet p-code.
Definition: pcodeinject.cc:112
int4 spacing
Spaces to print around operator.
Definition: printlanguage.hh:97
uint4 getComparableFlags(void) const
Get the comparable properties of this prototype.
Definition: fspec.hh:1411
virtual void restoreXml(const Element *el)
Restore this Scope from a <scope> XML tag.
Definition: database.cc:2603
void calcCover(void) const
Turn on the Cover object for this Varnode.
Definition: varnode.cc:227
static void markCopyBlock(FlowBlock *bl, uint4 fl)
Set properties on the first leaf FlowBlock.
Definition: block.cc:1159
static OpToken minusequal
The in-place subtraction operator.
Definition: printc.hh:104
Convert logical to boolean operations: V & W => V && W, V | W => V || W
Definition: ruleaction.hh:518
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:357
void setChunk(uintb offset, int4 size, const uint1 *val)
Set values of an arbitrary sequence of bytes.
Definition: memstate.cc:300
Translate * getTranslate(void) const
Get the Translate object.
Definition: memstate.hh:179
void build_defaultactions(ActionDatabase &allacts)
Build the default actions.
Definition: coreaction.cc:4729
vector< TrackedContext > TrackedSet
A set of tracked registers and their values (at one code point)
Definition: globalcontext.hh:74
vector< StackEqn > guess
Guessed equations for underdetermined systems.
Definition: coreaction.cc:32
virtual bool isOverride(void) const
Return true if this model was manually overridden.
Definition: jumptable.hh:443
virtual int4 getContextSize(void) const =0
Retrieve the number of words (uintm) in a context blob.
OpCode assumedOutputExtension(const Address &addr, int4 size, VarnodeData &res) const
Get the type of extension and containing return value location for the given storage.
Definition: fspec.hh:798
virtual bool isTypeLocked(void) const =0
Is the parameter data-type locked.
virtual void opFloatNotEqual(const PcodeOp *op)=0
Emit a FLOAT_NOTEQUAL operator.
virtual Address getAddress(void) const
Get the storage address for this parameter.
Definition: fspec.cc:2322
virtual void executeUnary(void)
Execute a unary arithmetic/logical operation.
Definition: emulateutil.cc:165
const TypeField * getField(int4 off, int4 sz, int4 *newoff) const
Get field based on offset.
Definition: type.cc:767
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:460
bool isFallthruTrue(void) const
Return true if the fall-thru branch is taken when the boolean input is true.
Definition: op.hh:182
static bool traceTrash(Varnode *vn, vector< PcodeOp * > &indlist)
Decide if the given Varnode only ever flows into CPUI_INDIRECT.
Definition: coreaction.cc:1958
ProtoModel * parseProto(const Element *el)
Build a proto-type model from an XML tag.
Definition: architecture.cc:721
virtual int4 characterizeAsParam(const Address &loc, int4 size) const =0
Characterize whether the given range overlaps parameter storage.
@ no_return
Function does not return.
Definition: fspec.hh:1153
BlockTrace * trace
The active BlockTrace being considered.
Definition: blockaction.hh:146
bool testShrink(int4 i, const Address &addr, int4 sz) const
Test if the given trial can be shrunk to the given range.
Definition: fspec.hh:263
virtual void opIntSborrow(const PcodeOp *op)
Emit a INT_SBORROW operator.
Definition: printc.hh:246
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:956
@ force_hex
Force hexadecimal printing of constant symbol.
Definition: database.hh:177
virtual void tagType(const char *ptr, syntax_highlight hl, const Datatype *ct)
Emit a data-type identifier.
Definition: prettyprint.cc:216
virtual list< SymbolEntry >::const_iterator beginDynamic(void) const
Beginning iterator to dynamic SymbolEntrys.
Definition: database.cc:1808
vector< Varnode * > multiple
Varnodes which are multiples of size.
Definition: ruleaction.hh:35
void registerExeScript(const string &scriptName, int4 injectid)
Map a p-code script name to a payload id.
Definition: pcodeinject.cc:235
Context needed to emit a p-code injection as a full set of p-code operations.
Definition: pcodeinject.hh:56
static uint8 hashName(const string &nm)
Produce a data-type id by hashing the type name.
Definition: type.cc:313
bool inlineSubFunction(FuncCallSpecs *fc)
In-line the sub-function at the given call site.
Definition: flow.cc:1225
vector< Address > unprocessed
Addresses which are permanently unprocessed.
Definition: flow.hh:85
tokentype
The possible types of operator token.
Definition: printlanguage.hh:84
UserOpManage(void)
Construct an empty manager.
Definition: userop.cc:296
virtual void findUnnormalized(uint4 maxaddsub, uint4 maxleftright, uint4 maxext)
Recover the unnormalized switch variable.
Definition: jumptable.hh:330
void extraChecks(list< ParamEntry > &entry)
Check if this entry represents a joined parameter and requires extra scrutiny.
Definition: fspec.cc:399
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1602
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:1147
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3407
virtual Datatype * getSubType(uintb off, uintb *newoff) const
Recover component data-type one-level down.
Definition: type.cc:481
@ truncated
Space is truncated from its original size, expect pointers larger than this size.
Definition: space.hh:84
uintm order
Number for order comparisons within a block.
Definition: address.hh:114
Funcdata * data
The function of which this block is a part.
Definition: block.hh:366
bool removeFromGroup(const string &grp, const string &basegroup)
Remove a group from a root Action.
Definition: action.cc:1059
static bool cancelExtensions(PcodeOp *longform, PcodeOp *subOp, Varnode *ext0In, Varnode *ext1In, Funcdata &data)
Eliminate input extensions on given binary PcodeOp.
Definition: ruleaction.cc:4106
virtual CPoolRecord * createRecord(const vector< uintb > &refs)
Allocate a new CPoolRecord object, given a reference to it.
Definition: cpool_ghidra.cc:24
Class for storing ParamEntry objects in an interval range (rangemap)
Definition: fspec.hh:104
A description where and how data was loaded from memory.
Definition: jumptable.hh:41
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:939
void collapseAll(void)
Run the whole algorithm.
Definition: blockaction.cc:1857
uintb offset
The offset within the space.
Definition: pcoderaw.hh:35
uint4 size
The number of bytes in the location.
Definition: pcoderaw.hh:36
The topological scope of a variable within a basic block.
Definition: cover.hh:35
Definition: sleigh.hh:105
void setCoreType(const string &name, int4 size, type_metatype meta, bool chartp)
Create a core data-type.
Definition: type.cc:1256
Perform Common Sub-expression Elimination on CPUI_MULTIEQUAL ops.
Definition: coreaction.hh:156
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:469
int4 size
An optional/recommended size for the variable being stored.
Definition: varmap.hh:32
vector< vector< Symbol * > > category
References to Symbol objects organized by category.
Definition: database.hh:732
Datatype * concretize(Datatype *ct)
Convert given data-type to concrete form.
Definition: type.cc:1905
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2977
The pool of logically joined variables.
Definition: space.hh:218
virtual void restrictScope(Funcdata *f)
Convert this to a local Scope.
Definition: database.cc:1028
bool recoverLabels(Funcdata *fd)
Recover the case labels for this jump-table.
Definition: jumptable.cc:2518
string tok
Characters of token (if any)
Definition: prettyprint.hh:328
virtual list< SymbolEntry >::const_iterator endDynamic(void) const
Ending iterator to dynamic SymbolEntrys.
Definition: database.cc:1814
const vector< EntryMap * > * map
The list of EntryMaps, one per address space.
Definition: database.hh:331
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:662
Merge range conditions of the form: V f< c, c f< V, V f== c etc.
Definition: ruleaction.hh:308
void pad(void)
Make sure every chunk is followed by at least 512 bytes of pad.
Definition: loadimage_xml.cc:143
virtual Varnode * foldInNormalization(Funcdata *fd, PcodeOp *indop)
Do normalization of the given switch specific to this model.
Definition: jumptable.cc:1421
virtual void executeCallind(void)
Standard behavior for a CALLIND.
Definition: emulateutil.cc:240
bool hasName(void) const
Check if this HighVariable can be named.
Definition: variable.cc:350
PcodeOp * newIndirectOp(PcodeOp *indeffect, const Address &addr, int4 size, uint4 extraFlags)
Find a representative CPUI_RETURN op for this function.
Definition: funcdata_op.cc:633
virtual ProtoParameter * setOutput(const ParameterPieces &piece)
Establish the data-type and storage of the return value.
Definition: fspec.cc:2670
VarnodeLocSet::const_iterator endLoc(int4 s, const Address &addr, uint4 fl) const
End of Varnodes matching storage and properties.
Definition: funcdata.hh:325
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5519
static void restoreTracked(const Element *el, const AddrSpaceManager *manage, TrackedSet &vec)
Restore a sequence of tracked register values from an XML stream.
Definition: globalcontext.cc:90
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2976
static void collapseTable(vector< LoadTable > &table)
Collapse a sequence of table descriptions.
Definition: jumptable.cc:51
void registerAddressCallback(const Address &addr, BreakCallBack *func)
Register an address based breakpoint.
Definition: emulate.cc:43
partmap< Address, TrackedSet > trackbase
Partition map of tracked register sets.
Definition: globalcontext.hh:276
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.cc:62
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3380
uintm uniqbase
Base for unique addresses.
Definition: varnode.hh:328
The base class for a detailed definition of a user-defined p-code operation.
Definition: userop.hh:36
TypeArray * getTypeArray(int4 as, Datatype *ao)
Construct an array data-type.
Definition: type.cc:1807
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1245
uint8 symbolId
Id associated with the original Symbol.
Definition: varmap.hh:34
virtual string getOperatorName(const PcodeOp *op) const
Get the symbol representing this operation in decompiled code.
Definition: userop.cc:68
vector< FuncCallSpecs * > & qlst
The list of discovered sub-function call sites.
Definition: flow.hh:83
list< PcodeOp * >::iterator insertiter
Position in alive/dead list.
Definition: op.hh:119
int4 stageJumpTable(JumpTable *jt, PcodeOp *op, FlowInfo *flow)
Recover a jump-table for a given BRANCHIND using existing flow information.
Definition: funcdata_block.cc:488
Atom(const string &nm, tagtype t, EmitXml::syntax_highlight hl, const PcodeOp *o, const Varnode *v)
Construct a token with an associated PcodeOp and Varnode.
Definition: printlanguage.hh:223
CPUI_FLOAT_NAN behavior.
Definition: opbehavior.hh:380
set< JoinRecord *, JoinRecordCompare > splitset
Different splits that have been defined in join space.
Definition: translate.hh:232
static OpToken assignment
The assignment operator.
Definition: printc.hh:97
Document * parseDocument(istream &s)
Parse an XML document from the given stream.
virtual void executeCall(void)
Standard behavior for a p-code CALL.
Definition: jumptable.cc:102
virtual void resetStats(void)
Reset all the counts to zero.
Definition: action.cc:900
ScopeGhidra(ArchitectureGhidra *g)
Constructor.
Definition: database_ghidra.cc:20
@ coderef
The first parameter to this op is a coderef.
Definition: op.hh:80
list< ReplaceVarnode > newvarlist
Storage for subgraph variable nodes.
Definition: subflow.hh:87
virtual void clearCategory(int4 cat)
Clear all symbols of the given category from this scope.
Definition: database.cc:1901
@ CPUI_CALL
Call to an absolute address.
Definition: opcodes.hh:44
void setHighLevel(void)
Turn on HighVariable objects for all Varnodes.
Definition: funcdata_varnode.cc:471
A container for hints about the data-type layout of an address space.
Definition: varmap.hh:145
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:316
static const Scope * stackCodeLabel(const Scope *scope1, const Scope *scope2, const Address &addr, LabSymbol **addrmatch)
Definition: database.cc:1006
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:194
OpBehavior(OpCode opc, bool isun)
A behavior constructor.
Definition: opbehavior.hh:80
@ unimplemented
placeholder for unimplemented instruction
Definition: op.hh:92
void setVariableRegion(const string &nm, const Address &begad, const Address &endad, uintm value)
Set a context variable by name over a given range of addresses.
Definition: globalcontext.cc:207
string name
Identifier (function name) associated with prototype.
Definition: fspec.hh:1129
void setIndentIncrement(int4 val)
Set the number of characters indented per level of nesting.
Definition: prettyprint.hh:212
virtual int4 startIndent(void)
Start a new indent level.
Definition: prettyprint.hh:147
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:23
Architecture that reads its binary as a raw file.
Definition: raw_arch.hh:35
void newAddress(PcodeOp *from, const Address &to)
Register a new (non fall-thru) flow target.
Definition: flow.cc:204
bool fillinReadOnly(Varnode *vn)
Replace the given Varnode with its (constant) value in the load image.
Definition: funcdata_varnode.cc:505
bool hasInputErrors(void) const
Has this prototype been marked as having an incorrect input parameter descriptions.
Definition: fspec.hh:1265
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2057
Varnode * buildParam(Funcdata &data, Varnode *vn, ProtoParameter *param, Varnode *stackref)
Build a Varnode representing a specific parameter.
Definition: fspec.cc:4072
void parseJumpAssist(const Element *el, Architecture *glb)
Parse a <jumpassist> XML tag.
Definition: userop.cc:484
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3171
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1384
static PcodeOp * canonicalReturnOp(Funcdata &data)
Definition: coreaction.cc:4565
bool hasLoopIn(void) const
Is there a looping edge coming into this block.
Definition: block.cc:398
PcodeOp * previousOp(void) const
Return the previous op within this op's basic block or null.
Definition: op.cc:244
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8144
int4 block2Position(const FlowBlock *bl) const
Convert a basic-block to an out-edge index from the switch.
Definition: jumptable.cc:2163
An infinite loop structure.
Definition: block.hh:613
HighVariable * high
High-level variable of which this is an instantiation.
Definition: varnode.hh:132
CPUI_FLOAT_FLOOR behavior.
Definition: opbehavior.hh:476
Simplify INT_OR with full mask: V = W | 0xffff => V = W
Definition: ruleaction.hh:111
Compare two Varnode pointers by definition then location.
Definition: varnode.hh:39
Information about the INT_SCARRY op-code.
Definition: typeop.hh:391
static const uint4 minorversion
Current minor version of decompiler.
Definition: architecture.hh:72
uintb collapse(bool &markedInput) const
Calculate the constant output produced by this op.
Definition: op.cc:337
RangeList cover
Original range of addresses covered by this basic block.
Definition: block.hh:367
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:375
TypeOpBoolOr(TypeFactory *t)
Constructor.
Definition: typeop.cc:1349
@ return_address
The memory is being used to pass back a return value from the sub-function.
Definition: fspec.hh:310
virtual void tagField(const char *ptr, syntax_highlight hl, const Datatype *ct, int4 off)
Emit an identifier for a field within a structured data-type.
Definition: prettyprint.cc:1035
@ CALLMECHANISM_TYPE
Injection to patch up data-flow around the caller/callee boundary.
Definition: pcodeinject.hh:83
static PcodeOp * findSubshift(PcodeOp *op, int4 &n, OpCode &shiftopc)
Check for shift form of expression.
Definition: ruleaction.cc:6640
Toggle whether in-place operators (+=, *=, &=, etc.) are emitted by the decompiler.
Definition: options.hh:129
void setInternal(ProtoModel *m, Datatype *vt)
Set internal backing storage for this.
Definition: fspec.cc:3040
bool contains(const Address &addr) const
Determine if the address is in this Range.
Definition: address.hh:458
uint4 flags
Properties of the section.
Definition: loadimage.hh:55
JumpTable * jumptable
The jump-table that is building this model.
Definition: jumptable.hh:234
@ fieldtoken
Emit atom as structure field.
Definition: printlanguage.hh:161
static void checkNewToConstructor(Funcdata &data, Varnode *vn)
Set special properties on output of CPUI_NEW.
Definition: coreaction.cc:2716
vector< string * > value
List of values for each formal XML attribute.
Definition: xml.hh:41
string pspec
Processor specification to configure with.
Definition: ghidra_process.hh:103
uint4 getEvalType(void) const
Get the evaluation type of this op.
Definition: op.hh:160
static AddrSpace * selectInferSpace(Varnode *vn, PcodeOp *op, const vector< AddrSpace * > &spaceList)
Select the AddrSpace in which we infer with the given constant is a pointer.
Definition: coreaction.cc:986
PcodeOp * op
The current descendant or the defining PcodeOp.
Definition: coreaction.hh:1029
virtual void tagComment(const char *ptr, syntax_highlight hl, const AddrSpace *spc, uintb off)
Emit a comment string as part of the generated source code.
Definition: prettyprint.hh:250
Address first
The first address of the range.
Definition: database.hh:811
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const
Given an address and data-type, build a suitable generic symbol name.
Definition: varmap.cc:396
void pushBoolConstant(uintb val, const TypeBase *ct, const Varnode *vn, const PcodeOp *op)
Push a true or false token to the RPN stack.
Definition: printc.cc:1191
bool ismark
Possible mark.
Definition: blockaction.hh:106
virtual SymbolEntry * addSymbol(const string &name, Datatype *ct, const Address &addr, const Address &usepoint)
Add a new Symbol to this Scope, given a name, data-type, and a single mapping.
Definition: database_ghidra.cc:388
ArchitectureGhidra * ghidra
Architecture and connection to the Ghidra client.
Definition: database_ghidra.hh:36
uint4 flags
Boolean properties of the function prototype.
Definition: fspec.hh:1167
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:295
void tagVariable(const char *ptr, EmitXml::syntax_highlight h, const Varnode *v, const PcodeOp *o)
Create a variable identifier token.
Definition: prettyprint.hh:443
Address constructFloatExtensionAddress(const Address &realaddr, int4 realsize, int4 logicalsize)
Build a logically lower precision storage location for a bigger floating point register.
Definition: translate.cc:725
@ typerecovery_on
Set if data-type recovery is started.
Definition: funcdata.hh:52
int4 stackPlaceholderSlot
Slot containing temporary stack tracing placeholder (-1 means unused)
Definition: fspec.hh:1443
Classes for describing address spaces.
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1148
Transform shifts in comparisons: V >> c == d => V == (d << c)
Definition: ruleaction.hh:398
string source
Description of the source of this snippet.
Definition: pcodeinject.hh:136
Information about the CAST op-code.
Definition: typeop.hh:708
bool checkSwitchSkips(FlowBlock *switchbl, FlowBlock *exitblock)
Check for switch edges that go straight to the exit block.
Definition: blockaction.cc:1587
vector< VarnodeData > inputlist
Storage location for input parameters.
Definition: pcodeinject.hh:62
@ is_destructor
Function is an (object-oriented) destructor.
Definition: fspec.hh:1160
void removeInput(int4 slot)
Eliminate a specific input Varnode.
Definition: op.cc:201
virtual JumpModel * clone(JumpTable *jt) const
Clone this model.
Definition: jumptable.cc:406
An active container for a set of p-code operations that can be injected into data-flow.
Definition: pcodeinject.hh:78
@ marker
Definition: op.hh:73
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:299
vector< string > callOtherTarget
Map from injectid to callother-fixup target-op name.
Definition: pcodeinject.hh:172
A call-fixup injection that uses a Ghidra client to generate the p-code ops.
Definition: inject_ghidra.hh:50
FlowBlock * destnode
Next FlowBlock node this BlockTrace will try to push into.
Definition: blockaction.hh:130
void cancelInjectId(void)
Turn-off any in-lining for this function.
Definition: fspec.cc:3169
bool absorb(RangeHint *b)
Try to absorb the other RangeHint into this.
Definition: varmap.cc:107
int4 precision
Number of bytes of precision in the logical flow.
Definition: subflow.hh:151
SymbolNameTree multiEntrySet
Set of symbols with multiple entries.
Definition: database.hh:734
ProtoModel * defaultfp
Parsed form of default prototype.
Definition: architecture.hh:138
TypeOpIntScarry(TypeFactory *t)
Constructor.
Definition: typeop.cc:1019
map< SeqNum, ValueSetRead > readNodes
Additional, after iteration, add-on value sets.
Definition: rangeutil.hh:290
ScoreProtoModel(bool isinput, const ProtoModel *mod, int4 numparam)
Constructor.
Definition: fspec.cc:2048
uint4 nextScopeId
Id for next attached scope (0 reserved for global scope)
Definition: database.hh:843
ConstantPool * cpool
The constant pool container.
Definition: typeop.hh:762
Information about heritage passes performed for a specific address space.
Definition: heritage.hh:85
uintb getPointerLowerBound(void) const
Get lower bound for assuming an offset is a pointer.
Definition: space.hh:346
virtual void endFunction(int4 id)
End a whole declaration and body of a function.
Definition: prettyprint.hh:226
void tagLine(void)
Create a line break token.
Definition: prettyprint.hh:578
Scope * globalscope
A quick reference to the global Scope.
Definition: database.hh:840
bool protectFreeStores(AddrSpace *spc, vector< PcodeOp * > &freeStores)
Identify any CPUI_STORE ops that use a free pointer from a given address space.
Definition: heritage.cc:792
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:642
Definition: prefersplit.hh:29
virtual string buildUndefinedName(void) const =0
Build a formal undefined name, used internally when a Symbol is not given a name.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5217
virtual void adjustTypeOperators(void)
Set basic data-type information for p-code operators.
Definition: printjava.cc:99
void checkstart(void)
Enforce whitespace for a start token.
Definition: prettyprint.cc:794
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:188
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:482
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:201
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7212
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:583
void pushOp(const OpToken *tok, const PcodeOp *op)
Push an operator token onto the RPN stack.
Definition: printlanguage.cc:117
AddrSpace * getDefaultCodeSpace(void) const
Get the default address space of this processor.
Definition: translate.hh:490
bool unjustifiedInputParam(const Address &addr, int4 size, VarnodeData &res) const
Check if the given storage location looks like an unjustified input parameter.
Definition: fspec.cc:3499
int4 numMergeClasses
Number of different speculative merge classes in this.
Definition: variable.hh:60
Obtaining context information from a Ghidra client.
static bool newDomain(uintb newMask, int4 newStep, uintb &myleft, uintb &myright)
Make this range fit in a new domain.
Definition: rangeutil.cc:141
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:304
bool traceBackward(ReplaceVarnode *rvn)
Trace the logical data-flow backward for the given subgraph variable.
Definition: subflow.cc:608
bool finaltrace
Have we a made search for unstructured edges in the final DAG.
Definition: blockaction.hh:191
MapState(AddrSpace *spc, const RangeList &rn, const RangeList &pm, Datatype *dt)
Constructor.
Definition: varmap.cc:703
PcodeOp * cbranch2
CBRANCH at bottom of block2.
Definition: blockaction.hh:250
@ isolate
Symbol should not speculatively merge automatically.
Definition: database.hh:183
vector< JoinRecord * > splitlist
JoinRecords indexed by join address.
Definition: translate.hh:233
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:391
static OpToken xorequal
The in-place logical xor operator.
Definition: printc.hh:109
void markRedundantCopies(HighVariable *high, vector< PcodeOp * > ©, int4 pos, int4 size)
Search for and mark redundant COPY ops into the given high as non-printing.
Definition: merge.cc:1139
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
void registerCallOtherFixup(const string &fixupName, int4 injectid)
Map a callother-fixup name to a payload id.
Definition: pcodeinject.cc:203
static void readResponseEnd(istream &s)
Read the ending query response protocol marker.
Definition: ghidra_arch.cc:196
void clearResolveRecursive(Scope *scope)
Clear the ownership ranges of a given Scope and its children.
Definition: database.cc:2749
ParamList * output
Resource model for output parameters.
Definition: fspec.hh:621
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage)=0
Restore the state of this database object from a serialized XML stream.
Routines for emitting high-level (C) language syntax in a well formatted way.
FlowBlock * exitblock
Official exit block from loop, or NULL.
Definition: blockaction.hh:49
bool mustreconstruct
Must make a copy of final boolean operation.
Definition: ruleaction.hh:1358
virtual void opStore(const PcodeOp *op)=0
Emit a STORE operator.
Simplify division form: (V + (V s>> 0x1f)>>(32-n)) & (-1<<n) => (V s/ 2^n) * 2^n
Definition: ruleaction.hh:1198
void generateConstraints(const vector< Varnode * > &worklist, const vector< PcodeOp * > &reads)
Generate constraints given a system of Varnodes.
Definition: rangeutil.cc:2234
int4 visitcount
A count of visits of this node for various algorithms.
Definition: block.hh:112
@ externref
Varnode address is specially mapped by the loader.
Definition: varnode.hh:89
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
BreakTable * breaktable
The table of breakpoints.
Definition: emulate.hh:301
int4 size
The number of words in the array.
Definition: globalcontext.hh:266
void clear(void)
Clear out all types.
Definition: type.cc:1325
Address calladdr
If the instruction being injected is a call, this is the address being called.
Definition: pcodeinject.hh:61
static int4 multipleInteraction(vector< Varnode * > &multlist)
Find multiple descendant chains.
Definition: coreaction.cc:2606
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1725
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3974
@ force_pointer
Force '*' notation for pointers.
Definition: printlanguage.hh:142
void splitBasic(void)
Split raw p-code ops up into basic blocks.
Definition: flow.cc:956
Simplify INT_LESS applied to extremal constants.
Definition: ruleaction.hh:944
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:499
const Address & getAddr(void) const
Get address of this operation.
Definition: pcoderaw.hh:166
vector< int4 > depth
Dominator depth of individual blocks.
Definition: heritage.hh:207
virtual void printTree(ostream &s, int4 level) const
Print tree structure of any blocks owned by this.
Definition: block.cc:2608
virtual void endFunction(int4 id)
End a whole declaration and body of a function.
Definition: prettyprint.cc:52
@ big_varnodes_generated
Set when search for laned registers is complete.
Definition: funcdata.hh:60
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:1671
virtual bool executeCbranch(void)
Check if the conditional of a CBRANCH is true.
Definition: emulateutil.cc:85
Varnode * vn
The Varnode attached to a normal ValueSet node (or NULL)
Definition: rangeutil.hh:282
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:622
AddrSpace * getSpace(void) const
Get the address space associated with this memory bank.
Definition: memstate.hh:82
virtual void clear(void)
Release any (local) resources.
Definition: cpool.hh:195
virtual void executeBranch(void)
Standard behavior for a BRANCH.
Definition: jumptable.cc:90
TypeOpLoad(TypeFactory *t)
Constructor.
Definition: typeop.cc:358
Varnode * replacement
The new smaller Varnode.
Definition: subflow.hh:45
int4 leftotal
Definition: prettyprint.hh:708
virtual Funcdata * findFunction(const Address &addr) const
Find the function starting at the given address.
Definition: database.cc:2184
int4 restoreXmlInject(const string &src, const string &nm, int4 tp, const Element *el)
Read in and register an injection payload from an XML stream.
Definition: pcodeinject.cc:319
void recoverMultistage(Funcdata *fd)
Recover jump-table addresses keeping track of a possible previous stage.
Definition: jumptable.cc:2474
virtual void saveXmlHeader(ostream &s) const
Save basic information as XML attributes.
Definition: block.cc:2825
TypeOpNotEqual(TypeFactory *t)
Constructor.
Definition: typeop.cc:831
@ indirect_store
CPUI_INDIRECT is caused by CPUI_STORE.
Definition: op.hh:100
Datatype * findNoName(Datatype &ct)
Find data-type (in this container) by function.
Definition: type.cc:1411
const string & name
The actual printed characters of the token.
Definition: printlanguage.hh:195
void foldIn(ProtoModel *model)
Fold-in an additional prototype model.
Definition: fspec.cc:2175
vector< ParamEntryResolver * > resolverMap
Map from space id to resolver.
Definition: fspec.hh:499
list< PcodeOp * > block_edge1
Source p-code op (Edges between basic blocks)
Definition: flow.hh:90
int4 getSlot(const Address &addr, int4 skip) const
Calculate the slot occupied by a specific address.
Definition: fspec.cc:231
CPUI_FLOAT_SUB behavior.
Definition: opbehavior.hh:412
virtual void resolveArchitecture(void)
Figure out the processor and compiler of the target executable.
Definition: bfd_arch.cc:82
virtual void opCallind(const PcodeOp *op)
Emit a CALLIND operator.
Definition: printc.cc:482
void saveXml(ostream &s) const
Save a description of this as an <loadtable> XML tag.
Definition: jumptable.cc:21
uint4 size
Size of the parameter Varnode in bytes.
Definition: pcodeinject.hh:37
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6539
list< ParamEntry > entry
The ordered list of parameter entries.
Definition: fspec.hh:498
virtual const vector< OpBehavior * > & getBehaviors(void)
Get the array of op-code behaviors for initializing and emulator.
Definition: inject_ghidra.cc:202
static OpToken rightequal
The in-place right shift operator.
Definition: printc.hh:106
uint4 hasEffectTranslate(const Address &addr, int4 size) const
Calculate type of side-effect for a given storage location (with caller translation)
Definition: fspec.cc:4947
@ nofallthru
Fall-thru no longer exists.
Definition: printlanguage.hh:150
Formal "void" data-type object.
Definition: type.hh:206
@ coverdirty
Cover is not upto date.
Definition: varnode.hh:102
string processor
Name of processor.
Definition: sleigh_arch.hh:50
partmap< Address, FreeArray > database
Partition map of context blobs (FreeArray)
Definition: globalcontext.hh:275
@ bump_t
Required line break.
Definition: prettyprint.hh:322
@ paramshift_applied
paramshift parameters have been added and removed
Definition: fspec.hh:1154
set< Range > tree
The sorted list of Range objects.
Definition: address.hh:204
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1369
static ArchitectureCapability * findCapability(const string &filename)
Find an extension to process a file.
Definition: architecture.cc:41
bool option_nocasts
Don't print a cast if true.
Definition: printc.hh:118
virtual void opCbranch(const PcodeOp *op)=0
Emit a CBRANCH operator.
virtual bool preferComplement(Funcdata &data)
Rearrange this hierarchy to simplify boolean expressions.
Definition: block.cc:2859
map< int4, AddrSpace * > shortcut2Space
Map from shortcut -> space.
Definition: translate.hh:222
All storage/state for a pcode machine.
Definition: memstate.hh:148
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:822
A basic jump-table model with an added default address path.
Definition: jumptable.hh:405
A SAX interface implementation for constructing an in-memory DOM model.
Definition: xml.hh:217
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:251
virtual void emitExpression(const PcodeOp *op)=0
Emit a full expression.
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:520
virtual void executeCallind(void)=0
Standard behavior for a CALLIND.
virtual void opFloatAdd(const PcodeOp *op)
Emit a FLOAT_ADD operator.
Definition: printc.hh:269
Document * getPcodeInject(const string &name, int4 type, const InjectContext &con)
Retrieve p-code to inject for a specific context.
Definition: ghidra_arch.cc:633
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:228
bool isTranslateReused(void)
Test if last Translate object can be reused.
Definition: sleigh_arch.cc:138
vector< FlowBlock * > sortlist
The list of deserialized FlowBlock objects.
Definition: block.hh:688
@ ignore_outofbounds
Ignore/truncate flow into addresses out of the specified range.
Definition: flow.hh:58
A class for ordering Varnode terms in an additive expression.
Definition: coreaction.hh:1056
PropagationState(Varnode *v)
Constructor.
Definition: coreaction.cc:4367
void setExitMarks(FlowBlock *graph)
Mark all the exits to this loop.
Definition: blockaction.cc:409
spacetype type
Type of space (PROCESSOR, CONSTANT, INTERNAL, ...)
Definition: space.hh:94
virtual void opCpoolRefOp(const PcodeOp *op)
Emit a CPOOLREF operator.
Definition: printjava.cc:251
vector< uint4 > modstack
Printing modification stack.
Definition: printlanguage.hh:232
uint1 * getPcodePacked(const Address &addr)
Get p-code for a single instruction.
Definition: ghidra_arch.cc:455
@ no_code
Set if there is no code available for this function.
Definition: funcdata.hh:53
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1239
Varnode * extravn
The starting Varnode associated with the extra value.
Definition: jumptable.hh:205
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:349
uintm getValue(const uintm *vec) const
Retrieve this value from a given context blob.
Definition: globalcontext.hh:58
int4 transferLockedInputParam(ProtoParameter *param)
Get the index of the CALL input Varnode that matches the given parameter.
Definition: fspec.cc:4105
bool injectSubFunction(FuncCallSpecs *fc)
Perform injection replacing the CALL at the given call site.
Definition: flow.cc:1247
@ has_nearpointers
Does there exist near pointers into this space.
Definition: space.hh:87
map< string, ArchOption * > optionmap
A map from option name to registered ArchOption instance.
Definition: options.hh:65
string cspecxml
XML cspec passed from Ghidra.
Definition: ghidra_arch.hh:65
static SymbolEntry * isPointer(AddrSpace *spc, Varnode *vn, PcodeOp *op, int4 slot, Address &rampoint, uintb &fullEncoding, Funcdata &data)
Determine if given Varnode might be a pointer constant.
Definition: coreaction.cc:1024
void buildXrefs(vector< string > &errorPairs)
Build register map. Collect user-ops and context-fields.
Definition: sleighbase.cc:31
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:541
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:653
uint4 instr_comment_type
Type of instruction comments to display.
Definition: printlanguage.hh:246
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3201
virtual void executeNew(void)=0
Standard behavior for (low-level) NEW op.
@ m_minimal
Smallest possible address.
Definition: address.hh:53
static string appendSize(const string &base, int4 size)
Append a suffix to a string encoding a specific size.
Definition: userop.cc:39
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4913
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:162
@ activeheritage
The varnode is actively being heritaged.
Definition: varnode.hh:112
Class for holding an edge while the underlying graph is being manipulated.
Definition: blockaction.hh:29
void addSuggestedPatch(ReplaceVarnode *rvn, PcodeOp *pushop, int4 sa)
Mark a subgraph variable flowing to an operation that expands it by padding with zero bits.
Definition: subflow.cc:1117
map< string, int4 > callOtherFixupMap
Map of registered callother-fixup names to injection id.
Definition: pcodeinject.hh:168
virtual void pushPartialSymbol(const Symbol *sym, int4 off, int4 sz, const Varnode *vn, const PcodeOp *op, Datatype *outtype)=0
Push a variable that represents only part of a symbol onto the RPN stack.
Describes a (register) storage location and the ways it might be split into lanes.
Definition: transform.hh:88
Varnode * xref(Varnode *vn)
Insert a Varnode into the sorted lists.
Definition: varnode.cc:915
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:485
void setValue(uintb offset, int4 size, uintb val)
Set the value of a (small) range of bytes.
Definition: memstate.cc:180
void splitJoinRead(Varnode *vn, JoinRecord *joinrec)
Construct pieces for a join-space Varnode read by an operation.
Definition: heritage.cc:1689
virtual void buildLabels(Funcdata *fd, vector< Address > &addresstable, vector< uintb > &label, const JumpModel *orig) const
Recover case labels associated with the Address table.
Definition: jumptable.cc:1381
Varnode * newUniqueOut(int4 s, PcodeOp *op)
Create a new temporary output Varnode.
Definition: funcdata_varnode.cc:122
Convert INT_SLESS to INT_LESS when comparing positive values.
Definition: ruleaction.hh:468
virtual ~LoadImage(void)
LoadImage destructor.
Definition: loadimage.hh:119
int4 slot
The input slot of the term.
Definition: coreaction.hh:1040
void addBlockToSwitch(BlockBasic *bl, uintb lab)
Force a given basic-block to be a switch destination.
Definition: jumptable.cc:2339
uintb sign_extend(uintb in, int4 sizein, int4 sizeout)
Sign-extend a value between two byte sizes.
Definition: address.cc:604
Information about the INT_EQUAL op-code.
Definition: typeop.hh:301
int4 offset
Offset (into containing struct) of subfield.
Definition: type.hh:125
CPUI_INT_SLESS behavior.
Definition: opbehavior.hh:145
virtual void setEncoding(const string &val)
Set the character encoding as specified by the current document.
Definition: xml.hh:237
bool warningissued
true if warning issued previously
Definition: heritage.hh:92
static uint4 stringToType(const string &nm)
Convert a string to a flow override type.
Definition: override.cc:434
virtual int4 print(ostream &s, int4 num, int4 depth) const
Print a description of this Action to stream.
Definition: action.cc:736
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: inject_ghidra.cc:136
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:267
virtual SymbolEntry * addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim)=0
Create a new SymbolEntry for a Symbol given a memory range.
virtual void setDocumentLocator(Locator locator)
Set the Locator object for documents.
Definition: xml.hh:224
virtual void findByName(const string &name, vector< Symbol * > &res) const
Find a Symbol by name within this Scope.
Definition: database.cc:2268
uint4 gototype
The type of unstructured edge (if present)
Definition: block.hh:554
void constraintsFromPath(int4 type, CircleRange &lift, Varnode *startVn, Varnode *endVn, PcodeOp *cbranch)
Generate constraints given a Varnode path.
Definition: rangeutil.cc:2171
void removeBlock(FlowBlock *bl)
Remove a FlowBlock from this BlockGraph.
Definition: block.cc:1417
~UserOpManage(void)
Destructor.
Definition: userop.cc:303
ifstream * thefile
Main file stream for image.
Definition: loadimage.hh:98
Information about the NEW op-code.
Definition: typeop.hh:773
int4 outindex
Index coming out of switch to this case.
Definition: block.hh:639
virtual uintb find(uintb addr) const
Overridden aligned word find.
Definition: memstate.cc:573
bool intersects(const Varnode &op) const
Return true if the storage locations intersect.
Definition: varnode.cc:113
Container class for ParamTrial objects.
Definition: fspec.hh:223
const PcodeOp * op
Pcode-op associated with this token.
Definition: prettyprint.hh:331
map< Varnode *, uintb > varnodeMap
Light-weight memory state based on Varnodes.
Definition: jumptable.hh:102
void globalify(void)
Mark all spaces as global.
Definition: architecture.cc:366
vector< CaseOrder > caseblocks
Blocks associated with switch cases.
Definition: block.hh:645
bool possibleInputParam(const Address &addr, int4 size) const
Decide whether a given storage location could be an input parameter.
Definition: fspec.cc:3439
virtual void clearOutput(void)
Clear the return value to TYPE_VOID.
Definition: fspec.cc:2555
static FlowBlock * findBlock(const vector< FlowBlock * > &list, int4 ind)
Locate a FlowBlock with a given index.
Definition: block.cc:3212
DatatypeSet tree
Datatypes within this factory (sorted by function)
Definition: type.hh:385
ConstantSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Only constructor.
Definition: space.cc:359
void printRaw(ostream &s) const
Print raw p-code op descriptions to a stream.
Definition: funcdata.cc:181
int4 translate2Op(OpCode &opc, uintb &c, int4 &cslot) const
Translate range to a comparison op.
Definition: rangeutil.cc:1410
int4 word
Index of word containing this context value.
Definition: globalcontext.hh:31
string spaceName
Name of space to be truncated.
Definition: translate.hh:64
A helper class holding a Varnode pointer reference and a possible index added to it.
Definition: varmap.hh:111
bool checkConditionalExe(State &state)
Check if current Varnode produced by conditional flow.
Definition: funcdata_varnode.cc:1548
virtual Funcdata * findFunction(const Address &addr) const
Find the function starting at the given address.
Definition: database_ghidra.cc:321
void applyPrototype(Funcdata &data, FuncCallSpecs &fspecs) const
Look for and apply a function prototype override.
Definition: override.cc:150
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:240
Make required Varnode merges as dictated by CPUI_MULTIEQUAL, CPUI_INDIRECT, and addrtied property.
Definition: coreaction.hh:350
bool isCollapsible(void) const
Definition: op.cc:115
Simplify expressions that optimize INT_REM and INT_SREM.
Definition: ruleaction.hh:1209
bool operator!=(const ProtoParameter &op2) const
Compare storage location and data-type for inequality.
Definition: fspec.hh:955
uintb emulatePath(uintb val, const PathMeld &pathMeld, PcodeOp *startop, Varnode *startvn)
Execute from a given starting point and value to the common end-point of the path set.
Definition: jumptable.cc:180
Emulate * emulate
The emulator associated with this table.
Definition: emulate.hh:138
JumpValuesRange * jrange
Range of values for the (normalized) switch variable.
Definition: jumptable.hh:346
Remove a CPUI_INDIRECT if its blocking PcodeOp is dead.
Definition: ruleaction.hh:528
uint4 vnproc
Number of Varnodes processed in the markvn list so far.
Definition: dynamic.hh:61
EmitXml::syntax_highlight highlight
The type of highlighting to use when emitting the token.
Definition: printlanguage.hh:197
int4 isConstantExtended(uintb &val) const
Definition: varnode.cc:699
vector< ProtoParameter * > inparam
Descriptions of input parameters.
Definition: fspec.hh:1108
TypeEnum(const TypeEnum &op)
Construct from another TypeEnum.
Definition: type.cc:531
SubsortPosition subsorttype
The sub-sort object for a rangemap.
Definition: fspec.hh:130
Address usePoint
Use point of the Symbol.
Definition: varmap.hh:50
Convert LOAD operations using a constant offset to COPY.
Definition: ruleaction.hh:709
@ flow_forinline
Indicate flow is being generated to in-line (a function)
Definition: flow.hh:70
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:283
A union of other input parameter passing models.
Definition: fspec.hh:578
string pspecxml
XML pspec passed from Ghidra.
Definition: ghidra_arch.hh:64
void opDestroyRaw(PcodeOp *op)
Remove the given raw PcodeOp.
Definition: funcdata_op.cc:226
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:1024
virtual void opIntMult(const PcodeOp *op)
Emit a INT_MULT operator.
Definition: printc.hh:255
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: pcodeinject.cc:62
void clearCallSpecs(void)
Remove all call specifications.
Definition: funcdata.cc:395
void propagateConstant(Varnode *varVn, Varnode *constVn, FlowBlock *constBlock, Funcdata &data)
Replace reads of a given Varnode with a constant.
Definition: coreaction.cc:3549
int4 numslots
(Maximum) number of slots that can store separate parameters
Definition: fspec.hh:71
virtual Datatype * getSubType(uintb off, uintb *newoff) const
Recover component data-type one-level down.
Definition: type.cc:783
virtual int4 getCategorySize(int4 cat) const
Get the number of Symbols in the given category.
Definition: database.cc:2664
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2749
AddrSpace * spc
The address space being segmented.
Definition: architecture.hh:284
vector< AddressResolver * > resolvelist
Special constant resolvers.
Definition: translate.hh:220
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:756
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:352
A generic unary operator: one input and one output.
Definition: typeop.hh:172
bool initialize(Varnode *vn)
Initialize based on output Varnode.
Definition: ruleaction.cc:7780
@ CPUI_FLOAT_CEIL
Round towards +infinity.
Definition: opcodes.hh:104
virtual bool isHiddenReturn(void) const
Is this a pointer to storage for a return value.
Definition: fspec.cc:2358
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5590
Base class for the fundamental atomic types.
Definition: type.hh:158
bool setFields(vector< TypeField > &fd, TypeStruct *ot, int4 fixedsize)
Set fields on a TypeStruct.
Definition: type.cc:1487
map< Address, string >::const_iterator cursymbol
Current symbol being reported.
Definition: loadimage_xml.hh:35
static FileManage specpaths
Known directories that contain .ldefs files.
Definition: sleigh_arch.hh:123
JoinRecord * findJoinInternal(uintb offset) const
Find JoinRecord for offset in the join space.
Definition: translate.cc:655
const uintm * context
The current cached context blob.
Definition: globalcontext.hh:315
static uintb gatherOffset(Varnode *vn)
If the given Varnode is a sum result, return the constant portion of this sum.
Definition: varmap.cc:659
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:652
int4 characterizeOverlap(const Varnode &op) const
Return 0, 1, or 2 for "no overlap", "partial overlap", "identical storage".
Definition: varnode.cc:147
void updateAllTypes(const vector< string > &namelist, const vector< Datatype * > &typelist, bool dtdtdt)
Set this entire function prototype based on a list of names and data-types.
Definition: fspec.cc:3310
Concatenation with sign bits becomes an extension: concat( V s>> #0x1f , V) => sext(V)
Definition: ruleaction.hh:91
static vector< CapabilityPoint * > & getList(void)
Retrieve the list of extension point singletons.
Definition: capability.cc:22
static const char universalname[]
The name of the universal root Action.
Definition: action.hh:299
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:868
Actions and classes associated with transforming and structuring the control-flow graph.
static FlowBlock * createVirtualRoot(const vector< FlowBlock * > &rootlist)
Create a single root block.
Definition: block.cc:914
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:413
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:72
@ CPUI_MAX
Value indicating the end of the op-code values.
Definition: opcodes.hh:127
void saveXmlHigh(ostream &s) const
Save an XML description of all HighVariables to stream.
Definition: funcdata.cc:607
virtual TrackedSet & getTrackedDefault(void)
Get the set of default values for all tracked registers.
Definition: ghidra_context.hh:71
Class for calculating "goodness of fit" of parameter trials against a prototype model.
Definition: fspec.hh:843
Base class for applications that process SLEIGH format specifications.
int4 getNumLabels(int4 i) const
Get the number of labels associated with one case block.
Definition: block.hh:658
int4 spaceremain
Space remaining in current line.
Definition: prettyprint.hh:706
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:667
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:126
int4 mostsigbit_set(uintb val)
Return index of most significant bit set in given value.
Definition: address.cc:705
An implementation of the Scope interface by querying a Ghidra client for Symbol information.
Definition: database_ghidra.hh:35
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:419
@ IPTR_CONSTANT
Special space to represent constants.
Definition: space.hh:29
A block that terminates with an unstructured (goto) branch to another block.
Definition: block.hh:442
int4 indentlevel
Current indent level (in fixed width characters)
Definition: prettyprint.hh:80
virtual void restrictScope(Funcdata *f)
Convert this to a local Scope.
Definition: database_ghidra.hh:103
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:592
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: double.hh:294
ParamListStandard(const ParamListStandard &op2)
Copy constructor.
Definition: fspec.cc:421
Find explicit Varnodes: Varnodes that have an explicit token representing them in the output.
Definition: coreaction.hh:415
virtual void pushSymbol(const Symbol *sym, const Varnode *vn, const PcodeOp *op)
Push a specific Symbol onto the RPN stack.
Definition: printc.cc:1563
void closeParen(char c, int4 id)
Create a close parenthesis.
Definition: prettyprint.hh:528
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:594
@ mapped
Varnode has a database entry associated with it.
Definition: varnode.hh:99
void parseSegmentOp(const Element *el, Architecture *glb)
Parse a <segmentop> XML tag.
Definition: userop.cc:417
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:228
static uintb backup2Switch(Funcdata *fd, uintb output, Varnode *outvn, Varnode *invn)
Back up the constant value in the output Varnode to the value in the input Varnode.
Definition: jumptable.cc:464
void halfDeleteInEdge(int4 slot)
Delete the in half of an edge, correcting indices.
Definition: block.cc:88
vector< int4 > inputConsume
Number of bytes consumed by sub-function, for each input parameter.
Definition: fspec.hh:1448
virtual void clear(void)
Release any (local) resources.
Definition: cpool_ghidra.hh:39
@ status_repeat
Repeating the same action.
Definition: action.hh:65
JoinSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Definition: space.cc:463
Information about the INT_ZEXT op-code.
Definition: typeop.hh:349
Address addr
Starting address of the storage location.
Definition: database.hh:55
@ label_t
A code label.
Definition: prettyprint.hh:315
void setDefaultDataSpace(int4 index)
Set the default address space for data.
Definition: translate.cc:268
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4389
static void loadLanguageDescription(const string &specfile, ostream &errs)
Read a SLEIGH .ldefs file.
Definition: sleigh_arch.cc:95
void emitOp(const ReversePolish &entry)
Send an operator token from the RPN to the emitter.
Definition: printlanguage.cc:326
virtual void pushType(const Datatype *ct)
Push a data-type name onto the RPN expression stack.
Definition: printc.cc:1176
@ begin
A token that starts a printing group.
Definition: prettyprint.hh:282
TypeOpIntSdiv(TypeFactory *t)
Constructor.
Definition: typeop.cc:1268
uint8 hash
The calculated hash value.
Definition: dynamic.hh:71
vector< State > stateStack
Holds the depth-first traversal stack.
Definition: funcdata.hh:605
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:767
virtual void endVarDecl(int4 id)
End a variable declaration.
Definition: prettyprint.cc:952
@ CPUI_POPCOUNT
Count the 1-bits.
Definition: opcodes.hh:125
Class for fetching p-code from a Ghidra client.
virtual Rule * getSubRule(const string &specify)
Retrieve a specific sub-rule by name.
Definition: action.cc:277
(Lightweight) emulation interface for executing PcodeOp objects within a syntax tree or for executing...
virtual void resetSizeLockType(TypeFactory *factory)=0
Clear this parameter's data-type preserving any size-lock.
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:162
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3755
int4 compareTo(const Cover &op2) const
Give ordering of this and another Cover.
Definition: cover.cc:221
Simplify PIECE intended as embedding: concat(V, sub(W,0)) => W & 0xff | (zext(W) << 8)
Definition: ruleaction.hh:904
edge_flags
Boolean properties on edges.
Definition: block.hh:95
virtual int4 beginStatement(const PcodeOp *op)
Begin a source code statement.
Definition: prettyprint.hh:235
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1127
void spaces(int4 num, int4 bump)
Create a whitespace token.
Definition: prettyprint.hh:574
A record indicating a function symbol.
Definition: loadimage.hh:36
virtual void opIntSdiv(const PcodeOp *op)=0
Emit a INT_SDIV operator.
bool checkForLegalCode(void) const
Check for p-code that is deemed illegal for a snippet.
Definition: emulateutil.cc:325
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:310
void insertPcode(Funcdata &data)
Inject any upon-return p-code at this call site.
Definition: fspec.cc:4545
void setScope(Scope *s, const Address &startpoint)
Set a backing symbol Scope for this.
Definition: fspec.cc:3028
void addRefRecurse(const FlowBlock *bl)
Fill-in this recursively from the given block.
Definition: cover.cc:463
PcodeOp * def
The defining operation of this Varnode.
Definition: varnode.hh:131
virtual void clear(void)
Clear the RPN stack and the low-level emitter.
Definition: printlanguage.cc:770
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6205
A range of values attached to a Varnode within a data-flow subsystem.
Definition: rangeutil.hh:111
VarnodeDefSet::const_iterator beginDef(void) const
Start of all Varnodes sorted by definition address.
Definition: funcdata.hh:336
AddrSpace * uniqspace
Temporary space associated with processor.
Definition: translate.hh:230
A class that holds a data-type traversal state during type propagation.
Definition: coreaction.hh:1025
vector< Document * > doclist
The list of documents held by this container.
Definition: xml.hh:250
An implementation of the LoadImage interface using a Ghidra client as the back-end.
Definition: loadimage_ghidra.hh:29
virtual void getRegionForSet(vector< uintm * > &res, const Address &addr1, const Address &addr2, int4 num, uintm mask)
Grab the context blob(s) for the given address range, marking bits that will be set.
Definition: ghidra_context.hh:38
void emitGlobalVarDeclsRecursive(Scope *scope)
Emit variable declarations for all global symbols under given scope.
Definition: printc.cc:2217
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: blockaction.hh:338
VarnodeData constresolve
How to resolve constant near pointers.
Definition: userop.hh:205
Information about the FLOAT_EQUAL op-code.
Definition: typeop.hh:545
@ f_interior_gotoin
Block is target of unstructured jump to its interior.
Definition: block.hh:85
virtual bool isOverride(void) const =0
Return true if this model was manually overridden.
int4 deadcodedelay
Delay before deadcode removal is allowed on this space.
Definition: space.hh:109
void setCurrentOp(PcodeOp *op)
Establish the current PcodeOp being emulated.
Definition: emulateutil.hh:79
int4 numIndicesByBlock(const FlowBlock *bl) const
Return the number of address table entries that target the given basic-block.
Definition: jumptable.cc:2264
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: space.cc:118
virtual void resetStats(void)
Reset all the counts to zero.
Definition: action.cc:106
type_metatype metatype
Meta-type - type disregarding size.
Definition: type.hh:82
bool restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore object from XML stream.
Definition: transform.cc:284
void destroyVarnode(Varnode *vn)
Delete the given Varnode from this function.
Definition: funcdata_varnode.cc:261
virtual void saveXmlHeader(ostream &s) const
Save basic information as XML attributes.
Definition: block.cc:2333
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1099
virtual void emitBlockCondition(const BlockCondition *bl)=0
Emit a conditional statement.
virtual int4 apply(Funcdata &data)=0
Make a single attempt to apply this Action.
TypeOpBoolAnd(TypeFactory *t)
Constructor.
Definition: typeop.cc:1342
bool hasDeadcodeDelay(AddrSpace *spc) const
Check if a delay override is already installed for an address space.
Definition: override.cc:82
const FlowBlock * bl
Associated Control-flow.
Definition: prettyprint.hh:334
@ reinterpreted_present
Indicate we have encountered reinterpreted data.
Definition: flow.hh:67
bool setSymbolProperties(SymbolEntry *entry)
Set properties from the given Symbol to this Varnode.
Definition: varnode.cc:367
static string typeToString(uint4 tp)
Convert a flow override type to a string.
Definition: override.cc:418
@ UNKNOWN_PROMOTION
The type of integer promotion cannot be determined.
Definition: cast.hh:48
void clearEdgeFlags(uint4 flags)
Clear a set of properties from all edges in the graph.
Definition: block.cc:892
int4 effective_extrapop
Working extrapop for the CALL.
Definition: fspec.hh:1441
subsorttype subsort
How this should be sub-sorted.
Definition: rangemap.hh:82
bool getMatches(uintb val, vector< string > &matchname) const
Recover the named representation.
Definition: type.cc:609
string archtype
The architecture string.
Definition: loadimage_xml.hh:30
@ binary
Evaluate as binary expression.
Definition: op.hh:85
static OpToken divequal
The in-place division operator.
Definition: printc.hh:101
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:84
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:402
virtual void restoreXml(const Element *el)
Restore this Symbol from an XML stream.
Definition: database.cc:696
const Address & getAddr(void) const
Get the address portion of a sequence number.
Definition: address.hh:126
subsorttype getSubsort(void) const
Get the sub-sort object.
Definition: database.cc:73
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:201
uint4 status
Current status.
Definition: action.hh:80
AddrSpace * spaceid
The address space we are treating as a structure.
Definition: type.hh:358
virtual void saveXml(ostream &s) const
Write out this as a <scope> XML tag.
Definition: database_ghidra.hh:109
TypeOpNew(TypeFactory *t)
Constructor.
Definition: typeop.cc:1810
Varnode * normalvn
Normalized switch Varnode.
Definition: jumptable.hh:350
bool operator!=(const Address &op2) const
Compare two addresses for inequality.
Definition: address.hh:335
virtual bool stackGrowsNegative(void) const
Return true if a stack in this space grows negative.
Definition: space.hh:470
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const
Given an address and data-type, build a suitable generic symbol name.
Definition: database_ghidra.hh:70
BlockMap(const BlockMap &op2)
Copy constructor.
Definition: block.cc:3184
bool unjustifiedInputParam(const Address &loc, int4 size, VarnodeData &res) const
Check if the given storage location looks like an unjustified input parameter.
Definition: fspec.hh:772
Definition: blockaction.hh:100
const FlowBlock * basicblock
The first basic-block to execute within the case block.
Definition: block.hh:635
void gatherInternal(void) const
Run through Varnodes looking for pointers into the stack.
Definition: varmap.cc:502
bool ruleBlockInfLoop(FlowBlock *bl)
Attempt to apply the BlockInfLoop structure.
Definition: blockaction.cc:1559
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:3165
uintb aliasBoundary
Shallowest alias.
Definition: varmap.hh:124
Definition: double.hh:291
void seenDeadcode(AddrSpace *spc)
Mark that dead Varnodes have been seen in a specific address space.
Definition: funcdata.hh:213
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1226
A class that solves for stack-pointer changes across unknown sub-functions.
Definition: coreaction.cc:30
virtual bool getNextSection(LoadImageSection &sec) const
Get info on the next section.
Definition: loadimage.hh:174
@ startbasic
This instruction starts a basic block.
Definition: op.hh:67
FlowBlock * block
The structured case block.
Definition: block.hh:634
map< uintb, string > namemap
Map from integer to name.
Definition: type.hh:280
CPUI_INT_MULT behavior.
Definition: opbehavior.hh:285
Datatype * restoreXmlTypeNoRef(const Element *el, bool forcecore)
Restore from an XML tag.
Definition: type.cc:2038
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:947
virtual void pushType(const Datatype *ct)=0
Push a data-type name onto the RPN expression stack.
Command to structure a control-flow graph.
Definition: ghidra_process.hh:170
virtual bool pcodeCallback(PcodeOpRaw *op)
Call back method for pcode based breakpoints.
Definition: emulate.hh:102
@ CPUI_STORE
Store at a pointer into a specified address space.
Definition: opcodes.hh:38
void nodeSplit(BlockBasic *b, int4 inedge)
Split control-flow into a basic block, duplicating its p-code into a new block.
Definition: funcdata_block.cc:906
TypeBase(int4 s, type_metatype m, const string &n)
Construct TypeBase from a size, meta-type, and name.
Definition: type.hh:167
This class holds a single entry in a stack used to forward traverse Varnode expressions.
Definition: coreaction.hh:439
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3969
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:702
JumpAssistOp * userop
The jumpassist p-code models.
Definition: jumptable.hh:474
virtual bool checkSplit(const Address &loc, int4 size, int4 splitpoint) const =0
Check if it makes sense to split a single storage location into two parameters.
vector< PcodeOpRaw * > opcache
The cache of current p-code ops.
Definition: emulate.hh:298
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:539
virtual void opCall(const PcodeOp *op)
Emit a CALL operator.
Definition: printc.cc:451
Simplify join and break apart: sub( concat(V,W), c) => sub(W,c)
Definition: ruleaction.hh:884
bool operator()(const Datatype *a, const Datatype *b) const
Comparison operator.
Definition: type.hh:134
bool isValueClose(uintb op2Value, int4 size) const
Is the given value similar to this equate.
Definition: database.cc:619
DatatypeNameSet nametree
Cross-reference by name.
Definition: type.hh:386
void opTypeCast(const PcodeOp *op)
Push the given p-code op using type-cast syntax to the RPN stack.
Definition: printc.cc:314
void destroyDead(void)
Destroy/retire all PcodeOps in the dead list.
Definition: op.cc:706
@ tmpbreak_start
Temporary break at start of action.
Definition: action.hh:73
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8174
A kind of MemoryBank which retrieves its data from an underlying LoadImage.
Definition: memstate.hh:93
void purgeHigh(HighVariable *high)
Remove cached intersection tests for a given HighVariable.
Definition: merge.cc:1456
Funcdata * queryFunction(const string &name) const
Look-up a function by name.
Definition: database.cc:1134
static bool isPathology(Varnode *vn, Funcdata &data)
Return true if concatenating with a SUBPIECE of the given Varnode is unusual.
Definition: ruleaction.cc:8676
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:544
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1303
PcodeOpTree::const_iterator end(const Address &addr) const
End of all PcodeOps at one Address.
Definition: op.cc:887
@ optoken
Emit atom as operator.
Definition: printlanguage.hh:159
string basegroup
Base group this action belongs to.
Definition: action.hh:86
virtual bool preferComplement(Funcdata &data)
Rearrange this hierarchy to simplify boolean expressions.
Definition: block.hh:716
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Definition: space.cc:476
Translate(void)
Constructor for the translator.
Definition: translate.cc:841
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:622
TypeStruct * getTypeStruct(const string &n)
Create an (empty) structure.
Definition: type.cc:1817
int4 align
Alignment of structures.
Definition: type.hh:382
virtual void saveXml(ostream &s) const
Write out this as a <scope> XML tag.
Definition: database.cc:2498
Utilities for processing data structures associated with a single function.
AddrSpace * fspecspace
Space for internal callspec pointers.
Definition: translate.hh:227
Object for describing how a space should be truncated.
Definition: translate.hh:63
void parseDataOrganization(const Element *el)
Parse the <data_organization> tag.
Definition: type.cc:2219
bool isNegativeStack
true if stack grows in negative direction
Definition: translate.hh:174
An edge between a Varnode and a PcodeOp.
Definition: dynamic.hh:30
virtual const uintm * getContext(const Address &addr) const
Get the context blob of values associated with a given address.
Definition: globalcontext.hh:292
MemoryPageOverlay(AddrSpace *spc, int4 ws, int4 ps, MemoryBank *ul)
Constructor for page overlay.
Definition: memstate.cc:531
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5070
void removeOp(PcodeOp *inst)
Remove PcodeOp from this basic block.
Definition: block.cc:2185
Architecture * glb
Architecture of this scope.
Definition: database.hh:424
Information about the LOAD op-code.
Definition: typeop.hh:215
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: op.cc:61
virtual void buildLoader(DocumentStorage &store)
Build the LoadImage object and load the executable image.
Definition: bfd_arch.cc:64
int4 popcount(uintb val)
Return the number of one bits in the given value.
Definition: address.cc:726
@ copy_in2
There exists at least 2 COPYs into this HighVariable from other HighVariables.
Definition: variable.hh:52
int4 posta_outslot
The out edge from iblock to posta.
Definition: condexe.hh:140
Collapse MULTIEQUAL whose inputs all trace to the same value.
Definition: ruleaction.hh:538
@ f_dead
Block is in process of being deleted.
Definition: block.hh:88
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6067
virtual bool emitsXml(void) const
Determine if this is an XML markup emitter.
Definition: prettyprint.hh:197
bool checkActionBreak(void)
Check if an action breakpoint is turned on.
Definition: action.cc:701
TypeOpCall(TypeFactory *t)
Constructor.
Definition: typeop.cc:537
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5211
virtual bool isNameUsed(const string &name) const
Check if the given name is used within this scope.
Definition: database_ghidra.hh:92
OpCode assumedInputExtension(const Address &addr, int4 size, VarnodeData &res) const
Get the type of extension and containing input parameter for the given storage.
Definition: fspec.hh:1384
vector< const Varnode * > markvn
List of Varnodes is the sub-graph being hashed.
Definition: dynamic.hh:66
OpCode opc
The particular p-code operation.
Definition: userop.hh:170
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6288
void processExitConflict(list< BadEdgeScore >::iterator start, list< BadEdgeScore >::iterator end)
Process a set of conflicting BlockTrace objects that go to the same exit point.
Definition: blockaction.cc:687
void createTraces(void)
Given the BlockTrace objects, given a new BranchPoint.
Definition: blockaction.cc:492
PcodeOp * opStackStore(AddrSpace *spc, uintb off, PcodeOp *op, bool insertafter)
Create a STORE expression at an offset relative to a spacebase register for a given address space.
Definition: funcdata_op.cc:478
int4 a_in2
In edge of exita coming from block2.
Definition: blockaction.hh:246
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:957
void deleteCallSpec(FuncCallSpecs *fc)
Remove the given call site from the list for this function.
Definition: flow.cc:1269
int4 isaggressive
Is it guaranteed the root is a sub-variable needing to be trimmed.
Definition: ruleaction.hh:1315
VarnodeBank vbank
Container of Varnode objects for this function.
Definition: funcdata.hh:76
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3714
virtual void clear(void)=0
Release any (local) resources.
virtual void clearInput(int4 i)
Clear the input parameter at the specified slot.
Definition: fspec.cc:2630
virtual uintm * getDefaultValue(void)
Retrieve the memory region holding all default context values.
Definition: ghidra_context.hh:44
void setSymbol(Varnode *vn) const
Update Symbol information for this from the given member Varnode.
Definition: variable.cc:39
uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on an input value.
Definition: typeop.hh:78
ParamActive * activeoutput
Data for assessing which parameters are passed to this function.
Definition: funcdata.hh:82
PcodeEmitFd emitter
PCodeOp factory (configured to allocate into data and obank)
Definition: flow.hh:84
Try to merge Varnodes specified by Symbols with multiple SymbolEntrys.
Definition: coreaction.hh:384
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:64
Use the Ghidra client as a load image.
PrintC(Architecture *g, const string &nm="c-language")
Constructor.
Definition: printc.cc:94
virtual bool emitsXml(void) const
Determine if this is an XML markup emitter.
Definition: prettyprint.hh:770
void paramShift(int4 paramshift)
Add parameters to the front of the input parameter list.
Definition: fspec.cc:2847
int4 instruction_length
Definition: translate.hh:36
@ return_address
Is the varnode storage for a return address.
Definition: varnode.hh:101
Collapse unnecessary INT_AND.
Definition: ruleaction.hh:121
virtual bool isIndirectStorage(void) const
Is this really a pointer to the true parameter.
Definition: fspec.cc:2352
VolatileReadOp * vol_read
(Single) volatile read operation
Definition: userop.hh:254
CPUI_INT_SUB behavior.
Definition: opbehavior.hh:197
Check for constants, with pointer type, that correspond to global symbols.
Definition: coreaction.hh:181
int4 unsignedCompare128(uint8 *a, uint8 *b)
Compare two unsigned 128-bit values.
Definition: address.cc:852
A strategy for applying type casts.
Definition: cast.hh:40
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:469
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7084
virtual void opCopy(const PcodeOp *op)=0
Emit a COPY operator.
@ copy_patch
Turn op into a COPY of the logical value.
Definition: subflow.hh:67
virtual TrackedSet & getTrackedDefault(void)
Get the set of default values for all tracked registers.
Definition: globalcontext.hh:295
void forceFalseEdge(const FlowBlock *out0)
Force the false out edge to go to the given FlowBlock.
Definition: block.cc:1130
virtual void opCpoolRefOp(const PcodeOp *op)
Emit a CPOOLREF operator.
Definition: printc.cc:863
InjectContextGhidra contextCache
A context object that wraps data in XML for the Ghidra client.
Definition: inject_ghidra.hh:81
virtual bool isFileMatch(const string &filename) const
Determine if this extension can handle this file.
Definition: bfd_arch.cc:41
vector< NodePending > nodepend
Data-flow nodes waiting to be pushed onto the RPN stack.
Definition: printlanguage.hh:236
bool traceBackward(TransformVar *rvn)
Try to trace the pair of logical values, backward, through the defining op.
Definition: subflow.cc:1602
uintb coveringmask(uintb val)
Return a mask that covers the given value.
Definition: address.cc:770
int4 calcsize
Id of p-code script that calculates number of indices (== -1 if no script)
Definition: userop.hh:233
Symbol(Scope *sc)
Construct for use with restoreXml()
Definition: database.hh:191
Varnode * findCoveringInput(int4 s, const Address &loc) const
Find the input Varnode that contains the given range.
Definition: funcdata.hh:278
bool ruleBlockProperIf(FlowBlock *bl)
Attempt to apply a 2 component form of BlockIf.
Definition: blockaction.cc:1358
@ force_hex
Force printing of hex.
Definition: printlanguage.hh:138
FlowBlock * gototarget
The target block of the unstructured branch.
Definition: block.hh:443
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:284
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3721
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:527
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: op.cc:35
static void writeStringStream(ostream &s, const string &msg)
Send a string to the client.
Definition: ghidra_arch.cc:167
void collectReachable(vector< FlowBlock * > &res, FlowBlock *bl, bool un) const
Collect reachable/unreachable FlowBlocks from a given start FlowBlock.
Definition: block.cc:2047
string name
Name of subfield.
Definition: type.hh:126
Deal with situations that look like double precision parameters.
Definition: coreaction.hh:694
@ CPUI_LOAD
Load from a pointer into a specified address space.
Definition: opcodes.hh:37
static bool ispoint(Varnode *vn)
Is it possible for the given Varnode to be a switch variable?
Definition: jumptable.cc:428
ParamTrial splitLo(int4 sz) const
Create a trial representing the last part of this.
Definition: fspec.cc:1318
Varnode * setInputVarnode(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: funcdata_varnode.cc:327
Pull-back SUBPIECE through INT_RIGHT and INT_SRIGHT.
Definition: ruleaction.hh:1106
VarnodeLocSet::const_iterator beginLoc(AddrSpace *spaceid) const
Start of Varnodes stored in a given address space.
Definition: funcdata.hh:304
@ killedbycall
Data in this location is unlikely to flow thru a func and still be a param.
Definition: fspec.hh:165
@ CPUI_INT_SEXT
Sign extension.
Definition: opcodes.hh:59
@ dotdotdot
Set if this prototype takes variable arguments (varargs)
Definition: fspec.hh:1149
virtual void setMaxLineSize(int4 val)
Provide a maximum line size to the pretty printer.
Definition: prettyprint.cc:1205
uint4 traversals
What kind of operations has this pointer accumulated.
Definition: heritage.hh:186
virtual int4 intPromotionType(const Varnode *vn) const =0
Calculate the integer promotion code of a given Varnode.
virtual bool doWidening(const ValueSet &valueSet, CircleRange &range, const CircleRange &newRange)
For an iteration that isn't stabilizing attempt to widen the given ValueSet.
Definition: rangeutil.cc:1882
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:613
void opSetOpcode(PcodeOp *op, OpCode opc)
Set the op-code for a specific PcodeOp.
Definition: funcdata_op.cc:23
virtual bool empty(void) const
Is the container empty of records.
Definition: cpool.hh:194
map< string, int4 > scriptMap
Map of registered script names to ExecutablePcode id.
Definition: pcodeinject.hh:170
void clearInputs(void)
Remove all input varnodes to this op.
Definition: pcoderaw.hh:199
void handleOutOfBounds(const Address &fromaddr, const Address &toaddr)
Generate warning message or throw exception for given flow that is out of bounds.
Definition: flow.cc:505
@ volatil
This varnode's value is volatile.
Definition: varnode.hh:85
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5932
bool discoverConditionalZero(Varnode *vn)
Verify that CBRANCH boolean expression is either (vn == 0) or (vn != 0)
Definition: condexe.cc:968
void restoreXml(const Element *el, const AddrSpaceManager *m)
Restore this BlockGraph from an XML stream.
Definition: block.cc:1329
void resolveModel(ParamActive *active)
If this has a merged model, pick the most likely model (from the merged set)
Definition: fspec.cc:2909
void findAddressForces(vector< PcodeOp * > ©Sinks, vector< PcodeOp * > &forces)
Find the last PcodeOps that write to specific addresses that flow to specific sites.
Definition: heritage.cc:466
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4122
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:1153
static void gatherFirstLevelVars(vector< Varnode * > &varlist, const Funcdata *fd, const Address &addr, uint8 h)
Get the Varnodes immediately attached to PcodeOps at the given address.
Definition: dynamic.cc:426
TraceDAG(list< FloatingEdge > &lg)
Clear the visitcount field of any FlowBlock we have modified.
Definition: blockaction.cc:944
void buildTrialMap(ParamActive *active) const
Build map from parameter trials to model ParamEntrys.
Definition: fspec.cc:586
int4 current_op
Index of current pcode op within machine instruction.
Definition: emulate.hh:304
void restoreXmlBasic(const Element *el)
Recover basic data-type properties.
Definition: type.cc:273
static bool writeBack(Funcdata &data)
Commit the final propagated data-types to Varnodes.
Definition: coreaction.cc:4077
uint4 hasEffect(const Address &addr, int4 size) const
Calculate the effect this has an a given storage location.
Definition: fspec.cc:3349
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: op.hh:35
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:451
virtual void modifySpaces(Translate *trans)
Modify address spaces as required by this Architecture.
Definition: ghidra_arch.hh:80
Funcdata * fd
The Funcdata object for the called functon (if known)
Definition: fspec.hh:1440
bool disableRule(const string &specify)
Disable a specific Rule within this.
Definition: action.cc:218
TypeOpPopcount(TypeFactory *t)
Constructor.
Definition: typeop.cc:1864
All the individual p-code operations.
virtual void dump(const Address &addr, OpCode opc, VarnodeData *outvar, VarnodeData *vars, int4 isize)=0
The main pcode emit method.
Scope * parent
The parent scope.
Definition: database.hh:417
BlockBasic * exitb
Second (common) exit point.
Definition: blockaction.hh:244
@ pop_fail
Backtracking, from path with a bad ancestor.
Definition: funcdata.hh:601
@ docu_e
End of a document.
Definition: prettyprint.hh:296
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:104
virtual void saveXml(ostream &s) const
Serialize this architecture to XML.
Definition: raw_arch.cc:84
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:297
void parseEnumConfig(const Element *el)
Parse the <enum> tag.
Definition: type.cc:2253
RangeType
The basic categorization of the range.
Definition: varmap.hh:74
void opBinary(const OpToken *tok, const PcodeOp *op)
Push a binary operator onto the RPN stack.
Definition: printlanguage.cc:666
void clearOutEdgeFlag(int4 i, uint4 lab)
Remove an out edge label.
Definition: block.cc:238
Class for doing normal widening.
Definition: rangeutil.hh:234
virtual TrackedSet & createSet(const Address &addr1, const Address &addr2)=0
Create a tracked register set that is valid over the given range.
static int4 castOutput(PcodeOp *op, Funcdata &data, CastStrategy *castStrategy)
Insert cast to output Varnode type after given PcodeOp if it is necessary.
Definition: coreaction.cc:2162
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:649
int4 chain
Who we immediately chain to, expressed as caseblocks index, -1 for no chaining.
Definition: block.hh:638
void expand(void)
Expand the stream buffer.
Definition: prettyprint.cc:562
bool restriction(int4 numLanes, int4 skipLanes, int4 bytePos, int4 size, int4 &resNumLanes, int4 &resSkipLanes) const
Decide if a given truncation is natural for this description.
Definition: transform.cc:129
circularqueue(int4 sz)
Construct queue of a given size.
Definition: prettyprint.hh:630
EmulatePcodeOp(Architecture *g)
Constructor.
Definition: emulateutil.cc:20
virtual void saveXml(ostream &s) const
Save this Symbol to an XML stream.
Definition: database.cc:571
virtual void endFuncProto(int4 id)
End a function prototype declaration.
Definition: prettyprint.cc:146
virtual void resolveArchitecture(void)
Figure out the processor and compiler of the target executable.
Definition: sleigh_arch.cc:171
CommentDatabase * commentdb
Comments for this architecture.
Definition: architecture.hh:147
void restoreXml(const Element *el)
Restore the record from an XML stream.
Definition: sleigh_arch.cc:27
virtual void saveXml(ostream &s) const =0
Save this context to an XML stream as a <context> tag.
uint4 head_comment_type
Type of header comments to display.
Definition: printlanguage.hh:247
FunctionSymbol * addFunction(const Address &addr, const string &nm)
Create a function Symbol at the given address in this Scope.
Definition: database.cc:1555
int4 deadremoved
>0 if Varnodes in this space have been eliminated
Definition: heritage.hh:90
BlockTrace(BranchPoint *t, int4 po, int4 eo)
Construct given a parent BranchPoint and path index.
Definition: blockaction.cc:579
TypeOpIntRem(TypeFactory *t)
Constructor.
Definition: typeop.cc:1288
virtual void registerVariable(const string &nm, int4 sbit, int4 ebit)
Register a new named context variable (as a bit range) with the database.
Definition: globalcontext.cc:380
bool checkOutputJoin(const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const
Check if the given two output storage locations can represent a single logical return value.
Definition: fspec.hh:686
virtual int4 manualCallOtherFixup(const string &name, const string &outname, const vector< string > &inname, const string &snippet)=0
Manually add a callother-fixup payload given a compilable snippet of p-code source.
A helper class for caching the active context blob to minimize database lookups.
Definition: globalcontext.hh:309
Scope * resolveScopeSymbolName(const string &fullname, const string &delim, string &basename, Scope *start) const
Get the Scope (and base name) associated with a qualified Symbol name.
Definition: database.cc:2929
void predefineDirectMulti(PcodeOp *op)
Prebuild a replacement MULTIEQUAL for output Varnode of the given PcodeOp in posta_block.
Definition: condexe.cc:501
int4 activecount
Number of active BlockTrace objects.
Definition: blockaction.hh:157
Determine active parameters to sub-functions.
Definition: coreaction.hh:712
@ CPUI_MULTIEQUAL
Phi-node operator.
Definition: opcodes.hh:112
void clearCover(void) const
Turn off any coverage information.
Definition: varnode.cc:217
Funcdata * fd
The Funcdata container to emit to.
Definition: funcdata.hh:554
virtual void getUserOpNames(vector< string > &res) const
Get a list of all user-defined pcode ops.
Definition: sleighbase.cc:135
TypeCode * getTypeCode(const string &n)
Create a default "code" type.
Definition: type.cc:1740
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: fspec.cc:1564
uint4 flags
Boolean properties of the type.
Definition: type.hh:83
virtual void closeGroup(int4 id)
End a group of things that are printed together.
Definition: prettyprint.hh:137
virtual uintb getVarnodeValue(Varnode *vn) const
Given a specific Varnode, retrieve the current value for it from the machine state.
Definition: jumptable.cc:143
void opFlipInPlaceExecute(Funcdata &data, vector< PcodeOp * > &fliplist)
Perform op-code flips (in-place) to change a boolean value.
Definition: funcdata_op.cc:1083
Simplify various conditional move situations.
Definition: ruleaction.hh:1349
Specifies subfields of a structure or what a pointer points to.
Definition: type.hh:124
@ IPTR_PROCESSOR
Normal spaces modelled by processor.
Definition: space.hh:30
TypeOpIntOr(TypeFactory *t)
Constructor.
Definition: typeop.cc:1105
virtual void getUserOpNames(vector< string > &res) const =0
Get a list of all user-defined pcode ops.
virtual void opFloatTrunc(const PcodeOp *op)
Emit a FLOAT_TRUNC operator.
Definition: printc.hh:278
int4 characterizeAsInputParam(const Address &loc, int4 size) const
Characterize whether the given range overlaps parameter storage.
Definition: fspec.hh:717
bool possibleInputParamWithSlot(const Address &loc, int4 size, int4 &slot, int4 &slotsize) const
Pass-back the slot and slot size for the given storage location as an input parameter.
Definition: fspec.hh:748
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:697
virtual void emitBlockGraph(const BlockGraph *bl)=0
Emit (an unspecified) list of blocks.
void cacheAddrSpaceProperties(void)
Calculate some frequently used space properties and cache them.
Definition: architecture.cc:651
virtual void buildLoader(DocumentStorage &store)
Build the LoadImage object and load the executable image.
Definition: raw_arch.cc:51
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:801
@ f_joined_block
Block is a merged form of original basic blocks.
Definition: block.hh:91
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2807
const Translate * translate
Translation method for this binary.
Definition: architecture.hh:143
void dependentOrder(vector< Datatype * > &deporder) const
Place all data-types in dependency order.
Definition: type.cc:1611
void widen(const CircleRange &op2, bool leftIsStable)
Widen the unstable bound to match containing range.
Definition: rangeutil.cc:1381
uint4 size
Number of addresses in the table as reported by the JumpTable.
Definition: jumptable.hh:323
static vector< LanguageDescription > description
List of languages we know about.
Definition: sleigh_arch.hh:92
void intersectEffects(const vector< EffectRecord > &efflist)
Fold EffectRecords into this model.
Definition: fspec.cc:2123
bool deadRemovalAllowed(AddrSpace *spc) const
Check if dead code removal is allowed for a specific address space.
Definition: funcdata.hh:225
Datatype * typecache16
Specially cached 16-byte float type.
Definition: type.hh:389
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4506
bool iterate(Widener &widener)
Regenerate this value set from operator inputs.
Definition: rangeutil.cc:1597
static OpToken not_equal
The not equal operator.
Definition: printc.hh:90
static const Scope * stackClosestFit(const Scope *scope1, const Scope *scope2, const Address &addr, int4 size, const Address &usepoint, SymbolEntry **addrmatch)
Definition: database.cc:909
virtual void opIndirect(const PcodeOp *op)
Emit a INDIRECT operator.
Definition: printc.hh:283
CPUI_INT_LEFT behavior.
Definition: opbehavior.hh:261
@ is_destructor
Op is call to a destructor.
Definition: op.hh:105
TypePointer * getTypePointerAbsolute(int4 s, Datatype *pt, uint4 ws)
Construct an absolute pointer data-type.
Definition: type.cc:1774
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:548
virtual void docSingleGlobal(const Symbol *sym)=0
Emit the declaration for a single (global) Symbol.
Convert sign-bit test to signed comparison: (V s>> 0x1f) != 0 => V s< 0
Definition: ruleaction.hh:578
bool hasTruncations
true if this architecture needs truncated pointers
Definition: ruleaction.hh:1266
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2697
ArchitectureGhidra * glb
The Ghidra Architecture and connection to the client.
Definition: ghidra_translate.hh:35
void clear(void)
Called for each additional hash (after the first)
Definition: dynamic.cc:190
virtual bool isSizeTypeLocked(void) const =0
Is the size of the parameter locked.
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1708
void renormalizeJoinAddress(Address &addr, int4 size)
Make sure a possibly offset join address has a proper JoinRecord.
Definition: translate.cc:803
Datatype * type
Putative data-type for a single element of this range.
Definition: varmap.hh:83
Funcdata * fd
The underlying meta-data object for the function.
Definition: database.hh:252
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1217
TypeFactory * types
List of types for this binary.
Definition: architecture.hh:142
Varnode * getSpacebaseRelative(void) const
Get the active stack-pointer Varnode at this call site.
Definition: fspec.cc:4049
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.hh:139
Address & operator=(const Address &op2)
Copy an address.
Definition: address.hh:315
virtual Address getExecuteAddress(void) const
Get the address of the current instruction being executed.
Definition: emulateutil.hh:80
bool propagateIndirect
Propagate thru CPUI_INDIRECT ops.
Definition: coreaction.hh:238
ReplaceVarnode * in2
(optional second parameter)
Definition: subflow.hh:76
bool readonlypropagate
true if readonly values should be treated as constants
Definition: architecture.hh:128
EffectRecord(const Address &addr, int4 size)
Construct a memory range with an unknown effect.
Definition: fspec.cc:1625
virtual bool negateCondition(bool toporbottom)
Flip the condition computed by this.
Definition: block.cc:282
virtual void allowContextSet(bool val) const
Toggle whether disassembly is allowed to affect context.
Definition: sleigh.cc:684
static AddrSpace * vnSpacebase(Architecture *glb, Varnode *vn, uintb &val, AddrSpace *spc)
Check if given Varnode is spacebase + a constant.
Definition: ruleaction.cc:3855
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:827
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4056
bool dotdotdot
True if prototype takes variable arguments.
Definition: fspec.hh:1133
bool constantMatch(uintb val) const
Return true if this is a constant with value val.
Definition: varnode.hh:264
Varnode * create(int4 s, const Address &m, Datatype *ct)
Create a free Varnode object.
Definition: varnode.cc:874
TypeOpCbranch(TypeFactory *t)
Constructor.
Definition: typeop.cc:491
int4 numLikelyTrash(void) const
Get the number of likely-trash locations.
Definition: fspec.cc:3375
Extension point for building an Architecture that reads in raw images.
Definition: raw_arch.hh:22
bool operator==(const EffectRecord &op2) const
Equality operator.
Definition: fspec.hh:1554
void buildInputFromTrials(Funcdata &data)
Set the final input Varnodes to this CALL based on ParamActive analysis.
Definition: fspec.cc:4713
void clearCopySpecific(void)
Clear varnodes and ops that are specific to one instance of a function.
Definition: jumptable.cc:1815
int4 getWordSize(void) const
Get the number of bytes in a word for this memory bank.
Definition: memstate.hh:65
virtual void clearUnlocked(void)
Clear all unlocked symbols from this scope.
Definition: database_ghidra.hh:102
@ string_literal
Constant reference to string (passed back as byteData)
Definition: cpool.hh:49
Address getFirstUseAddress(void) const
Get the first code address where this storage is valid.
Definition: database.cc:98
virtual uintm * getDefaultValue(void)=0
Retrieve the memory region holding all default context values.
void printVarnodeTree(ostream &s) const
Print a description of all Varnodes to a stream.
Definition: funcdata.cc:524
int4 startComment(void)
Create a "start a comment block" command.
Definition: prettyprint.hh:561
@ offset_unknown
"Magic" stack offset indicating the offset is unknown
Definition: fspec.hh:1463
Eliminate INT_ZEXT in comparisons: zext(V) == c => V == c
Definition: ruleaction.hh:458
void markModel(bool val)
Mark (or unmark) all PcodeOps involved in the model.
Definition: jumptable.cc:1216
void opMarkHalt(PcodeOp *op, uint4 flag)
Mark given CPUI_RETURN op as a special halt.
Definition: funcdata_op.cc:35
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:231
MemoryBank(AddrSpace *spc, int4 ws, int4 ps)
Generic constructor for a memory bank.
Definition: memstate.cc:73
tag_type
The exhaustive list of possible token types.
Definition: prettyprint.hh:294
bool hasThis
True if this model has a this parameter (auto-parameter)
Definition: fspec.hh:629
static bool isInArray(vector< PcodeOp * > &array, PcodeOp *op)
Test if the given p-code op is a member of an array.
Definition: flow.cc:740
virtual void opBoolXor(const PcodeOp *op)
Emit a BOOL_XOR operator.
Definition: printc.hh:261
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5926
bool addToGroup(const string &grp, const string &basegroup)
Add a group to a root Action.
Definition: action.cc:1048
uint4 opedgeproc
Number of edges processed in the opedge list.
Definition: dynamic.hh:63
void setProperties(bool hasThisPtr, bool isConstructor, bool isDestructor)
Set additional function properties.
Definition: type.cc:974
virtual void endFuncProto(int4 id)
End a function prototype declaration.
Definition: prettyprint.hh:238
list< PcodeOp * > deadlist
List of dead PcodeOps.
Definition: op.hh:247
virtual bool isSizeTypeLocked(void) const
Is the size of the parameter locked.
Definition: fspec.hh:978
bool contains(const string &nm) const
Check if this ActionGroupList contains a given group.
Definition: action.hh:37
void heritage(void)
Perform one pass of heritage.
Definition: heritage.cc:2231
int4 pending
Number of data-flow nodes waiting to be pushed.
Definition: printlanguage.hh:237
A Symbol that holds equate information for a constant.
Definition: database.hh:270
@ annotation
This varnode is an annotation and has no dataflow.
Definition: varnode.hh:73
const string & getName(void) const
Get the name.
Definition: space.hh:262
BlockBasic * postb_block
First block in postb path.
Definition: condexe.hh:142
void printRaw(const string &funcname, ostream &s) const
Print this prototype as a single line of text.
Definition: fspec.cc:3611
bool setupCallSpecs(PcodeOp *op, FuncCallSpecs *fc)
Set up the FuncCallSpecs object for a new call site.
Definition: flow.cc:666
map< Address, vector< uint1 > > chunk
Chunks of image data, mapped by address.
Definition: loadimage_xml.hh:33
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7296
@ force_dec
Force printing of dec.
Definition: printlanguage.hh:139
virtual void opCast(const PcodeOp *op)=0
Emit a CAST operator.
list< LoopBody > loopbody
The list of loop bodies for this control-flow graph.
Definition: blockaction.hh:195
virtual uintb execute(const vector< uintb > &input) const
Compute the output value of this operation, given constant inputs.
Definition: userop.cc:156
virtual void initialize(void)=0
Complete initialization of an extension point.
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1817
void copySymbol(const Varnode *vn)
Copy symbol info from vn.
Definition: varnode.cc:438
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7392
virtual void printTemplate(ostream &s) const
Print the p-code ops of the injection to a stream (for debugging)
Definition: inject_ghidra.cc:143
Emulate a snippet of PcodeOps out of a functional context.
Definition: emulateutil.hh:111
void removeActive(BlockTrace *trace)
Remove a BlockTrace from the active category.
Definition: blockaction.cc:791
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.cc:244
TypeArray(void)
Internal constructor for restoreXml.
Definition: type.hh:252
virtual void dump(const Address &addr, OpCode opc, VarnodeData *outvar, VarnodeData *vars, int4 isize)
The main pcode emit method.
Definition: funcdata.cc:834
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:262
An Address range associated with the symbol Scope that owns it.
Definition: database.hh:795
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4460
void merge(const RangeList &op2)
Merge another RangeList into this.
Definition: address.cc:385
A description of the topological scope of a single variable object.
Definition: cover.hh:68
virtual void buildSpecFile(DocumentStorage &store)
Load any relevant specification files.
Definition: sleigh_arch.cc:202
static void findAllIntoCopies(HighVariable *high, vector< PcodeOp * > ©Ins, bool filterTemps)
Find all the COPY ops into the given HighVariable.
Definition: merge.cc:1185
virtual void openSectionInfo(void) const
Prepare to read section info.
Definition: loadimage.hh:159
void setMax(int4 sz)
Establish a new maximum queue size.
Definition: prettyprint.hh:649
@ utf32
32-bit wide chars in unicode UTF32
Definition: type.hh:76
void deriveBoundaries(const FuncProto &proto)
Set up basic boundaries for the stack layout.
Definition: varmap.cc:475
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1677
vector< MemoryBank * > memspace
Memory banks associated with each address space.
Definition: memstate.hh:151
bool queryMultistageJumptable(const Address &addr) const
Check for a multistage marker for a specific indirect jump.
Definition: override.cc:181
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:504
uint4 size
Size truncated addresses into the space.
Definition: translate.hh:65
uintb getLoadImageValue(AddrSpace *spc, uintb offset, int4 sz) const
Pull a value from the load-image given a specific address.
Definition: emulateutil.cc:148
void opInsertBefore(PcodeOp *op, PcodeOp *follow)
Insert given PcodeOp before a specific op.
Definition: funcdata_op.cc:318
bool operator==(const Address &op2) const
Compare two addresses for equality.
Definition: address.hh:327
int4 getSlot(const Varnode *vn) const
Get the slot number of the indicated input varnode.
Definition: op.hh:157
BlockCopy * newBlockCopy(FlowBlock *bl)
Build a new BlockCopy.
Definition: block.cc:1581
void erase(const_iterator iter)
Erase a record given an iterator.
Definition: rangemap.hh:167
@ IPTR_IOP
Special internal PcodeOp reference.
Definition: space.hh:34
@ f_goto_edge
Edge is unstructured.
Definition: block.hh:96
@ unary
Evaluate as unary expression.
Definition: op.hh:84
bool isAddrTied(void) const
Are all Varnodes at this storage location components of the same high-level variable?
Definition: varnode.hh:230
void insertAfterDead(PcodeOp *op, PcodeOp *prev)
Insert the given PcodeOp after a point in the dead list.
Definition: op.cc:774
const ParamEntry * findEntry(const Address &loc, int4 size) const
Given storage location find matching ParamEntry.
Definition: fspec.cc:448
void setDefaultModel(const string &nm)
Set the default PrototypeModel.
Definition: architecture.cc:261
LoadImageXml(const string &f, const Element *el)
Constructor.
Definition: loadimage_xml.cc:21
int4 symboloffset
-1=perfect symbol match >=0, offset
Definition: variable.hh:67
void structureReset(void)
Calculate initial basic block structures (after a control-flow change)
Definition: funcdata_block.cc:621
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
Transform based on Varnode properties, such as read-only and volatile.
Definition: coreaction.hh:215
void executeInstruction(void)
Execute (the rest of) a single machine instruction.
Definition: emulate.cc:446
List::const_iterator restoreXml(List::const_iterator iter, const AddrSpaceManager *manage)
Restore this from an XML stream.
Definition: database.cc:195
static OpToken shift_left
The left shift operator.
Definition: printc.hh:83
AddrSpace * spc
The physical address space into which a segmented pointer points.
Definition: userop.hh:200
virtual void pushUnnamedLocation(const Address &addr, const Varnode *vn, const PcodeOp *op)=0
Push an address as a substitute for a Symbol onto the RPN stack.
void mergeMultiEntry(void)
Merge together Varnodes mapped to SymbolEntrys from the same Symbol.
Definition: merge.cc:819
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:381
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1837
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:212
Set the maximum number of characters per decompiled line.
Definition: options.hh:153
@ f_donothing_loop
Block does nothing in infinite loop (halt)
Definition: block.hh:87
Simplify boolean expressions that are combined through POPCOUNT.
Definition: ruleaction.hh:1423
virtual void saveXmlHeader(ostream &s) const
Save basic information as XML attributes.
Definition: block.cc:2614
TypeOpFloatNan(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1384
Information about the INT_SBORROW op-code.
Definition: typeop.hh:399
virtual SymbolEntry * findAddr(const Address &addr, const Address &usepoint) const
Find a Symbol at a given address and usepoint.
Definition: database.cc:2087
AddrSpace * space
The address space associated with this memory.
Definition: memstate.hh:41
uint4 insn_max
Maximum number of instructions.
Definition: flow.hh:93
CPUI_SUBPIECE behavior.
Definition: opbehavior.hh:499
virtual uintb getValue(void) const =0
Get the current value.
@ CPUI_INT_LESS
Integer comparison, unsigned less-than (<)
Definition: opcodes.hh:55
void saveXml(ostream &s) const
Write this RangeList to an XML stream.
Definition: address.cc:538
void printBounds(ostream &s) const
Print a description of this RangeList to stream.
Definition: address.cc:522
void setRange(uintb lft, uintb rgt, int4 size, int4 step)
Set directly to a specific range.
Definition: rangeutil.cc:217
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:715
Architecture * glb
The Architecture owning this snippet.
Definition: pcodeinject.hh:135
void doInjection(InjectPayload *payload, InjectContext &icontext, PcodeOp *op, FuncCallSpecs *fc)
Inject the given payload into this flow.
Definition: flow.cc:1158
Try to merge Varnodes of the same type (if they don't hold different values at the same time)
Definition: coreaction.hh:395
virtual bool doPcodeOpBreak(PcodeOpRaw *curop)=0
Invoke any breakpoints associated with this particular pcodeop.
set< Symbol *, SymbolCompareName > SymbolNameTree
A set of Symbol objects sorted by name.
Definition: database.hh:324
A jump-table execution model.
Definition: jumptable.hh:232
set< Datatype *, DatatypeNameCompare > DatatypeNameSet
A set of data-types sorted by name.
Definition: type.hh:153
Architecture and associated classes that help manage a single processor architecture and load image.
virtual string getRegisterName(AddrSpace *base, uintb off, int4 size) const
Get the name of a register given its location.
Definition: ghidra_translate.cc:71
Address getAddress(uintb off, int4 sz, const Address &point) const
Construct an Address given an offset.
Definition: type.cc:1171
ProtoStoreSymbol(Scope *sc, const Address &usepoint)
Constructor.
Definition: fspec.cc:2419
ExternRefSymbol * addExternalRef(const Address &addr, const Address &refaddr, const string &nm)
Definition: database.cc:1582
void setGotoBranch(int4 i)
Mark a goto branch.
Definition: block.cc:293
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:441
virtual bool isFileMatch(const string &filename) const =0
Determine if this extension can handle this file.
virtual void stopIndent(int4 id)
End an indent level.
Definition: prettyprint.cc:1163
Override localoverride
Overrides of data-flow, prototypes, etc. that are local to this function.
Definition: funcdata.hh:83
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
void addRange(Scope *scope, AddrSpace *spc, uintb first, uintb last)
Add an address range to the ownership of a Scope.
Definition: database.cc:2873
vector< Datatype * > intypes
Input data-types.
Definition: fspec.hh:1131
int4 highind
Minimum upper bound on the array index (if this is open)
Definition: varmap.hh:86
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:221
vector< uintb > values
Normalized switch variable values associated with addresses.
Definition: jumptable.hh:427
int4 pointermax
If non-zero, maximum size of a data-type before converting to a pointer.
Definition: fspec.hh:495
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:336
int4 alignshift
How many LSBs are thrown away from address when doing hash table lookup.
Definition: memstate.hh:130
bool processNextWork(void)
Process the next logical value on the worklist.
Definition: subflow.cc:1675
static uintb addressToByte(uintb val, uint4 ws)
Scale from addressable units to byte units.
Definition: space.hh:487
virtual void emitBlockGraph(const BlockGraph *bl)
Emit (an unspecified) list of blocks.
Definition: printc.cc:2359
void restoreXml(const Element *el)
Restore this container from a stream.
Definition: type.cc:2174
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1486
An implementation of a ContextDatabase obtaining context information via a Ghidra client.
Definition: ghidra_context.hh:31
void registerCallMechanism(const string &fixupName, int4 injectid)
Map a call mechanism name to a payload id.
Definition: pcodeinject.cc:219
void assignDefaultNames(int4 &base)
Assign a default name (via buildVariableName) to any unnamed symbol.
Definition: database.cc:2706
AliasChecker checker
A collection of pointer Varnodes into our address space.
Definition: varmap.hh:151
SeqNum(const SeqNum &op2)
Copy a sequence number.
Definition: address.hh:123
virtual void opSubpiece(const PcodeOp *op)=0
Emit a SUBPIECE operator.
BlockSwitch * newBlockSwitch(const vector< FlowBlock * > &cs, bool hasExit)
Build a new BlockSwitch.
Definition: block.cc:1797
int4 alignment
How much alignment (0 means only 1 logical value is allowed)
Definition: fspec.hh:70
bool propagateFlowToDef(Varnode *vn)
Propagate ptrflow property to given Varnode and the defining PcodeOp.
Definition: ruleaction.cc:7437
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2998
virtual void endStatement(int4 id)
End a source code statement.
Definition: prettyprint.cc:133
uint4 flags
Additional boolean properties of this range.
Definition: varmap.hh:84
PcodeOp * cbranch
CBRANCH in iblock.
Definition: condexe.hh:133
PartIterator const_iterator
The main sub-range iterator data-type.
Definition: rangemap.hh:125
void clearUnlockedInput(void)
Clear input parameters that have not been locked.
Definition: fspec.cc:3140
virtual CPoolRecord * createRecord(const vector< uintb > &refs)
Allocate a new CPoolRecord object, given a reference to it.
Definition: cpool.cc:198
uint4 gototype
(If non-zero) What type of unstructured case is this?
Definition: block.hh:640
uint8 restoreXml(const Element *el)
Restore the state of this function from an XML description.
Definition: funcdata.cc:719
virtual void restoreXml(const Element *el)
Restore this Symbol from an XML stream.
Definition: database.cc:499
Address getEntryAddr(void) const
Get the address of the (original) first operation to execute.
Definition: block.cc:2195
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:493
void swapEdges(void)
Swap the first and second out edges.
Definition: block.cc:206
virtual uintb getSize(void) const
Return the number of values the variables can take.
Definition: jumptable.cc:268
virtual int4 getMaxDelay(void) const =0
Return the maximum heritage delay across all possible parameters.
void nodeSplitCloneVarnode(PcodeOp *op, PcodeOp *newop)
Duplicate output Varnode of the given p-code op, as part of splitting a block.
Definition: funcdata_block.cc:785
list< PcodeOp * >::const_iterator iter
The iterator position for a normal ValueSet node.
Definition: rangeutil.hh:283
void changeOpcode(PcodeOp *op, TypeOp *newopc)
Change the op-code for the given PcodeOp.
Definition: op.cc:740
virtual bool isSubpieceCastEndian(Datatype *outtype, Datatype *intype, uint4 offset, bool isbigend) const =0
Is the given data-type truncation considered a cast, given endianess concerns.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:940
Convert BRANCHIND with only one computed destination to a BRANCH.
Definition: ruleaction.hh:914
int4 numpass
Number of passes performed for this function.
Definition: coreaction.hh:813
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:675
int4 valueMatch(Varnode *vn2, Varnode *baseVn2, int4 bitsPreserved2) const
Determine if this guard applies to the given Varnode.
Definition: jumptable.cc:593
void setRestartPending(bool val)
Toggle whether analysis needs to be restarted for this function.
Definition: funcdata.hh:186
void setParamshiftApplied(bool val)
Toggle whether a parameter shift has been applied.
Definition: fspec.hh:1176
PcodeOp * cbranch
PcodeOp CBRANCH the branches around the switch.
Definition: jumptable.hh:131
PcodeOp * lastOp
Last PcodeOp that was executed.
Definition: emulateutil.hh:45
@ coretype
This is a basic type which will never be redefined.
Definition: type.hh:66
list< PatchRecord > patchlist
Operations getting patched (but with no flow thru)
Definition: subflow.hh:89
NullSubsort subsorttype
The sub-sort object for a rangemap.
Definition: database.hh:807
virtual uintb restoreXmlAttributes(const Element *el, uint4 &size) const
Definition: space.cc:529
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2852
void removeInEdge(int4 slot)
Remove an incoming edge.
Definition: block.cc:118
Basic elements of a parameter: address, data-type, properties.
Definition: fspec.hh:294
virtual void executeBranchind(void)
Standard behavior for a BRANCHIND.
Definition: emulate.cc:270
int4 index2addr
Id of p-code script performing index2addr (must be present)
Definition: userop.hh:231
void setLastAsMostCommon(void)
Set the most common jump-table target to be the last address in the table.
Definition: jumptable.cc:2328
string name
Name of function if present.
Definition: fspec.hh:1438
virtual void clearInput(int4 i)
Clear the input parameter at the specified slot.
Definition: fspec.cc:2506
Datatype * restoreXmlTypeWithCodeFlags(const Element *el, bool hasThisPtr, bool isConstructor, bool isDestructor)
Restore data-type from XML with extra "code" flags.
Definition: type.cc:1953
Raw components of a function prototype (obtained from parsing source code)
Definition: fspec.hh:1127
bool isIndirectZero(void) const
Is this just a special placeholder representing INDIRECT creation?
Definition: varnode.hh:247
int4 getNumUsed(void) const
Get number of trials marked as formal parameters.
Definition: fspec.cc:1538
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:929
virtual void buildLoader(DocumentStorage &store)=0
Build the LoadImage object and load the executable image.
Information about the FLOAT_NAN op-code.
Definition: typeop.hh:573
vector< uintb > coeff
Associated constant multiple.
Definition: ruleaction.hh:36
void establishValueSets(const vector< Varnode * > &sinks, const vector< PcodeOp * > &reads, Varnode *stackReg, bool indirectAsCopy)
Build value sets for a data-flow system.
Definition: rangeutil.cc:2402
void mergeOpcode(OpCode opc)
Try to force merges of input to output for all p-code ops of a given type.
Definition: merge.cc:265
static OpCode getOpCodeFromHash(uint8 h)
Retrieve the encoded op-code from a hash.
Definition: dynamic.cc:490
virtual int4 startComment(void)
Start a comment block within the emitted source code.
Definition: prettyprint.cc:1111
AddrSpace * curspace
Address space of the current valid range.
Definition: globalcontext.hh:312
uintm * mask
The mask array indicating which variables are explicitly set.
Definition: globalcontext.hh:265
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)
Restore the model from an XML stream.
Definition: fspec.cc:1020
virtual bool possibleParam(const Address &loc, int4 size) const
Does the given storage location make sense as a parameter.
Definition: fspec.cc:926
SymbolEntry * remapSymbolDynamic(Symbol *sym, uint8 hash, const Address &usepoint)
Make the primary mapping for the given Symbol, dynamic.
Definition: varmap.cc:1208
int4 line_commentindent
Number of characters a comment line should be indented.
Definition: printlanguage.hh:238
@ type_disable
Is this rule disabled.
Definition: action.hh:196
virtual bool checkPrintNegation(const Varnode *vn)
Check whether a given boolean Varnode can be printed in negated form.
Definition: printc.cc:1997
@ warnings_given
Set if a warning for this rule has been given before.
Definition: action.hh:199
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1787
void pushCharConstant(uintb val, const TypeChar *ct, const Varnode *vn, const PcodeOp *op)
Push a single character constant to the RPN stack.
Definition: printc.cc:1293
Varnode * findCoveringInput(int4 s, const Address &loc) const
Find an input Varnode covering a range.
Definition: varnode.cc:1137
Varnode * findCoveredInput(int4 s, const Address &loc) const
Find the first input Varnode covered by the given range.
Definition: funcdata.hh:271
void endStatement(int4 id)
Create an "end source code statement" command.
Definition: prettyprint.hh:422
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:327
OpCode opc
Type of boolean operation.
Definition: block.hh:517
int4 enterNode(State &state)
Traverse into a new Varnode.
Definition: funcdata_varnode.cc:1578
int4 extrapop
Extra bytes popped from stack.
Definition: fspec.hh:619
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:881
void guardCallOverlappingInput(FuncCallSpecs *fc, const Address &addr, int4 size)
Guard an address range that is larger than any single parameter.
Definition: heritage.cc:1047
CPUI_FLOAT_FLOAT2FLOAT behavior.
Definition: opbehavior.hh:452
VolatileWriteOp * vol_write
(Single) volatile write operation
Definition: userop.hh:255
static OpToken leftequal
The in-place left shift operator.
Definition: printc.hh:105
virtual bool isNameLocked(void) const
Is the parameter name locked.
Definition: fspec.hh:977
virtual void printRaw(ostream &s) const
Print a description of the type to stream.
Definition: type.cc:380
void updateOutputNoTypes(const vector< Varnode * > &triallist, TypeFactory *factory)
Update the return value based on Varnode trials, but don't store the data-type.
Definition: fspec.cc:3286
EntrySubsort(bool val)
Given a boolean value, construct the earliest/latest possible sub-sort.
Definition: database.hh:95
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2958
virtual void findUnnormalized(uint4 maxaddsub, uint4 maxleftright, uint4 maxext)
Recover the unnormalized switch variable.
Definition: jumptable.cc:1337
void opDeadInsertAfter(PcodeOp *op, PcodeOp *prev)
Moved given PcodeOp to specified point in the dead list.
Definition: funcdata.hh:413
bool findInitPre(void)
Find initblock, based on iblock.
Definition: condexe.cc:397
virtual void opFloatSqrt(const PcodeOp *op)
Emit a FLOAT_SQRT operator.
Definition: printc.hh:275
virtual int4 openParen(char o, int4 id=0)
Emit an open parenthesis.
Definition: prettyprint.hh:258
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:235
TypeFactory(Architecture *g)
Construct a factory.
Definition: type.cc:1204
void saveXmlRef(ostream &s) const
Write an XML reference of this to stream.
Definition: type.cc:257
Container for data structures associated with a single function.
Definition: funcdata.hh:45
Document * getComments(const Address &fad, uint4 flags)
Retrieve comments for a particular function.
Definition: ghidra_arch.cc:560
uintb mask
Bits making up the logical sub-variable.
Definition: subflow.hh:46
The base datatype class for the decompiler.
Definition: type.hh:62
static const uint4 majorversion
Current major version of decompiler.
Definition: architecture.hh:71
const Range * getRange(AddrSpace *spaceid, uintb offset) const
Get Range containing the given byte.
Definition: address.cc:425
CPUI_FLOAT_CEIL behavior.
Definition: opbehavior.hh:468
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:361
Simplify chained shifts INT_LEFT and INT_RIGHT.
Definition: ruleaction.hh:358
bool match(BlockBasic *b1, BlockBasic *b2)
Test blocks for the merge condition.
Definition: blockaction.cc:2045
static void passJavaException(ostream &s, const string &tp, const string &msg)
Send an exception message to the Ghidra client.
Definition: ghidra_arch.cc:239
void seenDeadCode(AddrSpace *spc)
Inform system of dead code removal in given space.
Definition: heritage.cc:2356
Document * getExternalRefXML(const Address &addr)
Retrieve a description of an external function.
Definition: ghidra_arch.cc:497
@ CPUI_PTRADD
Index into an array ([])
Definition: opcodes.hh:118
~Varnode(void)
Destructor.
Definition: varnode.cc:555
list< PcodeOp * > storelist
List of STORE PcodeOps.
Definition: op.hh:249
virtual uintb find(uintb addr) const =0
Retrieve a word from memory bank at an aligned location.
static PrintJavaCapability printJavaCapability
The singleton instance.
Definition: printjava.hh:29
void installSwitchDefaults(void)
Make sure default switch cases are properly labeled.
Definition: funcdata_block.cc:604
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6386
PcodeOp * findOp(const SeqNum &num) const
Find a PcodeOp by sequence number.
Definition: op.cc:834
void saveXml(ostream &s, uint8 id, bool savetree) const
Emit an XML description of this function to stream.
Definition: funcdata.cc:687
uint8 hash
A dynamic storage address (an alternative to addr for dynamic symbols)
Definition: database.hh:56
@ CPUI_FLOAT_NOTEQUAL
Floating-point comparison, in-equality (!=)
Definition: opcodes.hh:87
A series of blocks that execute in sequence.
Definition: block.hh:495
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7251
EmitXml::syntax_highlight hl
Highlighting for token.
Definition: prettyprint.hh:329
int4 contains(const Varnode &op) const
Return info about the containment of op in this.
Definition: varnode.cc:97
Address addrresult
Address most closely associated with variable.
Definition: dynamic.hh:70
Set the (already) recovered output data-type as a formal part of the prototype.
Definition: coreaction.hh:863
@ status_start
At start of action.
Definition: action.hh:63
bool operator<(const BadEdgeScore &op2) const
Compare for grouping.
Definition: blockaction.cc:628
string name
Name of the action.
Definition: action.hh:85
@ pointer_method
Pointer to a method, name in token, signature in type.
Definition: cpool.hh:51
virtual void tagFuncName(const char *ptr, syntax_highlight hl, const Funcdata *fd, const PcodeOp *op)
Emit a function identifier.
Definition: prettyprint.cc:197
virtual PcodeOp * getStartOp(void) const =0
Get the PcodeOp associated with the current value.
Varnode * in0
First input.
Definition: ruleaction.hh:1356
EmulateFunction(Funcdata *f)
Constructor.
Definition: jumptable.cc:124
virtual PrintLanguage * buildLanguage(Architecture *glb)
Build the main PrintLanguage object corresponding to this capability.
Definition: printc.cc:86
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:295
virtual string getArchType(void) const
Get a string indicating the architecture type.
Definition: loadimage.cc:69
uint4 clean_up_index
Creation index of first Varnode created after start of cleanup.
Definition: funcdata.hh:63
void pushVnImplied(const Varnode *vn, const PcodeOp *op, uint4 m)
Push an implied variable onto the RPN stack.
Definition: printlanguage.cc:185
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:595
Varnode * boolvn
If basevn is defined by BOOL_NEGATE, this is the unnegated Varnode.
Definition: condexe.hh:36
static void writeUtf8(ostream &s, int4 codepoint)
Write unicode character to stream in UTF8 encoding.
Definition: printlanguage.cc:488
CPUI_INT_LESS behavior.
Definition: opbehavior.hh:159
virtual bool inScope(const Address &addr, int4 size, const Address &usepoint) const
Query if the given range is owned by this Scope.
Definition: database.hh:531
Varnode(int4 s, const Address &m, Datatype *dt)
Construct a free Varnode.
Definition: varnode.cc:523
vector< EntryMap * > maptable
Rangemaps of SymbolEntry, one map for each address space.
Definition: database.hh:731
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database.cc:2065
Varnode * vn
The term Varnode.
Definition: coreaction.hh:1041
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:454
PcodeOp * nextOp(void) const
Return the next op in the control-flow from this or null.
Definition: op.cc:223
virtual void restoreXml(const Element *el, ProtoModel *model)=0
Restore any internal parameter descriptions from an XML stream.
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:397
virtual void opLoad(const PcodeOp *op)
Emit a LOAD operator.
Definition: printjava.cc:196
bool allowset
If set to false, and setContext() call is dropped.
Definition: globalcontext.hh:311
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:541
Mark Varnodes built out of legal parameters.
Definition: coreaction.hh:237
virtual void emitVarDecl(const Symbol *sym)=0
Emit a variable declaration.
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const =0
Apply a particular configuration option to the Architecture.
Definition: opbehavior.hh:28
virtual FlowBlock * getSplitPoint(void)
Get the leaf splitting block.
Definition: block.cc:2247
static int4 addressToByteInt(int4 val, uint4 ws)
Scale int4 from addressable units to byte units.
Definition: space.hh:505
void emitGotoStatement(const FlowBlock *bl, const FlowBlock *exp_bl, uint4 type)
Emit a statement representing an unstructured branch.
Definition: printc.cc:1912
void merge(const Cover &op2)
Merge this with another Cover block by block.
Definition: cover.cc:415
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7586
FlowBlock * parent
The parent block to which this belongs.
Definition: block.hh:108
void registerUniversal(Action *act)
Register the universal root Action.
Definition: action.cc:961
AddrSpaceManager * getManager(void) const
Get the space manager.
Definition: space.hh:269
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: action.cc:689
int4 indentincrement
Change in indentlevel per level of nesting.
Definition: prettyprint.hh:82
void setValue(uintm *vec, uintm val) const
Set this value within a given context blob.
Definition: globalcontext.hh:47
bool possibleOutputParamWithSlot(const Address &loc, int4 size, int4 &slot, int4 &slotsize) const
Pass-back the slot and slot size for the given storage location as a return value.
Definition: fspec.hh:760
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:515
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:545
bool analysis_finished
True if analysis already performed.
Definition: coreaction.hh:84
State(PcodeOp *o, int4 s)
Constructor given a Varnode read.
Definition: funcdata.hh:584
@ CPUI_BRANCH
Always branch.
Definition: opcodes.hh:40
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6681
Datatype object representing an array of elements.
Definition: type.hh:245
PcodeOp * xrefControlFlow(list< PcodeOp * >::const_iterator oiter, bool &startbasic, bool &isfallthru, FuncCallSpecs *fc)
Analyze control-flow within p-code for a single instruction.
Definition: flow.cc:249
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2051
@ input
This varnode has no ancestor.
Definition: varnode.hh:74
void saveXmlBody(ostream &s) const
Save details of the Symbol to XML.
Definition: database.cc:472
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:312
virtual void emitVarDeclStatement(const Symbol *sym)=0
Emit a variable declaration statement.
bool hasCover(void) const
Does this have Cover information?
Definition: varnode.hh:259
Structure control-flow using standard high-level code constructs.
Definition: blockaction.hh:296
@ special_prop
Does some special form of datatype propagation.
Definition: op.hh:106
@ f_switch_out
Output is decided by switch.
Definition: block.hh:79
Definition: subflow.hh:165
void gatherHighs(const Funcdata &fd)
Add HighVariables as hints to the collection.
Definition: varmap.cc:911
Varnode * findLinkedVarnode(SymbolEntry *entry) const
Find a Varnode matching the given Symbol mapping.
Definition: funcdata_varnode.cc:1032
void pushAtom(const Atom &atom)
Push a variable token onto the RPN stack.
Definition: printlanguage.cc:150
int4 getIndex(void) const
Get the integer identifier.
Definition: space.hh:317
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:724
PcodeOp * patchOp
Op being affected.
Definition: subflow.hh:74
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:697
ReplaceVarnode * in1
The logical variable input.
Definition: subflow.hh:75
AddrSpace * getIopSpace(void) const
Get the internal pcode op space.
Definition: translate.hh:442
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4271
@ TYPE_VOID
Standard "void" type, absence of type.
Definition: type.hh:34
bool isJoin(void) const
Is this a join value.
Definition: address.hh:418
list< BlockTrace * >::iterator current_activeiter
The current active BlockTrace being pushed.
Definition: blockaction.hh:160
A virtual space stack space.
Definition: translate.hh:170
void clear(void)
Clear all component FlowBlock objects.
Definition: block.cc:1165
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:492
Simplify boolean expressions when one side is constant.
Definition: ruleaction.hh:448
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:289
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
Placeholder node for PcodeOp operating on smaller logical values.
Definition: subflow.hh:52
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7704
vector< ParamTrial > trial
The list of parameter trials.
Definition: fspec.hh:224
TypeOpReturn(TypeFactory *t)
Constructor.
Definition: typeop.cc:762
LaneDescription laneDescription
Description of how to split Varnodes.
Definition: subflow.hh:133
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:1080
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:344
bool built
Whether build() method has run, setting up the emulator.
Definition: pcodeinject.hh:137
TypeOpFloatFloor(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1468
Simplify masked pieces INT_ORed together: (V & ff00) | (V & 00ff) => V
Definition: ruleaction.hh:894
A user defined operation that is injected with other p-code.
Definition: userop.hh:83
virtual int4 getCategorySize(int4 cat) const =0
Get the number of Symbols in the given category.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:807
vector< LanedRegister > lanerecords
Vector registers that have preferred lane sizes.
Definition: architecture.hh:155
void switchOverJumpTables(const FlowInfo &flow)
Convert jump-table addresses to basic block indices.
Definition: funcdata_block.cc:595
Funcdata(const string &nm, Scope *conf, const Address &addr, int4 sz=0)
Constructor.
Definition: funcdata.cc:23
static void clearTotalPosition(uint8 &h)
Clear the collision total and position fields within a hash.
Definition: dynamic.cc:526
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:319
bool likelylistfull
Have we generated a likely goto list for the current innermost loop.
Definition: blockaction.hh:192
friend ostream & operator<<(ostream &s, const SeqNum &sq)
Write out a SeqNum to a stream.
Definition: address.cc:19
ScopeLocal(AddrSpace *spc, Funcdata *fd, Architecture *g)
Constructor.
Definition: varmap.cc:268
void opRemoveInput(PcodeOp *op, int4 slot)
Remove a specific input slot for the given PcodeOp.
Definition: funcdata_op.cc:264
int4 inid
The id of the Architecture being terminated.
Definition: ghidra_process.hh:120
LowlevelError(const string &s)
Initialize the error with an explanatory string.
Definition: error.hh:47
bool checkStartBreak(void)
Check start breakpoint.
Definition: action.cc:50
static OpToken scope
The sub-scope/namespace operator.
Definition: printc.hh:66
bool stackGrowsNegative
Marked true if the stack is considered to grow towards smaller offsets.
Definition: varmap.hh:187
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:296
int4 getParenLevel(void) const
Get the current parentheses depth.
Definition: prettyprint.hh:202
bool isDecisionIn(int4 i) const
Can this and the i-th input be merged into a BlockIf or BlockList.
Definition: block.hh:246
virtual int4 instructionLength(const Address &baseaddr) const =0
Get the length of a machine instruction.
Datatype * typecache10
Specially cached 10-byte float type.
Definition: type.hh:388
~FuncProto(void)
Destructor.
Definition: fspec.cc:3048
list< PcodeOp * >::const_iterator beginOpDead(void) const
Start of PcodeOp objects in the dead list.
Definition: funcdata.hh:461
bool isBigEndian(void) const
Is data at this address big endian encoded.
Definition: address.hh:269
@ unalloc
Not allocated in memory (debug info)
Definition: loadimage.hh:47
void endFuncProto(int4 id)
Create an "end function prototype declaration" command.
Definition: prettyprint.hh:434
TypeOpIntXor(TypeFactory *t)
Constructor.
Definition: typeop.cc:1077
Perform SubVariableFlow analysis triggered by INT_AND.
Definition: ruleaction.hh:1231
virtual void emitBlockDoWhile(const BlockDoWhile *bl)
Emit a loop structure, check at bottom.
Definition: printc.cc:2606
int4 size
Size (of variable holding a value of this type)
Definition: type.hh:80
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:110
virtual void addRegister(const string &nm, AddrSpace *base, uintb offset, int4 size)=0
Add a named register to the model for this processor.
void branchRemoveInternal(BlockBasic *bb, int4 num)
Remove an outgoing branch of the given basic block.
Definition: funcdata_block.cc:190
virtual void saveXml(ostream &s) const =0
Save all records in this container to an XML stream.
virtual string getSource(void) const
Return a string describing the source of the injection (.cspec, prototype model, etc....
Definition: inject_ghidra.hh:46
static Datatype * propagateAddIn2Out(TypeFactory *typegrp, PcodeOp *op, int4 inslot)
Propagate a pointer data-type through an ADD operation.
Definition: coreaction.cc:4136
@ killedbycall
The memory is changed and is completely unrelated to its original value.
Definition: fspec.hh:309
void extendInput(Funcdata &data, Varnode *invn, ProtoParameter *param, BlockBasic *topbl)
Extend Varnode inputs to match prototype model.
Definition: coreaction.cc:3675
virtual void setContextDefault(const string &nm, uintm val)
Set the default value for a particular context variable.
Definition: sleigh.cc:678
single entry switch variable that can take a range of values
Definition: jumptable.hh:177
static void linkSymbols(Funcdata &data, vector< Varnode * > &namerec)
Link formal Symbols to their HighVariable representative in the given Function.
Definition: coreaction.cc:2461
CPUI_FLOAT_TRUNC behavior.
Definition: opbehavior.hh:460
@ CPUI_BOOL_XOR
Boolean exclusive-or (^^)
Definition: opcodes.hh:80
void emitLabelStatement(const FlowBlock *bl)
Emit any required label statement for a given basic block.
Definition: printc.cc:2741
An Architecture that uses the decompiler's native SLEIGH translation engine.
Definition: sleigh_arch.hh:89
uintb label
The label for this case, as an untyped constant.
Definition: block.hh:636
int4 justifiedContain(int4 sz, const Address &op2, int4 sz2, bool forceleft) const
Determine if op2 is the least significant part of this.
Definition: address.cc:125
PcodeOp * findRelTarget(PcodeOp *op, Address &res) const
Generate the target PcodeOp for a relative branch.
Definition: flow.cc:147
ValueSet * getNext(void)
Get the ValueSet pointed to by this iterator and advance the iterator.
Definition: rangeutil.cc:1914
virtual list< SymbolEntry >::iterator endDynamic(void)
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:99
void identifyInternal(BlockGraph *ident, const vector< FlowBlock * > &nodes)
Move nodes from this into a new BlockGraph.
Definition: block.cc:866
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const =0
Push the specific PcodeOp to the emitter's RPN stack.
bool operator!=(const MapIterator &op2) const
Inequality operator.
Definition: database.hh:372
virtual void adjustVma(long adjust)
Adjust load addresses with a global offset.
Definition: loadimage_ghidra.cc:47
@ pointer_field
Pointer to a field, name in token, data-type in type.
Definition: cpool.hh:52
void insertActive(BlockTrace *trace)
Move a BlockTrace into the active category.
Definition: blockaction.cc:779
uintb val
Value of constant (when vn==NULL)
Definition: subflow.hh:47
varnode_flags
Definition: varnode.hh:70
Document * getMappedSymbolsXML(const Address &addr)
Get symbols associated with the given address.
Definition: ghidra_arch.cc:475
JumpTable * linkJumpTable(PcodeOp *op)
Link jump-table with a given BRANCHIND.
Definition: funcdata_block.cc:421
void opInsertAfter(PcodeOp *op, PcodeOp *prev)
Insert given PcodeOp after a specific op.
Definition: funcdata_op.cc:346
NodePending(const Varnode *v, const PcodeOp *o, uint4 m)
Construct a pending data-flow node.
Definition: printlanguage.hh:185
static bool compare_ends(LoopBody *a, LoopBody *b)
Compare the head then tail.
Definition: blockaction.cc:466
Information about the INT_2COMP op-code.
Definition: typeop.hh:407
void setDeadCodeDelay(AddrSpace *spc, int4 delay)
Set delay for a specific space.
Definition: heritage.cc:2380
void saveXmlCoreTypes(ostream &s) const
Save core types to stream.
Definition: type.cc:2012
bool operator()(const Datatype *a, const Datatype *b) const
Comparison operator.
Definition: type.hh:143
FlowBlock * copy
The block being mirrored by this (usually a BlockBasic)
Definition: block.hh:418
Prepare function prototypes for "normalize" simplification.
Definition: coreaction.hh:592
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2613
virtual void opReturn(const PcodeOp *op)=0
Emit a RETURN operator.
string tspec
Configuration (address-spaces) for the Translate object.
Definition: ghidra_process.hh:105
@ syntax
Emit atom as syntax.
Definition: printlanguage.hh:156
int4 opFlipInPlaceTest(PcodeOp *op, vector< PcodeOp * > &fliplist)
Trace a boolean value to a set of PcodeOps that can be changed to flip the boolean value.
Definition: funcdata_op.cc:1023
void addBooleanPatch(PcodeOp *pullop, ReplaceVarnode *rvn, int4 slot)
Mark a subgraph bit variable flowing into an operation taking a boolean input.
Definition: subflow.cc:1099
bool verify(void)
Verify that we have a removable iblock.
Definition: condexe.cc:732
void setDefaultCodeSpace(int4 index)
Set the default address space (for code)
Definition: translate.cc:254
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:167
int4 fullIteration
The iteration at which a full range is produced.
Definition: rangeutil.hh:236
VarnodeLocSet::const_iterator endLoc(const Address &addr) const
End of Varnodes at a storage address.
Definition: funcdata.hh:313
vector< InjectPayload * > injection
Registered injections.
Definition: pcodeinject.hh:166
@ TYPE_CODE
Data is actual executable code.
Definition: type.hh:40
An operation that reads from volatile memory.
Definition: userop.hh:112
static bool compareCallspecs(const FuncCallSpecs *a, const FuncCallSpecs *b)
Compare call specification objects by call site address.
Definition: funcdata.cc:449
virtual void printMessage(const string &message) const
Print an error message to console.
Definition: sleigh_arch.hh:113
void clear(void)
Reset all analysis of heritage.
Definition: heritage.cc:2420
void addPush(PcodeOp *pushOp, ReplaceVarnode *rvn)
Mark an operation where original data-flow is being pushed into a subgraph variable.
Definition: subflow.cc:1047
A hash utility to uniquely identify a temporary Varnode in data-flow.
Definition: dynamic.hh:60
void setNameMap(const map< uintb, string > &nmap)
Establish the value -> name map.
Definition: type.cc:542
const_iterator find_overlap(linetype point, linetype end) const
Find first record overlapping given interval.
Definition: rangemap.hh:411
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1276
static bool preferredOutput(Varnode *out1, Varnode *out2)
Which of two outputs is preferred.
Definition: coreaction.cc:730
@ special
Cannot be evaluated (without special processing)
Definition: op.hh:86
virtual void adjustVma(long adjust)
Adjust load addresses with a global offset.
Definition: loadimage_xml.cc:262
int4 stage
Additional elements consumed from the RPN stack when emitting this token.
Definition: printlanguage.hh:93
void clear(void)
Clear the entire set of overrides.
Definition: override.cc:19
bool isTruncated(void) const
Return true if this space is truncated from its original size.
Definition: space.hh:435
Determine which sub-functions have active output Varnodes.
Definition: coreaction.hh:725
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:569
Toggle whether unimplemented instructions are treated as a fatal error.
Definition: options.hh:219
@ CALLOTHERFIXUP_TYPE
Injection that replaces a user-defined p-code op, CALLOTHER.
Definition: pcodeinject.hh:82
virtual void setNameLock(bool val)
Toggle the lock on the name.
Definition: fspec.cc:2274
void generateOverrideMessages(vector< string > &messagelist, Architecture *glb) const
Create warning messages that describe current overrides.
Definition: override.cc:269
A user defined p-code op that has a dynamically defined procedure.
Definition: userop.hh:144
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:225
Document * xml_tree(istream &i)
Parse the given XML stream into an in-memory document.
void setOrder(void)
Reset the SeqNum::order field for all PcodeOp objects in this block.
Definition: block.cc:2524
void printRawHeritage(ostream &s, int4 depth) const
Print a simple SSA subtree rooted at this.
Definition: varnode.cc:658
ValueSet * next
Next ValueSet to iterate.
Definition: rangeutil.hh:139
Operation with a new logical value as (part of) input, but output Varnode is unchanged.
Definition: subflow.hh:63
void emitLikelyEdges(list< FloatingEdge > &likely, FlowBlock *graph)
Collect likely unstructured edges.
Definition: blockaction.cc:357
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const =0
Given an address and data-type, build a suitable generic symbol name.
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:421
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:611
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:564
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:450
int4 count
Associated id (for matching begin/end pairs)
Definition: prettyprint.hh:344
virtual void insert(uintb addr, uintb val)
Overridden aligned word insert.
Definition: memstate.cc:549
Varnode * vn
The underlying Varnode with lanes.
Definition: subflow.hh:169
A contiguous range of memory that can be used to pass parameters.
Definition: fspec.hh:48
uint4 tag
Descriptor of type of the object.
Definition: cpool.hh:64
Address addr
Storage address of the parameter.
Definition: fspec.hh:966
Information about the FLOAT_CEIL op-code.
Definition: typeop.hh:650
void remapDynamicVarnode(Varnode *vn, Symbol *sym, const Address &usepoint, uint8 hash)
Remap a Symbol to a given Varnode using a new dynamic mapping.
Definition: funcdata_varnode.cc:960
Varnode * getTiedVarnode(void) const
Find the first address tied member Varnode.
Definition: variable.cc:384
Varnode * pullBack(PcodeOp *op, Varnode **constMarkup, bool usenzmask)
Pull-back this range through given PcodeOp.
Definition: rangeutil.cc:1012
int4 size
Number of bytes consumed by this (piece of the) storage.
Definition: database.hh:58
int4 min_funcsymbol_size
Minimum size of a function symbol.
Definition: architecture.hh:126
virtual void rawAction(void)=0
Perform the action of the command.
@ precishi
Is this Varnode the high part of a double precision value.
Definition: varnode.hh:104
PcodeOp * op
op getting paralleled
Definition: subflow.hh:54
CPUI_INT_NOTEQUAL behavior.
Definition: opbehavior.hh:138
uintb linetype
The linear element for a rangemap of SymbolEntry.
Definition: database.hh:111
An interface to a database of disassembly/decompiler context information.
Definition: globalcontext.hh:108
LocationMap disjoint
Disjoint cover of memory locations currently being heritaged.
Definition: heritage.hh:203
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3691
A tracked register (Varnode) and the value it contains.
Definition: globalcontext.hh:68
Datatype * getBaseNoChar(int4 s, type_metatype m)
Get atomic type excluding "char".
Definition: type.cc:1667
virtual ~Scope(void)
Destructor.
Definition: database.cc:1104
A special space for encoding FuncCallSpecs.
Definition: fspec.hh:283
void addTerminalPatchSameOp(PcodeOp *pullop, ReplaceVarnode *rvn, int4 slot)
Mark an operation where a subgraph variable is naturally pulled into the original data-flow.
Definition: subflow.cc:1081
static OpToken greater_equal
The greater than or equal operator.
Definition: printc.hh:88
Heritage heritage
Manager for maintaining SSA form.
Definition: funcdata.hh:80
int4 buildDomDepth(vector< int4 > &depth) const
Calculate dominator depths.
Definition: block.cc:1949
void moveOutEdge(FlowBlock *blold, int4 slot, FlowBlock *blnew)
Move indicated out edge to a new FlowBlock.
Definition: block.cc:1402
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:412
linetype a
Start of full range occupied by the entire recordtype.
Definition: rangemap.hh:80
uintb tempbase
Offset within unique space for allocating temporaries within a payload.
Definition: pcodeinject.hh:165
TypeStruct(const TypeStruct &op)
Construct from another TypeStruct.
Definition: type.cc:712
int4 finalscore
The final fitness score.
Definition: fspec.hh:859
A manager for symbol scopes for a whole executable.
Definition: database.hh:838
Information about the INT_DIV op-code.
Definition: typeop.hh:485
int2 category
Special category (-1==none 0=parameter 1=equate)
Definition: database.hh:166
Symbol * linkSymbol(Varnode *vn)
Find or create Symbol associated with given Varnode.
Definition: funcdata_varnode.cc:973
Architecture * glb
Architecture for accessing symbol table.
Definition: type.hh:360
@ line_t
Required line break with one-time indent level.
Definition: prettyprint.hh:323
virtual void clear(void)
Clear all symbols from this scope.
Definition: database_ghidra.cc:253
virtual SymbolEntry * findOverlap(const Address &addr, int4 size) const =0
Find first Symbol overlapping the given memory range.
uint4 addlflags
Additional boolean attributes for this op.
Definition: op.hh:115
void processHole(const Element *el) const
Process a response describing a hole.
Definition: database_ghidra.cc:90
@ seen_kill
Indicates the Varnode is killed by a call on at least path to MULTIEQUAL.
Definition: funcdata.hh:573
virtual void insert(uintb addr, uintb val)
Overridden aligned word insert.
Definition: memstate.cc:417
string corespec
A description of core data-types for the TypeFactory object.
Definition: ghidra_process.hh:106
RawBinaryArchitectureCapability & operator=(const RawBinaryArchitectureCapability &op2)
Not implemented.
Classes describing the topological scope of variables within a function.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:427
virtual void executeBranch(void)
Execute branch (including relative branches)
Definition: emulate.cc:402
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2479
Address resolveConstant(AddrSpace *spc, uintb val, int4 sz, const Address &point, uintb &fullEncoding) const
Resolve a native constant into an Address.
Definition: translate.cc:562
void addLoopEdge(FlowBlock *begin, int4 outindex)
Mark a given edge as a loop edge.
Definition: block.cc:1351
SeqNum start
What instruction address is this attached to.
Definition: op.hh:116
virtual void setError(const string &errmsg)
Callback for handling an error condition during XML parsing.
Definition: xml.hh:239
static OpToken andequal
The in-place logical and operator.
Definition: printc.hh:107
void removeRange(Scope *scope, AddrSpace *spc, uintb first, uintb last)
Remove an address range from ownership of a Scope.
Definition: database.cc:2887
Varnode * findVarnodeInput(int4 s, const Address &loc) const
Find the input Varnode with the given size and storage address.
Definition: funcdata.hh:285
uint4 maxdelayslotbytes
Maximum number of bytes in a delay-slot directive.
Definition: sleighbase.hh:36
void restoreXml(const Element *el)
Restore this from XML.
Definition: translate.cc:20
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:449
virtual void opFloatFloat2Float(const PcodeOp *op)=0
Emit a FLOAT_FLOAT2FLOAT operator.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:114
FunctionSymbol(Scope *sc, const string &nm, int4 size)
Construct given the name.
Definition: database.cc:540
BlockBasic * nodeJoinCreateBlock(BlockBasic *block1, BlockBasic *block2, BlockBasic *exita, BlockBasic *exitb, bool fora_block1ishigh, bool forb_block1ishigh, const Address &addr)
Create a new basic block for holding a merged CBRANCH.
Definition: funcdata_block.cc:696
virtual ContextBitRange & getVariable(const string &nm)
Retrieve the context variable description object by name.
Definition: globalcontext.cc:397
@ precislo
Is this Varnode the low part of a double precision value.
Definition: varnode.hh:103
void insertIndirectOverride(const Address &callpoint, const Address &directcall)
Override an indirect call turning it into a direct call.
Definition: override.cc:99
map< string, ProtoModel * > protoModels
Parsed forms of possible prototypes.
Definition: architecture.hh:137
Architecture(void)
Construct an uninitialized Architecture.
Definition: architecture.cc:85
const AddrSpaceManager * manage
Address space manager used to restore FlowBlock address ranges.
Definition: block.hh:687
A light-weight emulator to calculate switch targets from switch variables.
Definition: jumptable.hh:100
bool hasModel(const string &nm) const
Does this Architecture have a specific PrototypeModel.
Definition: architecture.cc:184
void initialize(const EntryInitData &data, uintb a, uintb b)
Fully initialize this.
Definition: database.cc:60
virtual void emitVarDeclStatement(const Symbol *sym)
Emit a variable declaration statement.
Definition: printc.cc:2119
vector< VarnodeData > likelytrash
Locations that may contain trash values.
Definition: fspec.hh:1169
bool xml_readbool(const string &attr)
Read an XML attribute value as a boolean.
Definition: xml.hh:382
Class for automatically registering extension points to the decompiler.
Definition: capability.hh:36
Address loc
Storage location (or constant value) of the Varnode.
Definition: varnode.hh:128
A generic binary operator: two inputs and one output.
Definition: typeop.hh:155
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:548
void setVarnodeValue(uintb offset, uintb val)
Set a temporary register value in the machine state.
Definition: emulateutil.hh:170
Datatype * getSubEntry(int4 off, int4 sz, int4 *newoff, int4 *el) const
Figure out what a byte range overlaps.
Definition: type.cc:495
void emitEnumDefinition(const TypeEnum *ct)
Emit the definition of an enumeration data-type.
Definition: printc.cc:1761
TypeCode * getTypeCode(void)
Get an "anonymous" function data-type.
Definition: type.cc:1726
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:164
void copyFlowEffects(const FuncProto &op2)
Copy properties that affect data-flow.
Definition: fspec.cc:2948
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7257
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:989
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6937
void unsignedSubtract128(uint8 *a, uint8 *b)
Subtract (in-place) a 128-bit value from a base 128-value.
Definition: address.cc:834
A user defined p-code op for assisting the recovery of jump tables.
Definition: userop.hh:229
virtual void retypeSymbol(Symbol *sym, Datatype *ct)
Change the data-type of a Symbol within this Scope.
Definition: database.cc:2033
bool hideShadows(HighVariable *high)
Hide shadow Varnodes related to the given HighVariable by consolidating COPY chains.
Definition: merge.cc:968
void getContext(const Address &addr, uintm *buf) const
Retrieve the context blob for the given address.
Definition: globalcontext.cc:582
@ CPUI_RETURN
Return from subroutine.
Definition: opcodes.hh:47
virtual const uintm * getContext(const Address &addr) const
Get the context blob of values associated with a given address.
Definition: ghidra_context.hh:60
const Funcdata * fd
Associated Function.
Definition: prettyprint.hh:335
TypeOpFloatAbs(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1426
vector< const PcodeOp * > markop
List of PcodeOps in the sub-graph being hashed.
Definition: dynamic.hh:65
uintb joinallocate
Next offset to be allocated in join space.
Definition: translate.hh:231
virtual void restoreXmlHeader(const Element *el)
Restore basic information for XML attributes.
Definition: block.cc:2340
virtual bool isNameUndefined(void) const
Is the name of this parameter undefined.
Definition: fspec.cc:2364
bool isHeritaged(Varnode *vn)
Check if a specific Varnode has been linked in fully to the syntax tree (SSA)
Definition: funcdata.hh:237
Scope(const string &nm, Architecture *g)
Construct an empty scope, given a name and Architecture.
Definition: database.hh:505
@ TYPE_UNKNOWN
An unknown low-level type. Treated as an unsigned integer.
Definition: type.hh:36
TypeOpBranch(TypeFactory *t)
Constructor.
Definition: typeop.cc:477
PcodeOpRaw * currentOp
Current p-code op being executed.
Definition: emulateutil.hh:116
int4 localcount
Number of passes performed for this function.
Definition: coreaction.hh:924
virtual bool isZextCast(Datatype *outtype, Datatype *intype) const =0
Is zero-extending an input data-type, producing an output data-type, considered a cast.
@ CPUI_INT_XOR
Logical/bitwise exclusive-or (^)
Definition: opcodes.hh:67
patchtype
The possible types of patches on ops being performed.
Definition: subflow.hh:66
bool dynamic
True if the injection is generated dynamically.
Definition: pcodeinject.hh:89
void internalIntersect(vector< int4 > &parentMap)
Calculate intersection of a new Varnode path with the old path.
Definition: jumptable.cc:750
SubtableSymbol * root
The root SLEIGH decoding symbol.
Definition: sleighbase.hh:34
EntrySubsort subsorttype
The sub-sort object for a rangemap.
Definition: database.hh:112
list< BlockTrace * >::iterator activeiter
Position of this in the active trace list.
Definition: blockaction.hh:132
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2102
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2552
static int4 last_languageindex
Index of the LanguageDescription associated with the last Translate object.
Definition: sleigh_arch.hh:91
virtual const string & getName(void) const
Get the name of the parameter ("" for return value)
Definition: fspec.cc:2310
UserOpManage userops
Specifically registered user-defined p-code ops.
Definition: architecture.hh:153
virtual void pushAnnotation(const Varnode *vn, const PcodeOp *op)=0
Push an address which is not in the normal data-flow.
bool discoverZeroSlot(Varnode *vn)
Check if vn is produced by a 2-branch MULTIEQUAL, one side of which is a zero constant.
Definition: condexe.cc:887
CPUI_INT_SRIGHT behavior.
Definition: opbehavior.hh:277
virtual void getUserOpNames(vector< string > &res) const
Get a list of all user-defined pcode ops.
Definition: ghidra_translate.cc:88
BfdArchitectureCapability(void)
Singleton constructor.
Definition: bfd_arch.cc:23
TypeOpEqual(TypeFactory *t)
Constructor.
Definition: typeop.cc:810
void forceNoUse(ParamActive *active, int4 start, int4 stop) const
Mark every trial above the first "definitely not used" as inactive.
Definition: fspec.cc:739
RangeList uselimit
Code address ranges where this storage is valid.
Definition: database.hh:59
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:455
@ is_inline
Should this be inlined (within calling function) by decompiler.
Definition: fspec.hh:1152
void reconcileDatatypes(void)
Decide on data-type for RangeHints at the same address.
Definition: varmap.cc:762
int4 beginBlock(const FlowBlock *b)
Create a "begin control-flow element" command.
Definition: prettyprint.hh:377
Remove conditional branches if the condition is constant.
Definition: coreaction.hh:512
istream & sin
Input stream for interfacing with Ghidra.
Definition: ghidra_arch.hh:61
@ rtyp_b
Start of a return type declaration.
Definition: prettyprint.hh:301
virtual void printTree(ostream &s, int4 level) const
Print tree structure of any blocks owned by this.
Definition: block.cc:1216
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1295
Varnode * truncatePointer(AddrSpace *spc, PcodeOp *op, Varnode *vn, int4 slot, Funcdata &data)
Truncate pointer Varnode being read by given PcodeOp.
Definition: ruleaction.cc:7483
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:758
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:1623
@ keyword_color
Keyword in the high-level language.
Definition: prettyprint.hh:88
bool updateType(Varnode *vn) const
Update a Varnode data-type from this.
Definition: database.cc:111
void totalReplaceConstant(Varnode *vn, uintb val)
Replace every read reference of the given Varnode with a constant value.
Definition: funcdata_varnode.cc:1227
virtual int4 beginFunction(const Funcdata *fd)
Begin a whole declaration and body of a function.
Definition: prettyprint.cc:44
SegmentOp * getSegmentOp(int4 i) const
Definition: userop.hh:277
bool isUnaffectedStorage(Varnode *vn) const
Is this a storage location for unaffected registers.
Definition: varmap.hh:206
vector< int4 > lanePosition
Significance positions of lanes in bytes.
Definition: transform.hh:129
list< PcodeOp * > alivelist
List of alive PcodeOps.
Definition: op.hh:248
bool transferLockedInput(vector< Varnode * > &newinput)
List and/or create a Varnode for each input parameter of this prototype.
Definition: fspec.cc:4166
Try to detect and split artificially joined Varnodes.
Definition: ruleaction.hh:1253
InjectCallotherGhidra(const string &src, const string &nm)
Constructor.
Definition: inject_ghidra.cc:89
uint4 uniqueId
Unique id for the scope, for deduping scope names, assigning symbol ids.
Definition: database.hh:427
bool inlineFlow(Funcdata *inlinefd, FlowInfo &flow, PcodeOp *callop)
In-line the p-code from another function into this function.
Definition: funcdata_op.cc:806
A symbol name recommendation with its associated storage location.
Definition: varmap.hh:29
bool aggressive_ext_trim
Aggressively trim inputs that look like they are sign extended.
Definition: architecture.hh:127
Symbol and Scope objects for the decompiler.
virtual void docAllGlobals(void)=0
Emit declarations of global variables.
static const char * highlight[]
Map from syntax_highlight enumeration to color attribute string.
Definition: prettyprint.hh:77
void emitCommentGroup(const PcodeOp *inst)
Emit comments associated with a given statement.
Definition: printc.cc:2774
void buildOutputFromTrials(Funcdata &data, vector< Varnode * > &trialvn)
Set the final output Varnode of this CALL based on ParamActive analysis of trials.
Definition: fspec.cc:4792
Alter the "structure alignment" data organization setting.
Definition: options.hh:111
uint4 mask
Collection being iterated over.
Definition: transform.hh:94
uintb first
Offset of first byte in this Range.
Definition: address.hh:164
void setDestructor(bool val)
Toggle whether this prototype is a destructor method.
Definition: fspec.hh:1262
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4773
virtual ~RawLoadImage(void)
RawLoadImage destructor.
Definition: loadimage.cc:46
static void buildRefinement(vector< int4 > &refine, const Address &addr, int4 size, const vector< Varnode * > &vnlist)
Build a refinement array given an address range and a list of Varnodes.
Definition: heritage.cc:1295
virtual PcodeInjectLibrary * buildPcodeInjectLibrary(void)
Build the injection library.
Definition: ghidra_arch.cc:287
virtual void closeSymbols(void) const
Stop reading symbols.
Definition: loadimage.hh:140
virtual Datatype * clone(void) const =0
Clone the data-type.
TypeOpPtradd(TypeFactory *t)
Constructor.
Definition: typeop.cc:1610
vector< ValueSet * > nodeStack
Stack used to generate the topological ordering.
Definition: rangeutil.hh:294
PcodeOp * transferLockedOutputParam(ProtoParameter *param)
Definition: fspec.cc:4134
virtual uintb getVarnodeValue(Varnode *vn) const =0
Given a specific Varnode, retrieve the current value for it from the machine state.
Eliminate INT_2COMP: -V => V * -1
Definition: ruleaction.hh:649
UniqueSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind, uint4 fl)
Constructor.
Definition: space.cc:436
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:914
virtual int4 determineIterationReset(const ValueSet &valueSet)
Upon entering a fresh partition, determine how the given ValueSet count should be reset.
Definition: rangeutil.cc:1819
bool isDecisionOut(int4 i) const
Can this and the i-th output be merged into a BlockIf or BlockList.
Definition: block.hh:243
virtual MapIterator end(void) const
Ending iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:95
virtual void buildLabels(Funcdata *fd, vector< Address > &addresstable, vector< uintb > &label, const JumpModel *orig) const
Recover case labels associated with the Address table.
Definition: jumptable.cc:1858
bool startTypeRecovery(void)
Mark that data-type analysis has started.
Definition: funcdata.cc:154
@ merged_node
Node has already been merged.
Definition: heritage.hh:175
TypeOpIntZext(TypeFactory *t)
Constructor.
Definition: typeop.cc:924
Varnode * in1
Second input.
Definition: ruleaction.hh:1357
bool operator<(const IndexPair &op2) const
Compare by position then by index.
Definition: jumptable.hh:572
Information about the RETURN op-code.
Definition: typeop.hh:292
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: inject_ghidra.cc:94
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:1576
int4 num
Number of entries in table;.
Definition: jumptable.hh:45
uintb value
Value of the constant being equated.
Definition: database.hh:271
virtual bool foldInGuards(Funcdata *fd, JumpTable *jump)
Eliminate any guard code involved in computing the switch destination.
Definition: jumptable.hh:450
string archid
ID string uniquely describing this architecture.
Definition: architecture.hh:119
AddrSpace * getDefaultDataSpace(void) const
Get the default address space where data is stored.
Definition: translate.hh:499
map< string, UserPcodeOp * > useropmap
A map from the name of the user defined operation to a description object.
Definition: userop.hh:252
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:867
void setNumInputs(int4 num)
Make sure this op has num inputs.
Definition: op.cc:190
Commute INT_AND with INT_LEFT and INT_RIGHT: (V << W) & d => (V & (W >> c)) << c
Definition: ruleaction.hh:318
Toggle whether cast syntax is emitted by the decompiler or stripped.
Definition: options.hh:141
uint4 flags
Boolean properties of the parameter.
Definition: fspec.hh:62
void gatherUnmarkedOp(void)
Mark any new PcodeOps in the sub-graph.
Definition: dynamic.cc:179
static vector< ArchitectureCapability * > thelist
The list of registered extensions.
Definition: architecture.hh:73
void rename(void)
Perform the renaming algorithm for the current set of address ranges.
Definition: heritage.cc:2145
Varnode * getInputVarnode(void) const
Find (the) input member Varnode.
Definition: variable.cc:399
virtual int4 instructionLength(const Address &baseaddr) const
Get the length of a machine instruction.
Definition: sleigh.cc:592
EmitPrettyPrint(int4 mls)
Construct with an initial maximum line size.
Definition: prettyprint.cc:539
virtual void saveXml(ostream &s) const
Save this Symbol to an XML stream.
Definition: database.cc:729
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1683
void cloneGroup(const string &oldname, const string &newname)
Clone a root Action.
Definition: action.cc:1036
virtual void truncate(int4 nm)=0
Truncate the number of values to the given number.
@ constant
The varnode is constant.
Definition: varnode.hh:72
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1297
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2150
virtual void fillinMap(ParamActive *active) const =0
Given an unordered list of storage locations, calculate a function prototype.
vector< string * > name
List of names for each formal XML attribute.
Definition: xml.hh:40
virtual void opFloatRound(const PcodeOp *op)=0
Emit a FLOAT_ROUND operator.
virtual bool isTypeLocked(void) const
Is the parameter data-type locked.
Definition: fspec.cc:2334
void clearFlags(uint4 fl)
Clear a cached attribute.
Definition: space.hh:255
virtual void addSymbolInternal(Symbol *sym)=0
Put a Symbol into the name map.
void renameRecurse(BlockBasic *bl, VariableStack &varstack)
The heart of the renaming algorithm.
Definition: heritage.cc:2036
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7698
void deleteSubScopes(Scope *scope)
Delete all sub-scopes of the given Scope.
Definition: database.cc:2826
virtual void pushConstant(uintb val, const Datatype *ct, const Varnode *vn, const PcodeOp *op)
Push a constant onto the RPN stack.
Definition: printc.cc:1401
@ type_finalized
Set if a final data-type is locked in and dirtying is disabled.
Definition: variable.hh:53
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: action.cc:512
int4 rootPos
The iterator position for the simulated root node.
Definition: rangeutil.hh:281
void unzip(linetype i, typename std::multiset< AddrRange >::iterator iter)
Insert the given partition boundary.
Definition: rangemap.hh:195
An injection context that can be serialized and sent to the Ghidra client.
Definition: inject_ghidra.hh:29
virtual void printRaw(ostream &s, uintb offset) const
Definition: space.cc:370
map< uintb, uint1 * > page
Overlayed pages.
Definition: memstate.hh:112
virtual bool isZextCast(Datatype *outtype, Datatype *intype) const
Is zero-extending an input data-type, producing an output data-type, considered a cast.
Definition: cast.cc:353
virtual void printState(ostream &s) const
Print status to stream.
Definition: action.cc:427
int4 injectUponEntry
Id of injection to perform at beginning of function (-1 means not used)
Definition: fspec.hh:624
uint4 injectid
The id of the injection object (to which this op maps)
Definition: userop.hh:84
void setDoublePrecisRecovery(bool val)
Toggle whether double precision analysis is used.
Definition: funcdata.hh:148
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:239
static void replaceDescendants(Varnode *origVn, Varnode *newVn, int4 maxByte, int4 minByte, Funcdata &data)
Definition: ruleaction.cc:768
virtual void restoreFromSpec(const Element *el, const AddrSpaceManager *manage)
Add initial context state from XML tags in compiler/processor specifications.
Definition: globalcontext.cc:539
Varnode * vn
Varnode whose set this represents.
Definition: rangeutil.hh:135
Varnode searchvn
Template varnode for searching trees.
Definition: varnode.hh:333
int4 size
Number of bytes in the instruction.
Definition: flow.hh:77
The interface to a translation engine for a processor.
Definition: translate.hh:293
@ type_t
A data-type identifier.
Definition: prettyprint.hh:312
FlowBlock * findLevelBlock(int4 index) const
Find the FlowBlock matching the given index.
Definition: block.hh:701
virtual int4 beginFuncProto(void)
Begin a function prototype declaration.
Definition: prettyprint.hh:237
bool trial(BlockBasic *ib)
Test for a modifiable configuration around the given block.
Definition: condexe.cc:771
CircleRange range
Range of values or offsets in this set.
Definition: rangeutil.hh:181
virtual uintb restoreXmlAttributes(const Element *el, uint4 &size) const
Recover an offset and size.
Definition: space.cc:148
FlowBlock * extract(void)
Retrieve the highest priority block.
Definition: heritage.cc:121
virtual Address getAddress(void) const
Get the storage address for this parameter.
Definition: fspec.hh:974
string fieldname
The name of the field.
Definition: printc.hh:49
void setIsolated(bool val)
Set whether this Symbol should be speculatively merged.
Definition: database.cc:238
bool isContiguous(int4 sz, const Address &loaddr, int4 losz) const
Does this form a contigous range with loaddr.
Definition: address.cc:167
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1617
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:281
void populateResolver(void)
Build the ParamEntry resolver maps.
Definition: fspec.cc:836
virtual void executeUnary(void)
Execute a unary arithmetic/logical operation.
Definition: emulateutil.cc:45
int4 position
Position of the ParamEntry within the entire prototype list.
Definition: fspec.hh:107
@ p_standard_out
Standard output (return value) model.
Definition: fspec.hh:343
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1225
virtual void opIntLess(const PcodeOp *op)=0
Emit a INT_LESS operator.
virtual void executeSegmentOp(void)
Behavior for a SEGMENTOP.
Definition: emulate.cc:308
Symbol * addDynamicSymbol(const string &nm, Datatype *ct, const Address &caddr, uint8 hash)
Create a dynamically mapped Symbol attached to a specific data-flow.
Definition: database.cc:1630
@ TYPE_STRUCT
Structure data-type, made up of component datatypes.
Definition: type.hh:45
virtual int4 print(ostream &s, int4 num, int4 depth) const
Print a description of this Action to stream.
Definition: action.cc:411
void clearDeadVarnodes(void)
Delete any dead Varnodes.
Definition: funcdata_varnode.cc:696
A standard model for parameters as an ordered list of storage resources.
Definition: fspec.hh:491
Heritage(Funcdata *data)
Constructor.
Definition: heritage.cc:135
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:857
void doScore(void)
Compute the fitness score.
Definition: fspec.cc:2081
int4 offset
The offset (within the parent structure) for a field token.
Definition: printlanguage.hh:204
const PcodeOp * op
The PcodeOp associated with the operator token.
Definition: printlanguage.hh:170
A Symbol representing an executable function.
Definition: database.hh:251
virtual const uintm * getDefaultValue(void) const
Retrieve the memory region holding all default context values.
Definition: globalcontext.hh:285
A high-level variable modeled as a list of low-level variables, each written once.
Definition: variable.hh:38
void restoreXml(const Element *el)
Recover the whole database from XML.
Definition: database.cc:3076
Varnode * constructBool(PcodeOp *insertop, Funcdata &data)
Construct the expression after the merge.
Definition: ruleaction.cc:7854
virtual void executeNew(void)
Standard behavior for (low-level) NEW op.
Definition: emulateutil.cc:276
Special Datatype object used to describe pointers that index into the symbol table.
Definition: type.hh:356
TypeOpIntSext(TypeFactory *t)
Constructor.
Definition: typeop.cc:950
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2539
string source
Source description to associate with the payload.
Definition: inject_ghidra.hh:40
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1569
@ spac_t
White space.
Definition: prettyprint.hh:321
void saveXml(ostream &s) const
Save a description of this as an XML tag.
Definition: varnode.cc:820
@ auto_live
Is this varnode automatically considered live, never removed as dead-code.
Definition: varnode.hh:108
virtual int4 getCategorySize(int4 cat) const
Get the number of Symbols in the given category.
Definition: database_ghidra.hh:112
ostream * errorstream
Error stream associated with this SleighArchitecture.
Definition: sleigh_arch.hh:99
bool needbreak
true if break needed before next token
Definition: prettyprint.hh:710
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:381
The PcodeOp and PcodeOpBank classes.
void tagLabel(const char *ptr, EmitXml::syntax_highlight h, const AddrSpace *s, uintb o)
Create a code label identifier token.
Definition: prettyprint.hh:503
vector< Address > multistagejump
Addresses of indirect jumps that need multistage recovery.
Definition: override.hh:55
@ rtyp_e
End of a return type declaration.
Definition: prettyprint.hh:302
void onlyReachableFromRoot(FlowBlock *root, vector< FlowBlock * > &body)
Mark FlowBlocks only reachable from a given root.
Definition: blockaction.cc:1045
Utility for implementing a constant pool backed by a Ghidra client.
int4 zeroSlot
Input slot containing path that sets zero.
Definition: condexe.hh:215
Interface for requesting data-type information from a Ghidra client.
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:591
virtual void buildLoader(DocumentStorage &store)
Build the LoadImage object and load the executable image.
Definition: ghidra_arch.cc:281
bool operator==(const CircleRange &op2) const
Equals operator.
Definition: rangeutil.hh:329
bool instruction_start
true if next pcode op is start of instruction
Definition: emulate.hh:303
uintm uniq
Starting offset for defining temporaries in unique space.
Definition: emulate.hh:282
virtual CPoolRecord * createRecord(const vector< uintb > &refs)=0
Allocate a new CPoolRecord object, given a reference to it.
void opUnlink(PcodeOp *op)
Unset inputs/output and remove given PcodeOP from its basic block.
Definition: funcdata_op.cc:177
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5132
int4 offset
Starting offset of the portion of the Symbol being covered.
Definition: database.hh:72
MemoryBank * underlie
Underlying memory object.
Definition: memstate.hh:111
uint4 sizeBitMask
A 1-bit for every permissible lane size.
Definition: transform.hh:108
BlockIf * newBlockIfGoto(FlowBlock *cond)
Build a new BlockIfGoto.
Definition: block.cc:1692
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6073
virtual void removeRange(AddrSpace *spc, uintb first, uintb last)
Remove a memory range from the ownership of this Scope.
Definition: database.cc:1046
bool aggressive
Do we "know" initial seed point must be a sub variable.
Definition: subflow.hh:83
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:184
void markFoldableGuards()
Mark the guard CBRANCHs that are truly part of the model.
Definition: jumptable.cc:1202
virtual void printTemplate(ostream &s) const
Print the p-code ops of the injection to a stream (for debugging)
Definition: inject_ghidra.cc:72
void calcHash(const Varnode *root, uint4 method)
Calculate the hash for given Varnode and method.
Definition: dynamic.cc:210
@ NONE
No override.
Definition: override.hh:44
virtual void fallthruOp(void)=0
Standard p-code fall-thru semantics.
static uint4 transtable[]
Translation of op-codes to hash values.
Definition: dynamic.hh:94
AddrSpace * spaceid
The address space being analyzed.
Definition: varmap.hh:146
static uintb constructValue(const uint1 *ptr, int4 size, bool bigendian)
Decode bytes to value.
Definition: memstate.cc:25
A context blob, holding context values across some range of code addresses.
Definition: globalcontext.hh:263
printclass
An enumeration denoting the general class of a token.
Definition: prettyprint.hh:281
Command to register a new Program (executable) with the decompiler.
Definition: ghidra_process.hh:102
void saveBasicAttributes(ostream &s) const
Write the XML attributes of this space.
Definition: space.cc:87
Emulate * emulate
The emulator currently associated with this breakpoint.
Definition: emulate.hh:79
Address getUsePoint(const Funcdata &fd) const
Get Address when this Varnode first comes into scope.
Definition: varnode.cc:589
void discoverPathIsTrue(void)
Does the condBlock true outgoing edge flow to the block that sets zero.
Definition: condexe.cc:950
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:283
@ fnam_t
A function identifier.
Definition: prettyprint.hh:311
CircleRange range
Range of values causing the CBRANCH to take the path to the switch.
Definition: jumptable.hh:134
uint8 symbolId
Unique id, 0=unassigned.
Definition: database.hh:168
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:660
Toggle a sub-group of actions within a root Action.
Definition: options.hh:201
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: translate.cc:105
virtual void pushMismatchSymbol(const Symbol *sym, int4 off, int4 sz, const Varnode *vn, const PcodeOp *op)=0
Push an identifier for a variable that mismatches with its Symbol.
virtual void opPtradd(const PcodeOp *op)
Emit a PTRADD operator.
Definition: printc.cc:649
@ fallthru_true
Set if fallthru happens on true condition.
Definition: op.hh:78
bool ruleBlockDoWhile(FlowBlock *bl)
Attempt to apply the BlockDoWhile structure.
Definition: blockaction.cc:1535
void insertRange(AddrSpace *spc, uintb first, uintb last)
Insert a range of addresses.
Definition: address.cc:317
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:527
OpCode getOpcode(void) const
Get the opcode for this pcode operation.
Definition: opbehavior.hh:103
int4 multislot
Input slot of MULTIEQUAL on critical path, -1 if no MULTIEQUAL.
Definition: condexe.hh:48
void parseDynamicRule(const Element *el)
Apply details of a dynamic Rule object.
Definition: architecture.cc:691
static void registerInstructions(vector< TypeOp * > &inst, TypeFactory *tlst, const Translate *trans)
Build a map from op-code value to the TypeOp information objects.
Definition: typeop.cc:23
map< uintb, uintb > tempValues
Values stored in temporary registers.
Definition: emulateutil.hh:115
virtual void buildSpecFile(DocumentStorage &store)=0
Load any relevant specification files.
ostream * s
Stream being emitted to.
Definition: prettyprint.hh:79
virtual void adjustTypeOperators(void)
Set basic data-type information for p-code operators.
Definition: printc.cc:1934
virtual void clearAllInputs(void)
Clear all input parameters (and any backing symbols)
Definition: fspec.cc:2646
BreakCallBack(void)
Generic breakpoint constructor.
Definition: emulate.hh:90
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:331
bool processNextWork(void)
Push the trace one hop from the placeholder at the top of the worklist.
Definition: subflow.cc:1938
void splitByRefinement(Varnode *vn, const Address &addr, const vector< int4 > &refine, vector< Varnode * > &split)
Split up a Varnode by the given refinement.
Definition: heritage.cc:1324
void foldIn(const ParamListStandard &op2)
Add another model to the union.
Definition: fspec.cc:1256
virtual void executeNew(void)
Standard behavior for (low-level) NEW op.
Definition: emulate.cc:320
void updateCover(void) const
(Re)derive the cover of this from the member Varnodes
Definition: variable.cc:82
uintb minimumOffset
Minimum offset of the LOAD.
Definition: heritage.hh:110
virtual bool foldInOneGuard(Funcdata *fd, GuardRecord &guard, JumpTable *jump)
Eliminate the given guard to this switch.
Definition: jumptable.cc:1249
A trivial jump-table model, where the BRANCHIND input Varnode is the switch variable.
Definition: jumptable.hh:322
PcodeOp * startop
First PcodeOp in the jump-table calculation.
Definition: jumptable.hh:181
void injectUserOp(PcodeOp *op)
Perform injection for a given user-defined p-code op.
Definition: flow.cc:1195
int4 max_implied_ref
Maximum number of references to an implied var.
Definition: architecture.hh:123
Information about the FLOAT_SQRT op-code.
Definition: typeop.hh:622
Information about the BOOL_XOR op-code.
Definition: typeop.hh:524
A class for manipulating integer value ranges.
Definition: rangeutil.hh:48
virtual const ContextBitRange & getVariable(const string &nm) const
Retrieve the context variable description object by name.
Definition: ghidra_context.hh:36
virtual void getRegionToChangePoint(vector< uintm * > &res, const Address &addr, int4 num, uintm mask)
Grab the context blob(s) starting at the given address up to the first point of change.
Definition: ghidra_context.hh:40
@ unref
There is no direct reference to this parameter trial.
Definition: fspec.hh:164
PcodeOp * op
Lone descendant reading the term.
Definition: coreaction.hh:1039
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3653
int4 wordsize
Number of bytes in an aligned word access.
Definition: memstate.hh:39
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: coreaction.hh:938
A basic jump-table model incorporating manual override information.
Definition: jumptable.hh:425
bool needsfinalcheck
Should a final pass be made on trials (to take into account control-flow changes)
Definition: fspec.hh:230
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3250
CPUI_FLOAT_MULT behavior.
Definition: opbehavior.hh:404
virtual void setDisplayFormat(Symbol *sym, uint4 attr)=0
Set the display format for a Symbol.
Address nextaddr
Address of following instruction.
Definition: pcodeinject.hh:60
static void scanForSleighDirectories(const string &rootpath)
Scan directories for SLEIGH specification files.
Definition: sleigh_arch.cc:422
int4 terminatorCount
Number of terminating nodes reachable via the root.
Definition: subflow.hh:152
virtual void executeUnary(void)
Execute a unary arithmetic/logical operation.
Definition: emulate.cc:216
HighVariable * b
Second HighVariable of the pair.
Definition: merge.hh:32
list< PcodeOp * >::const_iterator beginOp(OpCode opc) const
Start of PcodeOp objects with the given op-code.
Definition: funcdata.hh:449
int4 inslot
Slot holding Varnode for descendant PcodeOp.
Definition: coreaction.hh:1030
void step(void)
Advance to the next propagation edge.
Definition: coreaction.cc:4391
static OpToken function_call
The function call operator.
Definition: printc.hh:70
void trivialSwitchOver(void)
Switch this table over to a trivial model.
Definition: jumptable.cc:2420
std::map< _linetype, _valuetype > maptype
Defining the map from split points to value objects.
Definition: partmap.hh:50
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:418
static PcodeOp * getOpFromConst(const Address &addr)
Retrieve the PcodeOp encoded as the address addr.
Definition: op.hh:227
TypeOpFloatFloat2Float(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1447
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:347
@ ptrflow
Op consumes or produces a ptr.
Definition: op.hh:99
bool defaultswitch
True if one of the unstructured edges is the formal switch default edge.
Definition: block.hh:470
virtual void tagVariable(const char *ptr, syntax_highlight hl, const Varnode *vn, const PcodeOp *op)
Emit a variable token.
Definition: prettyprint.cc:157
CapabilityPoint(void)
Construct extension capability exactly once.
Definition: capability.cc:31
virtual void opFloatFloor(const PcodeOp *op)
Emit a FLOAT_FLOOR operator.
Definition: printc.hh:280
void buildType(void)
Build placeholder data-type.
Definition: database.cc:666
virtual void restoreXml(const Element *el)
Restore this Scope from a <scope> XML tag.
Definition: database_ghidra.hh:110
void emitStatement(const PcodeOp *inst)
Emit a statement in the body of a function.
Definition: printc.cc:1894
Simplify INT_SLESS applied to 0 or -1.
Definition: ruleaction.hh:964
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:181
bool operator<(const EntrySubsort &op2)
Compare this with another sub-sort.
Definition: database.hh:105
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1750
virtual int4 print(ostream &s, int4 num, int4 depth) const
Print a description of this Action to stream.
Definition: action.cc:130
Varnode * newCodeRef(const Address &m)
Create a code address annotation Varnode.
Definition: funcdata_varnode.cc:211
JoinRecord * findAddJoin(const vector< VarnodeData > &pieces, uint4 logicalsize)
Get (or create) JoinRecord for pieces.
Definition: translate.cc:604
A name recommendation for a particular dynamic storage location.
Definition: varmap.hh:49
Action * currentact
This is the current root Action.
Definition: action.hh:295
A memory bank that implements reads and writes using a hash table.
Definition: memstate.hh:128
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)
Attempt to recover details of the model, given a specific BRANCHIND.
Definition: jumptable.cc:1824
virtual int4 manualCallFixup(const string &name, const string &snippet)
Manually add a call-fixup payload given a compilable snippet of p-code source.
Definition: inject_ghidra.cc:210
static void buildReturnOutput(ParamActive *active, PcodeOp *retop, Funcdata &data)
Rewrite a CPUI_RETURN op to reflect a recovered output parameter.
Definition: coreaction.cc:1749
virtual void retypeSymbol(Symbol *sym, Datatype *ct)
Change the data-type of a Symbol within this Scope.
Definition: database_ghidra.hh:107
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:214
void updateInputTypes(const vector< Varnode * > &triallist, ParamActive *activeinput)
Update input parameters based on Varnode trials.
Definition: fspec.cc:3184
virtual void getReadonly(RangeList &list) const
Return list of readonly address ranges.
Definition: loadimage_xml.cc:246
Algorithm for selecting unstructured edges based an Directed Acyclic Graphs (DAG)
Definition: blockaction.hh:94
Toggle whether read-only memory locations have their value propagated.
Definition: options.hh:81
bool hasThisPointer(void) const
Is this a prototype for a class method, taking a this pointer.
Definition: fspec.hh:1241
int4 step
Step of any access into this range (0=unknown)
Definition: heritage.hh:112
BfdArchitectureCapability & operator=(const BfdArchitectureCapability &op2)
Not implemented.
int4 siblingedge
Number of active BlockTraces with same BranchPoint and exit as this.
Definition: blockaction.hh:149
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:731
AddrSpaceManager * manage
Manager for processor using this space.
Definition: space.hh:95
TypeCode(const TypeCode &op)
Construct from another TypeCode.
Definition: type.cc:937
@ negatetoken
Print the token representing the negation of current token.
Definition: printlanguage.hh:151
virtual string genericTypeName(const Datatype *ct)
Generate a generic name for an unnamed data-type.
Definition: printc.cc:2888
string warnings
Warnings accumulated by the decompiler.
Definition: ghidra_arch.hh:63
PrintCCapability & operator=(const PrintCCapability &op)
Not implemented.
bool isunary
true= use unary interfaces, false = use binary
Definition: opbehavior.hh:44
const Range * getFirstRange(void) const
Get the first Range.
Definition: address.cc:474
Convert STORE operations using a constant offset to COPY.
Definition: ruleaction.hh:723
void restoreXml(const Element *el)
Read the XML tag from stream.
Definition: sleigh_arch.cc:37
virtual MapIterator begin(void) const
Beginning iterator to mapped SymbolEntrys.
Definition: database.cc:1776
int4 slot
Current edge relative to current PcodeOp.
Definition: coreaction.hh:1031
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:435
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:683
@ CPUI_INT_CARRY
Test for unsigned carry.
Definition: opcodes.hh:62
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:4627
virtual SymbolEntry * addDynamicMapInternal(Symbol *sym, uint4 exfl, uint8 hash, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a dynamic hash.
Definition: database_ghidra.hh:54
virtual void closeParen(char c, int4 id)
Emit a close parenthesis.
Definition: prettyprint.cc:1082
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1175
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:687
virtual TrackedSet & createSet(const Address &addr1, const Address &addr2)
Create a tracked register set that is valid over the given range.
Definition: ghidra_context.hh:69
int4 id2
The id of the token group this surrounds (for surround operator tokens)
Definition: printlanguage.hh:172
An exception thrown by the XML parser.
Definition: xml.hh:288
Varnode * switchvn
Unnormalized switch Varnode.
Definition: jumptable.hh:351
virtual void flipInPlaceExecute(void)
Perform the flip to normalize conditional branch executed by this block.
Definition: block.hh:753
void pushEnumConstant(uintb val, const TypeEnum *ct, const Varnode *vn, const PcodeOp *op)
Push an enumerated value to the RPN stack.
Definition: printc.cc:1325
virtual list< SymbolEntry >::const_iterator endDynamic(void) const =0
Ending iterator to dynamic SymbolEntrys.
FlowBlock * createBlock(const string &name)
Create a FlowBlock of the named type.
Definition: block.cc:3241
A loop structure where the condition is checked at the top.
Definition: block.hh:583
string nullToken
Token to use for 'null'.
Definition: printc.hh:121
virtual void tagOp(const char *ptr, syntax_highlight hl, const PcodeOp *op)
Emit an operation token.
Definition: prettyprint.hh:242
VarnodeLocSet::iterator lociter
Iterator into VarnodeBank sorted by location.
Definition: varnode.hh:135
static void saveVarnodeXml(ostream &s, VarnodeLocSet::const_iterator iter, VarnodeLocSet::const_iterator enditer)
Save XML descriptions for a set of Varnodes to stream.
Definition: funcdata.cc:593
virtual void push_integer(uintb val, int4 sz, bool sign, const Varnode *vn, const PcodeOp *op)
Push a constant with an integer data-type to the RPN stack.
Definition: printc.cc:994
void addDefPoint(const Varnode *vn)
Reset to the single point where the given Varnode is defined.
Definition: cover.cc:440
Make sure pointers into segmented spaces have the correct form.
Definition: coreaction.hh:121
virtual void opFloatFloor(const PcodeOp *op)=0
Emit a FLOAT_FLOOR operator.
void parseReadOnly(const Element *el)
Apply read-only region configuration.
Definition: architecture.cc:833
uint4 create_index
Number of varnodes created.
Definition: varnode.hh:330
virtual int4 getNumInputs(void) const
Get the number of input parameters for this prototype.
Definition: fspec.cc:2529
void tagFuncName(const char *ptr, EmitXml::syntax_highlight h, const Funcdata *f, const PcodeOp *o)
Create a function identifier token.
Definition: prettyprint.hh:463
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:882
static void moveSignBitExtraction(Varnode *firstVn, Varnode *replaceVn, Funcdata &data)
Replace sign-bit extractions from the first given Varnode with the second Varnode.
Definition: ruleaction.cc:6903
virtual int4 beginStatement(const PcodeOp *op)
Begin a source code statement.
Definition: prettyprint.cc:961
uint4 extraflags
Varnode flags specific to this storage location.
Definition: database.hh:54
virtual int4 beginDocument(void)
Begin a whole document of output.
Definition: prettyprint.cc:31
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1245
uint8 symbolId
Id associated with the original Symbol.
Definition: varmap.hh:53
virtual void buildAddresses(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable, vector< LoadTable > *loadpoints) const
Construct the explicit list of target addresses (the Address Table) from this model.
Definition: jumptable.cc:388
Core decompilation actions which are indepedent of any particular architecture.
vector< InjectParameter > inputlist
List of input parameters to this payload.
Definition: pcodeinject.hh:92
bool replaceVolatile(Varnode *vn)
Replace accesses of the given Varnode with volatile operations.
Definition: funcdata_varnode.cc:587
list< FloatingEdge > exitedges
Edges that exit to the formal exit block.
Definition: blockaction.hh:50
BlockGraph & bblocks
Container for the control-flow graph.
Definition: flow.hh:82
static void propagateSpacebaseRef(Funcdata &data, Varnode *spcvn)
Search for pointers and propagate its data-type to known aliases.
Definition: coreaction.cc:4519
map< SeqNum, PcodeOp * > PcodeOpTree
A map from sequence number (SeqNum) to PcodeOp.
Definition: op.hh:236
bool returnsTraversed
Have we tried to flow logical value across CPUI_RETURNs.
Definition: subflow.hh:82
void destroyDescend(void)
Clear all descendant (reading) PcodeOps.
Definition: varnode.cc:317
int4 circleUnion(const CircleRange &op2)
Union two ranges.
Definition: rangeutil.cc:358
virtual void opFloatEqual(const PcodeOp *op)
Emit a FLOAT_EQUAL operator.
Definition: printc.hh:264
uintm uniq
Number to guarantee uniqueness.
Definition: address.hh:113
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:1781
@ has_thisptr
Function is a method with a 'this' pointer as an argument.
Definition: fspec.hh:1161
Definitions for specifying functions prototypes.
virtual bool pushEquate(uintb val, int4 sz, const EquateSymbol *sym, const Varnode *vn, const PcodeOp *op)=0
Push a constant marked up by and EquateSymbol onto the RPN stack.
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:395
static bool onOrOff(const string &p)
Parse an "on" or "off" string.
Definition: options.cc:25
int4 instruction_length
Length of current instruction in bytes.
Definition: emulate.hh:305
string variant
Name of processor variant or "default".
Definition: sleigh_arch.hh:53
tagtype type
The type of Atom.
Definition: printlanguage.hh:196
@ noreturn
placeholder for previous call that doesn't exit
Definition: op.hh:93
A contiguous range of bytes in some address space.
Definition: address.hh:161
Utilities for getting address-based context to the disassembler and decompiler.
virtual void tagFuncName(const char *ptr, syntax_highlight hl, const Funcdata *fd, const PcodeOp *op)
Emit a function identifier.
Definition: prettyprint.cc:1017
A record describing a section bytes in the executable.
Definition: loadimage.hh:44
Distribute INT_AND through INT_OR if result is simpler.
Definition: ruleaction.hh:278
bool checkActionBreak(void)
Check action breakpoint.
Definition: action.cc:115
virtual void opPtradd(const PcodeOp *op)=0
Emit a PTRADD operator.
virtual uintb find(uintb addr) const
Overridden aligned word find.
Definition: memstate.cc:448
void parseVolatile(const Element *el)
Apply volatile region configuration.
Definition: architecture.cc:849
@ CPUI_INT_SCARRY
Test for signed carry.
Definition: opcodes.hh:63
bool ruleBlockWhileDo(FlowBlock *bl)
Attempt to apply the BlockWhileDo structure.
Definition: blockaction.cc:1498
virtual string makeNameUnique(const string &nm) const
Produce a version of the given symbol name that won't collide with other names in this Scope.
Definition: database_ghidra.hh:108
virtual void opLoad(const PcodeOp *op)=0
Emit a LOAD operator.
virtual void getRegionForSet(vector< uintm * > &res, const Address &addr1, const Address &addr2, int4 num, uintm mask)=0
Grab the context blob(s) for the given address range, marking bits that will be set.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1748
void meld(vector< PcodeOp * > &path, vector< int4 > &slot)
Meld a new path into this container.
Definition: jumptable.cc:926
Set the number of characters to indent per nested scope.
Definition: options.hh:159
BlockSwitch(FlowBlock *ind)
Construct given the multi-exit root block.
Definition: block.cc:3014
AddrSpace * getStackSpace(void) const
Get the stack space for this processor.
Definition: translate.hh:469
void calcForwardDominator(const vector< FlowBlock * > &rootlist)
Calculate forward dominators.
Definition: block.cc:1847
SegmentOp * getSegmentOp(AddrSpace *spc) const
Retrieve the segment op for the given space if any.
Definition: architecture.cc:312
void setContextChangePoint(const Address &addr, int4 num, uintm mask, uintm value)
Set a specific context value starting at the given address.
Definition: globalcontext.cc:167
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2896
virtual void opPopcountOp(const PcodeOp *op)=0
Emit a POPCOUNT operator.
virtual Address resolve(uintb val, int4 sz, const Address &point, uintb &fullEncoding)=0
Virtual destructor
virtual void openSymbols(void) const
Prepare to read symbols.
Definition: loadimage.hh:133
virtual void fallthruOp(void)
Standard p-code fall-thru semantics.
Definition: jumptable.cc:164
virtual int4 beginFunction(const Funcdata *fd)
Begin a whole declaration and body of a function.
Definition: prettyprint.cc:865
TypeBase(const TypeBase &op)
Construct TypeBase copying properties from another data-type.
Definition: type.hh:163
void propagate(int4 varnum, int4 val)
Propagate solution for one variable to other variables.
Definition: coreaction.cc:64
virtual void opFloatNotEqual(const PcodeOp *op)
Emit a FLOAT_NOTEQUAL operator.
Definition: printc.hh:265
void injectPcode(void)
Perform substitution on any op that requires injection.
Definition: flow.cc:1290
Document * doc
The XML option document.
Definition: ghidra_process.hh:223
TypeFactory * tlst
Pointer to data-type factory.
Definition: typeop.hh:44
void zip(linetype i, typename std::multiset< AddrRange >::iterator iter)
Remove the given partition boundary.
Definition: rangemap.hh:176
@ processing_started
Set if processing has started.
Definition: funcdata.hh:50
Simplify INT_LESSEQUAL && INT_NOTEQUAL: V <= W && V != W => V < W
Definition: ruleaction.hh:428
void recoverModel(Funcdata *fd)
Attempt recovery of the jump-table model.
Definition: jumptable.cc:2085
Simply OR with unconsumed input: `V = A | B => V = B if nzm(A) & consume(V) == 0.
Definition: ruleaction.hh:131
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:574
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3685
VarnodeData baseOrig
Original base register before any truncation.
Definition: translate.hh:176
CPUI_INT_DIV behavior.
Definition: opbehavior.hh:292
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
FlowBlock * copymap
Back reference to a BlockCopy of this.
Definition: block.hh:110
A PcodeOp in the path set associated with the last Varnode in the intersection.
Definition: jumptable.hh:68
Eliminate INT_XOR in comparisons: (V ^ W) == 0 => V == W
Definition: ruleaction.hh:679
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:94
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:488
set< Datatype *, DatatypeCompare > DatatypeSet
A set of data-types sorted by function.
Definition: type.hh:150
PcodeOp * nodeSplitCloneOp(PcodeOp *op)
Duplicate the given PcodeOp as part of splitting a block.
Definition: funcdata_block.cc:761
vector< const Varnode * > markedVn
Holds visited Varnodes to properly trim cycles.
Definition: funcdata.hh:606
int4 paramshift
Number of input parameters to ignore before prototype.
Definition: fspec.hh:1444
ContextDatabase * database
The encapsulated context database.
Definition: globalcontext.hh:310
virtual void executeMultiequal(void)
Standard behavior for a MULTIEQUAL (phi-node)
Definition: emulateutil.cc:252
map< string, Action * > actionmap
Map from name to root Action.
Definition: action.hh:298
void defaultLocalRange(void)
Set the default stack range used for local variables.
Definition: fspec.cc:1677
A Symbol that labels code internal to a function.
Definition: database.hh:281
void collectLoadPoints(vector< LoadTable > &res) const
Recover any LOAD table descriptions.
Definition: jumptable.cc:223
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:468
void pushMultiequals(BlockBasic *bb)
Push MULTIEQUAL Varnodes of the given block into the output block.
Definition: funcdata_block.cc:82
TypeOpFloatNeg(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1419
CPUI_INT_SBORROW behavior.
Definition: opbehavior.hh:219
virtual void restoreFromSpec(const Element *el, const AddrSpaceManager *manage)
Add initial context state from XML tags in compiler/processor specifications.
Definition: ghidra_context.hh:55
void pushBranch(BlockBasic *bb, int4 slot, BlockBasic *bbnew)
Move a control-flow edge from one block to another.
Definition: funcdata_block.cc:398
virtual bool isSubpieceCastEndian(Datatype *outtype, Datatype *intype, uint4 offset, bool isbigend) const
Is the given data-type truncation considered a cast, given endianess concerns.
Definition: cast.cc:334
virtual void clearCategory(int4 cat)=0
Clear all symbols of the given category from this scope.
Choose names for all high-level variables (HighVariables)
Definition: coreaction.hh:458
virtual void printStatistics(ostream &s) const
Print statistics for this Rule.
Definition: action.cc:680
vector< StackEqn > eqs
Known equations based on operations that explicitly change the stack-pointer.
Definition: coreaction.cc:31
bool signbit_negative(uintb val, int4 size)
Return true if the sign-bit is set.
Definition: address.cc:579
int2 mergegroup
Which group of forced merges does this Varnode belong to.
Definition: varnode.hh:126
void generateRelativeConstraint(PcodeOp *compOp, PcodeOp *cbranch)
Try to find a relative constraint.
Definition: rangeutil.cc:2337
SubvariableFlow(Funcdata *f, Varnode *root, uintb mask, bool aggr, bool sext, bool big)
Constructor.
Definition: subflow.cc:1264
virtual void opStore(const PcodeOp *op)
Emit a STORE operator.
Definition: printjava.cc:208
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: blockaction.cc:2121
static LoopBody * find(FlowBlock *looptop, const vector< LoopBody * > &looporder)
Find a LoopBody.
Definition: blockaction.cc:1014
bool processNextWork(void)
Process the next Varnode on the work list.
Definition: subflow.cc:2452
bool possibleOutputParam(const Address &addr, int4 size) const
Decide whether a given storage location could be a return value.
Definition: fspec.cc:3471
virtual void opFloatDiv(const PcodeOp *op)
Emit a FLOAT_DIV operator.
Definition: printc.hh:270
virtual void opIntSrem(const PcodeOp *op)
Emit a INT_SREM operator.
Definition: printc.hh:259
Convert INT_SRIGHT form into INT_SDIV: (V + -1*(V s>> 31)) s>> 1 => V s/ 2
Definition: ruleaction.hh:1176
int4 getIndexByBlock(const FlowBlock *bl, int4 i) const
Get the index of the i-th address table entry that corresponds to the given basic-block.
Definition: jumptable.cc:2311
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6380
const vector< ValueSet * > * rootEdges
The list of nodes attached to the simulated root node (or NULL)
Definition: rangeutil.hh:280
int4 indentbump
Amount to indent if a line breaks.
Definition: prettyprint.hh:341
ConstantPoolGhidra(ArchitectureGhidra *g)
Constructor.
Definition: cpool_ghidra.cc:18
Base class (and interface) for pretty printing and XML markup of tokens.
Definition: prettyprint.hh:76
bool binon
True if a binary operator is used in condition.
Definition: condexe.hh:47
static bool adjustLoad(Funcdata &data, PcodeOp *loadop, PcodeOp *storeop)
Adjust the LOAD where the stack-pointer alias has been recovered.
Definition: coreaction.cc:350
void findBase(vector< FlowBlock * > &body)
Mark the body FlowBlocks of this loop.
Definition: blockaction.cc:112
virtual void opIntMult(const PcodeOp *op)=0
Emit a INT_MULT operator.
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:148
SymbolEntry * remapSymbol(Symbol *sym, const Address &addr, const Address &usepoint)
Change the primary mapping for the given Symbol to be a specific storage address and use point.
Definition: varmap.cc:1184
virtual void executeBranch(void)=0
Standard behavior for a BRANCH.
A resolver for segmented architectures.
Definition: architecture.hh:282
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7145
bool isCseMatch(const PcodeOp *op) const
Return true if this and op represent common subexpressions.
Definition: op.cc:154
uintb getValue(uintb offset, int4 size) const
Retrieve the value encoded in a (small) range of bytes.
Definition: memstate.cc:250
void restructureHigh(void)
Layout mapped symbols based on HighVariable information.
Definition: varmap.cc:1016
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1558
void setInline(bool val)
Toggle the in-line setting for functions with this prototype.
Definition: fspec.hh:1216
virtual ProtoStore * clone(void) const
Clone the entire collection of parameter descriptions.
Definition: fspec.cc:2693
Classes for emulating p-code.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:878
virtual bool isNameLocked(void) const
Is the parameter name locked.
Definition: fspec.cc:2340
TypeOpFloatSqrt(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1433
bool sendCcode
True if C code should be sent with function output.
Definition: ghidra_arch.hh:69
int4 printRawNoMarkup(ostream &s) const
Print a simple identifier for the Varnode.
Definition: varnode.cc:604
A basic "if" block.
Definition: block.hh:553
virtual void getPage(uintb addr, uint1 *res, int4 skip, int4 size) const
Overridden getPage.
Definition: memstate.cc:474
@ status_breakstarthit
At start after breakpoint.
Definition: action.hh:64
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:213
VarnodeLocSet::const_iterator beginLoc(AddrSpace *spaceid) const
Beginning of Varnodes in given address space sorted by location.
Definition: varnode.cc:1161
virtual void buildTypegrp(DocumentStorage &store)
Build the data-type factory/container.
Definition: ghidra_arch.cc:310
@ CPUI_FLOAT_ABS
Floating-point absolute value (abs)
Definition: opcodes.hh:98
Varnode * findLikelyNorm(void)
Find a potential normalized switch variable.
Definition: jumptable.cc:1778
int4 getResolutionDepth(const Scope *useScope) const
Get the number of scope names to print to resolve symbol in given context.
Definition: database.cc:304
Memory bank that overlays some other memory bank, using a "copy on write" behavior.
Definition: memstate.hh:110
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:644
Utilities for building Static Single Assignment (SSA) form
int4 position
Position (within the full list) being assigned to the ParamEntryRange.
Definition: fspec.hh:113
void mergeIndirect(PcodeOp *indop)
Force the merge of all input and output Varnodes to a given INDIRECT op.
Definition: merge.cc:767
void saveXmlHeader(ostream &s) const
Save basic Symbol properties as XML attributes.
Definition: database.cc:332
SymbolEntry * getMapEntry(const Address &addr) const
Get first mapping of the symbol that contains the given Address.
Definition: database.cc:263
Check for one CPUI_MULTIEQUAL input set defining more than one Varnode.
Definition: coreaction.hh:170
virtual bool checkIntPromotionForExtension(const PcodeOp *op) const
Check if integer promotion forces a cast for the input to the given extension.
Definition: cast.cc:47
bool isHeritaged(void) const
Return true if dataflow has been traced.
Definition: space.hh:385
bool hasNearPointers(void) const
Return true if near (truncated) pointers into this space are possible.
Definition: space.hh:439
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1117
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:1116
void buildType(void)
Build the data-type associated with this Symbol.
Definition: database.cc:520
virtual void spaces(int4 num, int4 bump=0)
Emit a sequence of space characters as part of source code.
Definition: prettyprint.cc:333
int4 blockPosition
Out-edge index for the basic-block.
Definition: jumptable.hh:502
int4 prea_inslot
iblock->In(prea_inslot) = pre a path
Definition: condexe.hh:136
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:319
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:483
void addGuard(const LoadGuard &guard, OpCode opc, TypeFactory *typeFactory)
Add LoadGuard record as a hint to the collection.
Definition: varmap.cc:805
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7152
virtual Varnode * getStartVarnode(void) const =0
Get the Varnode associated with the current value.
void issueWarning(Architecture *glb)
Warn that this Action has applied.
Definition: action.cc:39
string corespecxml
A specification of the core data-types.
Definition: ghidra_arch.hh:67
bool deadRemovalAllowedSeen(AddrSpace *spc)
Check if dead Varnodes have been removed for a specific address space.
Definition: funcdata.hh:231
virtual bool initializeForReading(void) const
Initialize this for iterating over the set of possible values.
Definition: jumptable.cc:280
type_metatype metain
The metatype of the input.
Definition: typeop.hh:174
bool traceBackward(TransformVar *rvn, int4 numLanes, int4 skipLanes)
Pull the logical lanes back through the defining PcodeOp of the given variable.
Definition: subflow.cc:2391
string getCallFixupName(int4 injectid) const
Get the call-fixup name associated with an id.
Definition: pcodeinject.cc:281
vector< OpBehavior * > inst
Map from OpCode to OpBehavior.
Definition: emulate.hh:300
virtual bool sanityCheck(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable)
Perform a sanity check on recovered addresses.
Definition: jumptable.hh:334
Varnode * findCoveredInput(int4 s, const Address &loc) const
Find an input Varnode contained within this range.
Definition: varnode.cc:1109
virtual void opMultiequal(const PcodeOp *op)=0
Emit a MULTIEQUAL operator.
Discover and eliminate split conditions.
Definition: blockaction.hh:232
int4 b_in2
In edge of exitb coming from block2.
Definition: blockaction.hh:248
void resolveJoin(void)
If the ParamEntry is initialized with a join address, cache the join record.
Definition: fspec.cc:19
@ CPUI_INSERT
Insert a bit-range.
Definition: opcodes.hh:123
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:284
vector< AddrSpace * > inferPtrSpaces
Set of address spaces in which a pointer constant is inferable.
Definition: architecture.hh:130
VarnodeBank(AddrSpaceManager *m, AddrSpace *uspace, uintm ubase)
Construct the container.
Definition: varnode.cc:842
map< Address, Address > forcegoto
Force goto on jump at targetpc to destpc.
Definition: override.hh:51
Collapse operations using identity element: V + 0 => V
Definition: ruleaction.hh:589
int4 heritagePass(const Address &addr) const
Get the pass number when the given address was heritaged.
Definition: heritage.hh:274
virtual int4 allocateInject(const string &sourceName, const string &name, int4 type)=0
Allocate a new InjectPayload object.
CPUI_FLOAT_EQUAL behavior.
Definition: opbehavior.hh:348
static AddrSpace * correctSpacebase(Architecture *glb, Varnode *vn, AddrSpace *spc)
Return associated space if given Varnode is an active spacebase.
Definition: ruleaction.cc:3834
virtual void pushTypeStart(const Datatype *ct, bool noident)
Definition: printjava.cc:54
void markInternalCopies(void)
Mark redundant/internal COPY PcodeOps.
Definition: merge.cc:1294
FlowBlock * selectGoto(void)
Select an edge to mark as unstructured.
Definition: blockaction.cc:1240
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:178
int4 maxdepth
Maximum depth of the dominator tree.
Definition: heritage.hh:208
static uint8 ID_BASE
Base of internal ID's.
Definition: database.hh:225
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:1000
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:400
vector< PcodeOp * > returnop
RETURN ops that have flow coming out of the iblock.
Definition: condexe.hh:145
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4568
static OpToken multequal
The in-place multiplication operator.
Definition: printc.hh:100
virtual void opIntSless(const PcodeOp *op)=0
Emit a INT_SLESS operator.
virtual SymbolEntry * findAddr(const Address &addr, const Address &usepoint) const =0
Find a Symbol at a given address and usepoint.
Address address
Start of function.
Definition: loadimage.hh:37
int4 doit(void)
Configure and execute the command, then send back results.
Definition: ghidra_process.cc:111
vector< int4 > laneSize
Size of lanes in bytes.
Definition: transform.hh:128
void markAlive(PcodeOp *op)
Mark the given PcodeOp as alive.
Definition: op.cc:752
int4 archid
Resulting id of the program to send back.
Definition: ghidra_process.hh:110
int4 distance(BranchPoint *op2)
Calculate distance between two BranchPoints.
Definition: blockaction.cc:517
Simplify trivial arithmetic expressions.
Definition: ruleaction.hh:438
PcodeOp * root
The final PcodeOp in the expression.
Definition: coreaction.hh:1057
Range(AddrSpace *s, uintb f, uintb l)
Construct a Range from offsets.
Definition: address.hh:173
BlockBasic * block2
Side 2 of the (putative) split.
Definition: blockaction.hh:242
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2902
uintb val
The value of the register.
Definition: globalcontext.hh:70
virtual void emitBlockSwitch(const BlockSwitch *bl)=0
Emit a switch structure.
static bool varnodeSame(Varnode *a, Varnode *b)
Do the given Varnodes hold the same value, possibly as constants.
Definition: condexe.cc:178
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:1192
bool isUnary(void) const
Check if operator is unary.
Definition: opbehavior.hh:116
TypeOpPiece(TypeFactory *t)
Constructor.
Definition: typeop.cc:1542
LaneDivide(Funcdata *f, Varnode *root, const LaneDescription &desc, bool allowDowncast)
Constructor.
Definition: subflow.cc:2469
void setOutEdgeFlag(int4 i, uint4 lab)
Apply an out edge label.
Definition: block.cc:228
string slafile
Name of .sla file for processor.
Definition: sleigh_arch.hh:55
virtual void opBoolAnd(const PcodeOp *op)
Emit a BOOL_AND operator.
Definition: printc.hh:262
int4 multiDepth
Number of MULTIEQUAL ops along current traversal path.
Definition: funcdata.hh:607
@ error_unimplemented
Throw an exception for flow into unimplemented instructions.
Definition: flow.hh:61
virtual PrintLanguage * buildLanguage(Architecture *glb)=0
Build the main PrintLanguage object corresponding to this capability.
list< PcodeOp * > descend
List of every op using this varnode as input.
Definition: varnode.hh:137
int4 useindex
Index of the sub-sorting address space.
Definition: database.hh:85
Order the inputs to commutative operations.
Definition: ruleaction.hh:212
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:93
@ missing
ops at this address were not generated
Definition: op.hh:94
virtual void setExecuteAddress(const Address &addr)
Set the address of the next instruction to emulate.
Definition: emulateutil.hh:147
static OpToken plusequal
The in-place addition operator.
Definition: printc.hh:103
static bool checkTerm(Varnode *vn, AddTreeState *state)
Accumulate details of given term and continue tree traversal.
Definition: ruleaction.cc:5656
@ code
code only
Definition: loadimage.hh:49
A p-code script that uses a Ghidra client to generate the p-code ops.
Definition: inject_ghidra.hh:68
const VarnodeData & getLikelyTrash(int4 i) const
Get the i-th likely-trash location.
Definition: fspec.cc:3385
virtual uintb getLoadImageValue(AddrSpace *spc, uintb offset, int4 sz) const
Pull a value from the load-image given a specific address.
Definition: emulateutil.cc:28
Information about the INT_SEXT op-code.
Definition: typeop.hh:358
uintb getValue(AddrSpace *spc, uintb off, int4 size) const
Retrieve a memory value from the memory state.
Definition: memstate.cc:666
void opSwapInput(PcodeOp *op, int4 slot1, int4 slot2)
Swap two input operands in the given PcodeOp.
Definition: funcdata_op.cc:129
void generateStoreGuard(StackNode &node, PcodeOp *op, AddrSpace *spc)
Generate a guard record given an indexed STORE to a stack space.
Definition: heritage.cc:774
virtual Funcdata * resolveExternalRefFunction(ExternRefSymbol *sym) const
Convert an external reference to the referenced function.
Definition: database.cc:2225
vector< PcodeOpEdge > terms
Collected terms.
Definition: coreaction.hh:1058
static bool isSplittable(BlockBasic *b)
Determine if a RETURN block can be split.
Definition: blockaction.cc:2222
virtual void printState(ostream &s) const
Print status to stream.
Definition: action.cc:760
TypeOpIntSlessEqual(TypeFactory *t)
Constructor.
Definition: typeop.cc:870
void warningHeader(const string &txt) const
Add a warning comment as part of the function header.
Definition: funcdata.cc:111
MemoryBank * underlie
Underlying memory bank.
Definition: memstate.hh:129
virtual void opIntAdd(const PcodeOp *op)=0
Emit a INT_ADD operator.
virtual void restoreXml(const Element *el)
Restore this Scope from a <scope> XML tag.
Definition: varmap.cc:336
virtual void endReturnType(int4 id)
End a return type declaration.
Definition: prettyprint.cc:100
A breakpoint object.
Definition: emulate.hh:77
void printRaw(ostream &s) const
Write a raw version of the address to a stream.
Definition: address.hh:276
A global namespace Scope.
Definition: database_ghidra.hh:126
@ boolean_flip
Set if condition must be false to take branch.
Definition: op.hh:77
BlockBasic * posta_block
First block in posta path.
Definition: condexe.hh:141
VarnodeDefSet::const_iterator endDef(uint4 fl) const
End of Varnodes with a given definition property.
Definition: funcdata.hh:345
Address last
The last address of the range.
Definition: database.hh:812
virtual void printEntries(ostream &s) const =0
Dump a description of all SymbolEntry objects to a stream.
@ f_terminal
All paths from this point exit (without merging back to parent)
Definition: blockaction.hh:124
PcodeOp * artificialHalt(const Address &addr, uint4 flag)
Create an artificial halt p-code op.
Definition: flow.cc:578
int4 findPass(Address addr) const
Look up if/how given address was heritaged.
Definition: heritage.cc:83
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: condexe.cc:856
@ CPUI_INDIRECT
Copy with an indirect effect.
Definition: opcodes.hh:113
TypeOpIntAnd(TypeFactory *t)
Constructor.
Definition: typeop.cc:1091
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: condexe.cc:995
static PcodeOp * findPrimaryBranch(PcodeOpTree::const_iterator iter, PcodeOpTree::const_iterator enditer, bool findbranch, bool findcall, bool findreturn)
Find the primary branch operation for an instruction.
Definition: funcdata_op.cc:877
Perform SubvariableFlow analysis triggered by INT_RIGHT.
Definition: ruleaction.hh:1292
Information about the POPCOUNT op-code.
Definition: typeop.hh:798
Collapse unnecessary INT_OR.
Definition: ruleaction.hh:141
void readLoaderSymbols(void)
Read any symbols from loader into database.
Definition: architecture.cc:280
virtual void getPage(uintb addr, uint1 *res, int4 skip, int4 size) const
Overridded getPage method.
Definition: memstate.cc:384
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1179
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:268
Scope * curscope
The current symbol scope.
Definition: printlanguage.hh:234
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:1767
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:640
map< Address, Address > indirectover
Override indirect at call-point into direct to addr.
Definition: override.hh:53
virtual string makeNameUnique(const string &nm) const
Produce a version of the given symbol name that won't collide with other names in this Scope.
Definition: database.cc:2408
std::list< _recordtype > record
Storage for the actual record objects.
Definition: rangemap.hh:129
const LoadGuard * getStoreGuard(PcodeOp *op) const
Get LoadGuard record associated with given PcodeOp.
Definition: heritage.cc:2327
virtual void opFloatCeil(const PcodeOp *op)=0
Emit a FLOAT_CEIL operator.
uintm * array
The "array of words" holding context variable values.
Definition: globalcontext.hh:264
ContextCache(ContextDatabase *db)
Construct given a context database.
Definition: globalcontext.cc:570
A token/command object in the pretty printing stream.
Definition: prettyprint.hh:278
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:182
void setVariable(const string &nm, const Address &addr, uintm value)
Set a context value at the given address.
Definition: globalcontext.cc:131
static bool compareHighByBlock(const HighVariable *a, const HighVariable *b)
Compare HighVariables by the blocks they cover.
Definition: merge.hh:148
Varnode * newVarnodeCallSpecs(FuncCallSpecs *fc)
Create a call specification annotation Varnode.
Definition: funcdata_varnode.cc:194
TypeChar * getTypeChar(const string &n)
Create a default "char" type.
Definition: type.cc:1641
@ extracheck_high
Perform extra checks during parameter recovery on most sig portion of the double.
Definition: fspec.hh:58
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:998
void mark(Varnode *vn)
Mark given Varnode is visited by the traversal.
Definition: funcdata.hh:613
Base class for high-level language capabilities.
Definition: printlanguage.hh:39
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:817
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:236
Datatype * getLocalType(void) const
Calculate type of Varnode based on local information.
Definition: varnode.cc:730
int4 slot
Slot to follow.
Definition: userop.hh:172
Varnode * output
The one possible output Varnode of this op.
Definition: op.hh:121
virtual bool negateCondition(bool toporbottom)
Flip the condition computed by this.
Definition: block.cc:2789
virtual void opIntXor(const PcodeOp *op)=0
Emit a INT_XOR operator.
uintb vma
Address of first byte in the file.
Definition: loadimage.hh:97
FuncCallSpecs(PcodeOp *call_op)
Construct based on CALL or CALLIND.
Definition: fspec.cc:3992
ProtoParameter * outparam
Description of the return value.
Definition: fspec.hh:1109
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:565
void buildHeritageArray(void)
Calculate boolean array of all address spaces that have had a heritage pass run.
Definition: condexe.cc:365
@ falsebranch
Print the false branch (for flat)
Definition: printlanguage.hh:149
Helper class for resolving cross-references while deserializing BlockGraph objects.
Definition: block.hh:686
int4 var2
Variable with -1 coefficient.
Definition: coreaction.cc:24
bool isAddrTied(void) const
Is this storage address tied.
Definition: database.hh:243
@ CPUI_INT_AND
Logical/bitwise and (&)
Definition: opcodes.hh:68
virtual void executeSegmentOp(void)
Behavior for a SEGMENTOP.
Definition: emulateutil.cc:264
virtual void opStore(const PcodeOp *op)
Emit a STORE operator.
Definition: printc.cc:358
static OpToken comma
The comma operator (for parameter lists)
Definition: printc.hh:98
Helper class for initializing ParamEntryRange in a range map.
Definition: fspec.hh:111
Transform INT_CARRY using a constant: carry(V,c) => -c <= V
Definition: ruleaction.hh:659
bool contain(const PcodeOp *op, int4 max) const
Does this contain the given PcodeOp.
Definition: cover.cc:363
void compute(void)
Compute this value set.
Definition: rangeutil.cc:1790
virtual void addRange(AddrSpace *spc, uintb first, uintb last)
Add a memory range to the ownership of this Scope.
Definition: database_ghidra.cc:243
virtual const uintm * getDefaultValue(void) const
Retrieve the memory region holding all default context values.
Definition: ghidra_context.hh:42
void setCommentDelimeter(const string &start, const string &stop, bool usecommentfill)
Establish comment delimiters for the language.
Definition: printlanguage.cc:96
virtual void endBlock(int4 id)
End a control-flow element.
Definition: prettyprint.cc:68
bool notPrinted(void) const
Return true if this op is not directly represented in C output.
Definition: op.hh:171
virtual void saveXml(ostream &s) const
Write out this as a <scope> XML tag.
Definition: varmap.cc:325
virtual bool isExtensionCastImplied(const PcodeOp *op, const PcodeOp *readOp) const =0
Is the given ZEXT/SEXT cast implied by the expression its in?
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:274
void reprocessFreeStores(AddrSpace *spc, vector< PcodeOp * > &freeStores)
Revisit STOREs with free pointers now that a heritage pass has completed.
Definition: heritage.cc:940
bool operator<(const CheapSorter &op2) const
Lexicographic comparison.
Definition: cpool.hh:177
set< Varnode *, VarnodeCompareDefLoc > VarnodeDefSet
A set of Varnodes sorted by definition (then location)
Definition: varnode.hh:47
int4 injectId
Id of InjectPayload that emulates this operation.
Definition: userop.hh:201
bool traceForward(TransformVar *rvn)
Try to trace logical variable through descendant Varnodes.
Definition: subflow.cc:1768
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:559
virtual void opIntNotEqual(const PcodeOp *op)=0
Emit a INT_NOTEQUAL operator.
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database.cc:2073
@ warning
Warning has been generated for this op.
Definition: op.hh:109
bool isOverlay(void) const
Return true if this is an overlay space.
Definition: space.hh:421
AddrSpace * spaceid
Address space that the file bytes are mapped to.
Definition: loadimage.hh:100
@ flagsdirty
Boolean properties for the HighVariable are dirty.
Definition: variable.hh:46
virtual bool foldInGuards(Funcdata *fd, JumpTable *jump)=0
Eliminate any guard code involved in computing the switch destination.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:3638
Datatype * type
Data-type associated with the object.
Definition: cpool.hh:68
Varnode * findContiguousWhole(Funcdata &data, Varnode *vn1, Varnode *vn2)
Retrieve the whole Varnode given pieces.
Definition: varnode.cc:1606
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2081
void dedup(void)
Eliminate duplicate edges.
Definition: block.cc:495
static OpToken new_op
The new operator.
Definition: printc.hh:99
bool compareFinal(const BadEdgeScore &op2) const
Compare BadEdgeScore for unstructured suitability.
Definition: blockaction.cc:610
FuncProto funcp
Prototype of this function.
Definition: funcdata.hh:70
virtual void opPtrsub(const PcodeOp *op)=0
Emit a PTRSUB operator.
vector< ReversePolish > revpol
The Reverse Polish Notation (RPN) token stack.
Definition: printlanguage.hh:235
OpCode assumedExtension(const Address &addr, int4 sz, VarnodeData &res) const
Calculate the type of extension to expect for the given logical value.
Definition: fspec.cc:190
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1192
void removeEdge(FlowBlock *begin, FlowBlock *end)
Remove an edge between component FlowBlocks.
Definition: block.cc:1369
EmitXml::syntax_highlight hilite
Highlight information for the field token.
Definition: printc.hh:50
@ restart_pending
Analysis must be restarted (because of new override info)
Definition: funcdata.hh:56
static OpToken instanceof
The instanceof keyword.
Definition: printjava.hh:56
virtual ProtoParameter * setOutput(const ParameterPieces &piece)
Establish the data-type and storage of the return value.
Definition: fspec.cc:2546
virtual bool checkIntPromotionForCompare(const PcodeOp *op, int4 slot) const =0
Check if integer promotion forces a cast for the given comparison op and slot.
bool hasPhysical(void) const
Return true if data is physically stored in this.
Definition: space.hh:401
Classes for describing and printing data-types.
static int4 doDistribute(Funcdata &data, PcodeOp *op)
Distribute coefficient within one term.
Definition: ruleaction.cc:104
virtual void emitBlockIf(const BlockIf *bl)
Emit an if/else style construct.
Definition: printc.cc:2485
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:365
@ prot_e
End of a function prototype.
Definition: prettyprint.hh:308
virtual void inject(InjectContext &context, PcodeEmit &emit) const
Definition: inject_ghidra.cc:47
static bool compare(const CaseOrder &a, const CaseOrder &b)
Compare two cases.
Definition: block.hh:785
virtual void clearAllInputs(void)
Clear all input parameters (and any backing symbols)
Definition: fspec.cc:2523
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:250
virtual void pushPartialSymbol(const Symbol *sym, int4 off, int4 sz, const Varnode *vn, const PcodeOp *op, Datatype *outtype)
Push a variable that represents only part of a symbol onto the RPN stack.
Definition: printc.cc:1615
bool paren
True if parentheses are required.
Definition: printlanguage.hh:169
list< PcodeOp * >::const_iterator beginAlive(void) const
Start of all PcodeOps marked as alive.
Definition: op.hh:291
vector< string > scriptNames
Map from injectid to script name.
Definition: pcodeinject.hh:174
void insertSpace(AddrSpace *spc)
Add a new address space to the model.
Definition: translate.cc:297
virtual void executeBranchind(void)
Standard behavior for a BRANCHIND.
Definition: jumptable.cc:96
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:697
virtual ProtoParameter * setOutput(const ParameterPieces &piece)=0
Establish the data-type and storage of the return value.
vector< Varnode * > commonVn
Varnodes in common with all paths.
Definition: jumptable.hh:73
virtual int4 oneInstruction(PcodeEmit &emit, const Address &baseaddr) const
Transform a single machine instruction into pcode.
Definition: ghidra_translate.cc:100
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:398
Address entryaddress
First executing address of function.
Definition: fspec.hh:1439
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:864
string name
Name of this scope.
Definition: database.hh:425
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:426
@ no_color
Un-highlighted.
Definition: prettyprint.hh:96
void setModel(ProtoModel *m)
Set the prototype model for this.
Definition: fspec.cc:2960
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:579
void removeOutEdge(int4 slot)
Remove an outgoing edge.
Definition: block.cc:132
virtual void initialize(DocumentStorage &store)
Initialize the translator given XML configuration documents.
Definition: sleigh.cc:450
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6226
void markPaths(bool val, int4 startVarnode)
Mark PcodeOps paths from the given start.
Definition: jumptable.cc:958
virtual SymbolEntry * addDynamicMapInternal(Symbol *sym, uint4 exfl, uint8 hash, int4 off, int4 sz, const RangeList &uselim)=0
Create a new SymbolEntry for a Symbol given a dynamic hash.
Varnode * findVarnodeWritten(int4 s, const Address &loc, const Address &pc, uintm uniq=~((uintm) 0)) const
Find a defined Varnode via its storage address and its definition address.
Definition: funcdata.hh:294
Collect terms in a sum: V * c + V * d => V * (c + d)
Definition: ruleaction.hh:59
Information about the BOOL_AND op-code.
Definition: typeop.hh:531
int4 languageindex
Index (within LanguageDescription array) of the active language.
Definition: sleigh_arch.hh:93
virtual bool preserveAddress(Varnode *vn, int4 bitSize, int4 lsbOffset) const
Should the address of the given Varnode be preserved when constructing a piece.
Definition: subflow.cc:1962
static bool descendantsOutside(Varnode *vn)
Check if given Varnode has any descendants in a dead block.
Definition: funcdata_block.cc:228
@ CPUI_CAST
Cast from one data-type to another.
Definition: opcodes.hh:117
virtual void skippedEntity(const string &name)
Callback for an XML entity skipped by the parser.
Definition: xml.hh:238
string description
Human readable description of this language.
Definition: sleigh_arch.hh:58
Varnode * normalizeWriteSize(Varnode *vn, const Address &addr, int4 size)
Normalize the size of a written Varnode, prior to heritage.
Definition: heritage.cc:264
BlockIf * newBlockIf(FlowBlock *cond, FlowBlock *tc)
Build a new BlockIf.
Definition: block.cc:1715
virtual int4 beginVarDecl(const Symbol *sym)
Begin a variable declaration.
Definition: prettyprint.cc:107
const FlowBlock * getFrontLeaf(void) const
Get the first leaf FlowBlock.
Definition: block.cc:316
virtual void buildContext(DocumentStorage &store)
Build the Context database.
Definition: ghidra_arch.cc:355
Classes for printing tokens in a high-level language.
bool operator<(const Varnode &op2) const
Comparison operator on Varnode.
Definition: varnode.cc:478
Architecture * glb
The Architecture object that owns this TypeFactory.
Definition: type.hh:400
Mark/unmark a specific function with the noreturn property.
Definition: options.hh:105
Lightweight (and incomplete) XML parser for marshaling data to and from the decompiler.
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)
Attempt to recover details of the model, given a specific BRANCHIND.
Definition: jumptable.cc:381
bool enableRule(const string &specify)
Enable a specific Rule within this.
Definition: action.cc:234
static const Scope * stackFunction(const Scope *scope1, const Scope *scope2, const Address &addr, Funcdata **addrmatch)
Definition: database.cc:941
int4 slot
The slot of the first input Varnode to traverse in this subexpression.
Definition: coreaction.hh:419
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:408
virtual Action * getSubAction(const string &specify)
Retrieve a specific sub-action by name.
Definition: action.cc:439
virtual void removeSymbol(Symbol *symbol)
Remove the given Symbol from this Scope.
Definition: database.cc:2006
virtual void tagLine(void)
Force a line break.
Definition: prettyprint.cc:905
HeritageInfo * getInfo(AddrSpace *spc)
Get the heritage status for the given address space.
Definition: heritage.hh:220
int4 sizeOfInt
Size of the core "int" datatype.
Definition: type.hh:381
void checkend(void)
Enforce whitespace for an end token.
Definition: prettyprint.cc:821
OtherSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Constructor.
Definition: space.cc:399
Signed division of positive values is unsigned division.
Definition: ruleaction.hh:1128
void set(PcodeOp *o, AddrSpace *s, uintb off)
Set a new unanalyzed LOAD guard that initially guards everything.
Definition: heritage.hh:122
virtual const VarnodeData & getRegister(const string &nm) const =0
Get a register as VarnodeData given its name.
Common core of classes that read or write SLEIGH specification files natively.
Definition: sleighbase.hh:29
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:261
Datatype * ct
The data-type associated with a name.
Definition: coreaction.hh:461
Implementation of the LoadImage interface using underlying data stored in an XML format.
Definition: loadimage_xml.hh:28
virtual int4 getNumVariableTerms(void) const =0
Get the number of input Varnodes expected.
Replace COPYs from the same source with a single dominant COPY.
Definition: coreaction.hh:964
Gather raw p-code for a function.
Definition: coreaction.hh:32
virtual void resetStats(void)
Reset all the counts to zero.
Definition: action.cc:401
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:336
ScopeResolve resolvemap
The Address to namespace map.
Definition: database.hh:841
@ CPUI_PTRSUB
Drill down to a sub-field (->)
Definition: opcodes.hh:119
void restoreXml(const Element *el, BlockMap &resolver)
Restore this edge from an XML stream.
Definition: block.cc:34
TypeVoid(void)
Constructor.
Definition: type.hh:213
@ primitive
Constant value of data-type type, cpool operator can be eliminated.
Definition: cpool.hh:48
bool isdefault
True if this is formal default case for the switch.
Definition: block.hh:642
bool pushPtrCodeConstant(uintb val, const TypePointer *ct, const Varnode *vn, const PcodeOp *op)
Attempt to push a function name representing a constant pointer onto the RPN stack.
Definition: printc.cc:1386
static bool isReachable(PcodeOp *op)
Check if the given PcodeOp still seems reachable in its function.
Definition: jumptable.cc:2180
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:388
bool collectloads
Set to true if information about in-memory model data is/should be collected.
Definition: jumptable.hh:525
void scan(void)
Process a new token.
Definition: prettyprint.cc:729
Build a code structure from a control-flow graph (BlockGraph).
Definition: blockaction.hh:190
void addEdge(FlowBlock *begin, FlowBlock *end)
Add a directed edge between component FlowBlocks.
Definition: block.cc:1339
Base class for options classes that affect the configuration of the Architecture object.
Definition: options.hh:32
@ f_cross_edge
An edge that crosses subtrees in the spanning tree.
Definition: block.hh:102
void startProcessing(void)
Start processing for this function.
Definition: funcdata.cc:126
virtual bool initializeForReading(void) const =0
Initialize this for iterating over the set of possible values.
vector< PEntry > entry
Map of parameter entries corresponding to trials.
Definition: fspec.hh:857
void parseLaneSizes(const Element *el)
Apply lane size configuration.
Definition: architecture.cc:899
static OpToken ptr_expr
Pointer adornment for a type declaration.
Definition: printc.hh:112
virtual int4 getContextSize(void) const
Retrieve the number of words (uintm) in a context blob.
Definition: globalcontext.hh:289
void initializeSegments()
Set up segment resolvers.
Definition: architecture.cc:634
bool checkForMultistage(Funcdata *fd)
Check if this jump-table requires an additional recovery stage.
Definition: jumptable.cc:2681
Information about the INT_RIGHT op-code.
Definition: typeop.hh:456
Attach dynamically mapped symbols to Varnodes in time for data-type propagation.
Definition: coreaction.hh:986
void findExit(const vector< FlowBlock * > &body)
Choose the exit block for this loop.
Definition: blockaction.cc:175
ParameterSymbol * getSymbolBacked(int4 i)
Fetch or allocate the parameter for the indicated slot.
Definition: fspec.cc:2448
bool dominates(const FlowBlock *subBlock) const
Does this block dominate the given block.
Definition: block.cc:362
~MapState(void)
Destructor.
Definition: varmap.cc:720
bool getBiggestContainedInputParam(const Address &loc, int4 size, VarnodeData &res) const
Pass-back the biggest input parameter contained within the given range.
Definition: fspec.hh:807
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1923
const Translate * getTrans(void) const
Get the processor translator.
Definition: space.hh:277
virtual bool foldInGuards(Funcdata *fd, JumpTable *jump)
Eliminate any guard code involved in computing the switch destination.
Definition: jumptable.cc:1430
@ unaffected
The sub-function does not change the value at all.
Definition: fspec.hh:308
UnimplError(const string &s, int4 l)
Constructor.
Definition: translate.hh:41
uintb linetype
The linear element for a rangemap.
Definition: fspec.hh:129
bool checkInputSplit(const Address &loc, int4 size, int4 splitpoint) const
Check if it makes sense to split a single storage location into two input parameters.
Definition: fspec.hh:697
OpBehavior * currentBehave
Behavior of the next op to execute.
Definition: emulate.hh:171
ValueSet * stopNode
Ending node of component.
Definition: rangeutil.hh:162
string commentstart
Delimiter characters for the start of a comment.
Definition: printlanguage.hh:239
void tagOp(const char *ptr, EmitXml::syntax_highlight h, const PcodeOp *o)
Create an operator token.
Definition: prettyprint.hh:453
OpCode assumedInputExtension(const Address &addr, int4 size, VarnodeData &res) const
Get the type of extension and containing input parameter for the given storage.
Definition: fspec.hh:785
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:617
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:353
virtual void opIntNegate(const PcodeOp *op)=0
Emit a INT_NEGATE operator.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7761
VarnodeLocSet::const_iterator beginLoc(int4 s, const Address &addr, const Address &pc, uintm uniq=~((uintm) 0)) const
Start of Varnodes matching storage and definition address.
Definition: funcdata.hh:328
Helper class associating a Varnode with the block where it is defined.
Definition: merge.hh:44
@ flat
Do not print block structure.
Definition: printlanguage.hh:148
Structure for sorting out pointer expression trees.
Definition: ruleaction.hh:31
Treat FLOAT_NAN as always evaluating to false.
Definition: ruleaction.hh:1388
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:604
static int4 byteToAddressInt(int4 val, uint4 ws)
Scale int4 from byte units to addressable units.
Definition: space.hh:514
void insertForceGoto(const Address &targetpc, const Address &destpc)
Force a specific branch instruction to be an unstructured goto.
Definition: override.cc:56
void checkSizeTypeLock(void)
Calculate if size_typelock property is on.
Definition: database.cc:219
virtual void opIndirect(const PcodeOp *op)=0
Emit a INDIRECT operator.
Simplify signed comparisons using INT_SBORROW.
Definition: ruleaction.hh:548
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:405
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: action.cc:529
vector< RootedOp > opMeld
All the ops for the melded paths.
Definition: jumptable.hh:74
static vector< PrintLanguageCapability * > thelist
The static array of registered high-level languages.
Definition: printlanguage.hh:40
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:374
@ f_continue_goto
Block ends with a continue;.
Definition: block.hh:78
virtual void setVarnodeValue(Varnode *vn, uintb val)
Given a specific Varnode, set the given value for it in the current machine state.
Definition: jumptable.cc:158
void updateOutputTypes(const vector< Varnode * > &triallist)
Update the return value based on Varnode trials.
Definition: fspec.cc:3250
printclass delimtype
The general class of the token.
Definition: prettyprint.hh:327
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6531
virtual ProtoParameter * clone(void) const =0
Clone the parameter.
virtual bool executeCbranch(void)=0
Check if the conditional of a CBRANCH is true.
string name
Name of the parameter (for use in parsing p-code source)
Definition: pcodeinject.hh:35
void saveXml(ostream &s) const
Save this to an XML stream.
Definition: globalcontext.cc:35
virtual const VarnodeData & getSpacebaseFull(int4 i) const
Return original spacebase register before truncation.
Definition: translate.cc:97
Toggle whether the calling convention is printed when emitting function prototypes.
Definition: options.hh:135
@ f_tree_edge
An edge in the spanning tree.
Definition: block.hh:100
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.hh:588
Partial data-type information mapped to a specific range of bytes.
Definition: varmap.hh:69
void clear(void)
Clear out all Varnodes and reset counters.
Definition: varnode.cc:854
@ spacebase_placeholder
Definition: varnode.hh:86
uint4 flags
Collection of boolean attributes on this op.
Definition: op.hh:114
void establishTopologicalOrder(void)
Find the optimal order for iterating through the ValueSets.
Definition: rangeutil.cc:2028
Specific implementation of Architecture using GNU BFD libraries.
@ begin_indent
Start of a new nesting level.
Definition: prettyprint.hh:286
spacetype
Fundemental address space types.
Definition: space.hh:28
@ written
This varnode has a defining op (def is nonzero)
Definition: varnode.hh:75
virtual int getContextSize(void) const
Retrieve the number of words (uintm) in a context blob.
Definition: ghidra_context.hh:58
virtual void opFloatSub(const PcodeOp *op)=0
Emit a FLOAT_SUB operator.
void setInputLock(bool val)
Toggle the data-type lock on input parameters.
Definition: fspec.cc:3070
void finalizeDatatype(Datatype *tp)
Set a final datatype for this variable.
Definition: variable.cc:292
TypeOpFloatLess(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1370
VarnodeData * out
Output varnode triple.
Definition: pcoderaw.hh:97
bool merge(RangeHint *b, AddrSpace *space, TypeFactory *typeFactory)
Try to form the union of this with another RangeHint.
Definition: varmap.cc:160
virtual ~Architecture(void)
Destructor.
Definition: architecture.cc:124
AddrSpace * joinspace
Space for unifying split variables.
Definition: translate.hh:228
virtual void clearOutput(void)
Clear the return value to TYPE_VOID.
Definition: fspec.cc:2679
void joinTrial(int4 slot, const Address &addr, int4 sz)
Join adjacent parameter trials.
Definition: fspec.cc:1504
@ open
An array with a (possibly unknown) number of elements.
Definition: varmap.hh:76
bool recoversubcall
True if this is being used to recover prototypes of a sub-function call.
Definition: fspec.hh:231
virtual void opIntSlessEqual(const PcodeOp *op)
Emit a INT_SLESSEQUAL operator.
Definition: printc.hh:237
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1273
TypeOpIntRight(TypeFactory *t)
Constructor.
Definition: typeop.cc:1144
Perform SubvariableFlow analysis triggered by INT_ZEXT.
Definition: ruleaction.hh:1303
void insertProtoOverride(const Address &callpoint, FuncProto *p)
Override the assumed function prototype at a specific call site.
Definition: override.cc:111
Map object for keeping track of which address ranges have been heritaged.
Definition: heritage.hh:42
bool checkOpen(BlockTrace *trace)
Check if we can push the given BlockTrace into its next node.
Definition: blockaction.cc:803
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: condexe.cc:1032
void merge(const CoverBlock &op2)
Merge another CoverBlock into this.
Definition: cover.cc:145
list< PcodeOp * > deadandgone
List of retired PcodeOps.
Definition: op.hh:252
@ p_merged
A merged model (multiple models merged together)
Definition: fspec.hh:345
void updateCover(void) const
Internal function for update coverage information.
Definition: varnode.cc:206
VarnodeLocSet loc_tree
Varnodes sorted by location then def.
Definition: varnode.hh:331
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2688
Varnode * setDef(Varnode *vn, PcodeOp *op)
Change Varnode to be defined by the given PcodeOp.
Definition: varnode.cc:1004
@ force_bin
Force binary printing of constant symbol.
Definition: database.hh:180
virtual int4 determineIterationReset(const ValueSet &valueSet)=0
Upon entering a fresh partition, determine how the given ValueSet count should be reset.
virtual void docFunction(const Funcdata *fd)
Emit the declaration (and body) of a function.
Definition: printc.cc:2250
void duplicate(void)
Duplicate each equation, multiplying by -1.
Definition: coreaction.cc:93
virtual void opInsertOp(const PcodeOp *op)
Emit an INSERT operator.
Definition: printc.cc:971
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7000
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4427
virtual void buildLoader(DocumentStorage &store)
Build the LoadImage object and load the executable image.
Definition: xml_arch.cc:56
Mark Varnode and PcodeOp objects that are carrying or operating on pointers.
Definition: ruleaction.hh:1264
void abortSpacebaseRelative(Funcdata &data)
Abort the attempt to recover the relative stack offset for this function.
Definition: fspec.cc:3982
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:498
@ extension_patch
Convert op into something that copies/extends logical value, adding zero bits.
Definition: subflow.hh:70
static bool hasCharTerminator(uint1 *buffer, int4 size, int4 charsize)
Check if the byte buffer has a (unicode) string terminator.
Definition: printc.cc:1219
virtual void endDocument(int4 id)
End a whole document of output.
Definition: prettyprint.cc:38
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:111
Varnode * vn
The Varnode at this particular point in the path.
Definition: coreaction.hh:440
int4 reverse_index
Index for edge coming other way.
Definition: block.hh:47
int4 bitsPreserved
Number of bits copied (all other bits are zero)
Definition: jumptable.hh:137
@ CPUI_INT_REM
Remainder/modulo, unsigned (%)
Definition: opcodes.hh:76
int4 typeCode
0=pure constant 1=stack relative
Definition: rangeutil.hh:178
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1242
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:521
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6508
virtual bool getNextSymbol(LoadImageFunc &record) const
Get the next symbol record.
Definition: loadimage_xml.cc:236
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)
Restore the model from an XML stream.
Definition: fspec.cc:1208
virtual Address getExecuteAddress(void) const
Get current execution address.
Definition: emulate.hh:364
int4 wholeSize
Size of the whole register.
Definition: transform.hh:107
virtual int4 intPromotionType(const Varnode *vn) const
Calculate the integer promotion code of a given Varnode.
Definition: cast.cc:98
Action, Rule, and other associates classes supporting transformations on function data-flow.
virtual void restoreFromSpec(const Element *el, const AddrSpaceManager *manage)=0
Add initial context state from XML tags in compiler/processor specifications.
void setReverseJustified(AddrSpace *spc)
Set reverse justified property on this space.
Definition: translate.cc:283
vector< string > callMechTarget
Map from injectid to call-mech name.
Definition: pcodeinject.hh:173
void setFlags(uint4 fl) const
Internal method for setting boolean attributes.
Definition: varnode.cc:325
bool multion
True if MULTIEQUAL used in condition.
Definition: condexe.hh:46
virtual void opIntSdiv(const PcodeOp *op)
Emit a INT_SDIV operator.
Definition: printc.hh:257
void deleteScope(Scope *scope)
Delete the given Scope and all its sub-scopes.
Definition: database.cc:2807
virtual bool getBiggestContainedParam(const Address &loc, int4 size, VarnodeData &res) const =0
Pass-back the biggest parameter contained within the given range.
modifiers
Possible context sensitive modifiers to how tokens get emitted.
Definition: printlanguage.hh:137
virtual void setCategory(Symbol *sym, int4 cat, int4 ind)
Set the category and index for the given Symbol.
Definition: database.cc:2682
AddrSpace * getNextSpaceInOrder(AddrSpace *spc) const
Get the next contiguous address space.
Definition: translate.cc:581
virtual void opBoolNegate(const PcodeOp *op)
Definition: printc.cc:622
static void pushConsumed(uintb val, Varnode *vn, vector< Varnode * > &worklist)
Definition: coreaction.cc:3076
void replaceEdgesThru(int4 in, int4 out)
Remove this from flow between two blocks.
Definition: block.cc:186
maptype database
Map from linear split points to the value objects.
Definition: partmap.hh:54
bool isFlowBreak(void) const
Return true if this op breaks fall-thru flow.
Definition: op.hh:178
bool isConstruct
True if this model is a constructor for a particular object.
Definition: fspec.hh:630
void clearResolve(Scope *scope)
Clear the ownership ranges associated with the given Scope.
Definition: database.cc:2726
void addEquation(int4 slt, int4 type, const CircleRange &constraint)
Insert an equation restricting this value set.
Definition: rangeutil.cc:1779
FlowBlock * immed_dom
Immediate dominating block.
Definition: block.hh:109
void opInsertEnd(PcodeOp *op, BlockBasic *bl)
Insert given PcodeOp at the end of a basic block.
Definition: funcdata_op.cc:405
ContextBitRange(int4 sbit, int4 ebit)
Construct a context value given an absolute bit range.
Definition: globalcontext.cc:23
Rule(const string &g, uint4 fl, const string &nm)
Construct given group, properties name.
Definition: action.cc:605
circularqueue< int4 > scanqueue
References to current open and whitespace tokens.
Definition: prettyprint.hh:713
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:565
Datatype * type
type of subfield
Definition: type.hh:127
@ used
Trial is definitely used (final verdict)
Definition: fspec.hh:161
Architecture * glb
The Architecture affected by the contained ArchOption.
Definition: options.hh:64
virtual void print(const char *str, syntax_highlight hl=no_color)
Emit other (more unusual) syntax as part of source code generation.
Definition: prettyprint.cc:291
@ incidental_copy
Do copies of this varnode happen as a side-effect.
Definition: varnode.hh:107
virtual void opCallother(const PcodeOp *op)
Emit a CALLOTHER operator.
Definition: printc.cc:507
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:534
PcodeOpTree::const_iterator endOp(const Address &addr) const
End of all (alive) PcodeOp objects attached to a specific Address.
Definition: funcdata.hh:476
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:576
void forceSet(Funcdata &data, const FuncProto &fp)
Force a more restrictive prototype on this call site.
Definition: fspec.cc:4516
void deleteCallSpecs(PcodeOp *op)
Remove the specification for a particular call.
Definition: funcdata.cc:469
vector< EffectRecord >::const_iterator effectBegin(void) const
Get iterator to front of EffectRecord list.
Definition: fspec.cc:3358
@ UNSIGNED_EXTENSION
The value is promoted using unsigned extension.
Definition: cast.hh:49
virtual ~TypeOp(void)
Destructor.
Definition: typeop.cc:161
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5169
virtual bool isXmlMatch(Document *doc) const
Determine is this extension can handle this XML document.
Definition: raw_arch.cc:45
void addAttribute(const string &nm, const string &vl)
Add a new name/value attribute pair to this element.
Definition: xml.hh:181
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3429
virtual void emitBlockBasic(const BlockBasic *bb)=0
Emit statements in a basic block.
bool hasOnlyMarkers(void) const
Does this block contain only MULTIEQUAL and INDIRECT ops.
Definition: block.cc:2471
void parseGlobal(const Element *el)
Apply global space configuration.
Definition: architecture.cc:786
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:968
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6294
map< string, const Element * > tagmap
The map from name to registered XML elements.
Definition: xml.hh:251
PcodeInjectLibrary * pcodeinjectlib
Pcode injection manager.
Definition: architecture.hh:145
FlowInfo(Funcdata &d, PcodeOpBank &o, BlockGraph &b, vector< FuncCallSpecs * > &q)
Constructor.
Definition: flow.cc:24
void recoverNameRecommendationsForSymbols(void)
Run through name recommendations, checking if any match unnamed symbols.
Definition: varmap.cc:1230
uint4 flags
additional attributes of the parameter
Definition: fspec.hh:297
string basegroup
Group to which this Rule belongs.
Definition: action.hh:206
static void markConsumedParameters(FuncCallSpecs *fc, vector< Varnode * > &worklist)
Determine how the given sub-function parameters are consumed.
Definition: coreaction.cc:3353
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2294
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:450
TypeVoid(const TypeVoid &op)
Construct from another TypeVoid.
Definition: type.hh:211
vector< uintb > alias
List of aliased addresses (as offsets)
Definition: varmap.hh:120
~circularqueue(void)
Destructor.
Definition: prettyprint.hh:640
virtual void restoreXmlBody(List::const_iterator &iter, List::const_iterator enditer, BlockMap &resolver)
Restore details about this FlowBlock from an XML stream.
Definition: block.cc:2545
TypeSpacebase(AddrSpace *id, const Address &frame, Architecture *g)
Construct given an address space, scope, and architecture.
Definition: type.hh:368
virtual const CPoolRecord * getRecord(const vector< uintb > &refs) const
Retrieve a constant pool record (CPoolRecord) given a reference to it.
Definition: cpool_ghidra.cc:30
bool contain(const RangeHint *b) const
Return true if this or the given range contains the other.
Definition: varmap.cc:56
Information about the PTRADD op-code.
Definition: typeop.hh:718
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:531
bool containedBy(int4 sz, const Address &op2, int4 sz2) const
Determine if op2 range contains this range.
Definition: address.cc:104
@ checked
Trial has been checked.
Definition: fspec.hh:160
virtual void inject(InjectContext &context, PcodeEmit &emit) const
Definition: inject_ghidra.cc:111
void warning(const string &txt, const Address &ad) const
Add a warning comment in the function body.
Definition: funcdata.cc:95
void restoreXml(const Element *el)
Execute a series of option commands passed by XML.
Definition: options.cc:142
map< string, AddrSpace * > name2Space
Map from name -> space.
Definition: translate.hh:221
void reinterpreted(const Address &addr)
Generate warning message or exception for a reinterpreted address.
Definition: flow.cc:592
@ double_precis_on
Set if we are performing double precision recovery.
Definition: funcdata.hh:59
@ bestfit
Decide on most aesthetic form.
Definition: printlanguage.hh:140
void checkContainedCall(void)
Check if any of the calls this function makes are to already traced data-flow.
Definition: flow.cc:1335
void saveXml(ostream &s) const
Definition: op.cc:289
void saveXmlJumpTable(ostream &s) const
Emit an XML description of jump-tables to stream.
Definition: funcdata.cc:573
void parseVolatile(const Element *el, Architecture *glb)
Parse a <volatile> XML tag.
Definition: userop.cc:435
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore constant pool records from an XML stream.
Definition: cpool.cc:232
bool doTrace(void)
Trace logical value as far as possible.
Definition: subflow.cc:1973
virtual void docFunction(const Funcdata *fd)=0
Emit the declaration (and body) of a function.
int4 offset
"justified" offset into entry
Definition: fspec.hh:176
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:330
An operation that writes to volatile memory.
Definition: userop.hh:126
@ vartoken
Emit atom as variable.
Definition: printlanguage.hh:157
SymbolEntry * mapentry
cached SymbolEntry associated with Varnode
Definition: varnode.hh:133
uint4 flags
Boolean properties of the node.
Definition: funcdata.hh:578
Lay down locked input and output data-type information.
Definition: coreaction.hh:607
int4 uniquecount
Total number of unique head and tail nodes.
Definition: blockaction.hh:48
virtual void opCopy(const PcodeOp *op)
Emit a COPY operator.
Definition: printc.cc:339
Simplify comparisons with boolean values: V == false => !V, V == true => V
Definition: ruleaction.hh:498
virtual void printMessage(const string &message) const
Print an error message to console.
Definition: ghidra_arch.cc:696
AddrSpace * getSpaceByName(const string &nm) const
Get address space by name.
Definition: translate.cc:524
@ CPUI_FLOAT_FLOAT2FLOAT
Convert between different floating-point sizes.
Definition: opcodes.hh:102
Architecture * glb
Architecture owning the user defined op.
Definition: userop.hh:40
virtual void reset(Funcdata &data)
Reset this Rule.
Definition: ruleaction.cc:7717
virtual void addSymbolInternal(Symbol *sym)
Put a Symbol into the name map.
Definition: database_ghidra.hh:51
static OpToken bitwise_or
The logical or operator.
Definition: printc.hh:93
PcodeOp * readOp
The immediate PcodeOp causing the restriction.
Definition: jumptable.hh:132
static int4 getStride(Varnode *vn)
Get the step/stride associated with the Varnode.
Definition: jumptable.cc:441
void normalize(void)
Normalize the iterator, after increment or initialization.
Definition: transform.cc:267
virtual AddrSpace * getSpacebase(void) const =0
Get the address space associated with any stack based parameters in this list.
int4 defaultaddr
Id of p-code script performing calculation of default address (must be present)
Definition: userop.hh:232
virtual void registerContext(const string &name, int4 sbit, int4 ebit)
Add a new context variable to the model for this processor.
Definition: sleigh.cc:672
ScopeInternal(const string &nm, Architecture *g)
Construct the Scope.
Definition: database.cc:1834
int4 deadcodedelay
How many passes to delay deadcode removal of this space.
Definition: heritage.hh:89
int4 position
The position value.
Definition: fspec.hh:121
ValueSet * startNode
Starting node of component.
Definition: rangeutil.hh:161
Simplify INT_EQUAL applied to arithmetic expressions.
Definition: ruleaction.hh:985
The c-language token emitter.
Definition: printc.hh:63
void setFlat(bool val)
Set whether nesting code structure should be emitted.
Definition: printlanguage.cc:761
Varnode * concatPieces(const vector< Varnode * > &vnlist, PcodeOp *insertop, Varnode *finalvn)
Concatenate a list of Varnodes together at the given location.
Definition: heritage.cc:355
Simplify INT_RIGHT and INT_SRIGHT ops where an INT_AND mask becomes unnecessary.
Definition: ruleaction.hh:181
Varnode * nameRepresentative
The storage location used to generate a Symbol name.
Definition: variable.hh:64
Funcdata * fd
The function this is controlling SSA construction.
Definition: heritage.hh:201
void saveXml(ostream &s) const
Save a SeqNum to a stream as an XML tag.
Definition: address.cc:47
virtual AddrSpace * getContain(void) const
Return this space's containing space (if any)
Definition: space.hh:478
@ typedirty
The data-type for the HighVariable is dirty.
Definition: variable.hh:48
A class for annotating and sorting the individual cases of the switch.
Definition: block.hh:633
void setMemoryBank(MemoryBank *bank)
Map a memory bank into the state.
Definition: memstate.cc:618
virtual ProtoStore * clone(void) const
Clone the entire collection of parameter descriptions.
Definition: fspec.cc:2570
string namerec
A possible name for a variable.
Definition: coreaction.hh:462
static Varnode * buildSubpiece(Varnode *basevn, uint4 outsize, uint4 shift, Funcdata &data)
Build a SUBPIECE of given base Varnode.
Definition: ruleaction.cc:825
void advanceleft(void)
Emit tokens that have been fully committed.
Definition: prettyprint.cc:698
MemoryState * memstate
The memory state of the emulator.
Definition: emulate.hh:245
bool operator()(const Symbol *sym1, const Symbol *sym2) const
Compare two Symbol pointers.
Definition: database.hh:317
Record for scoring a BlockTrace for suitability as an unstructured branch.
Definition: blockaction.hh:144
OpBehavior * getBehavior(void) const
Retrieve the behavior for this op.
Definition: pcoderaw.hh:126
Determine data-flow holding the return value of the function.
Definition: coreaction.hh:760
int4 id
The id of the token group which this belongs to.
Definition: printlanguage.hh:171
@ readonly
Varnode is stored at a readonly location.
Definition: varnode.hh:90
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:354
void initializeStart(const PathMeld &pathMeld)
Pass in the prior PathMeld calculation.
Definition: jumptable.cc:1523
type_metatype metaout
The metatype of the output.
Definition: typeop.hh:156
CPUI_PIECE behavior.
Definition: opbehavior.hh:492
void mergeAddrTied(void)
Force the merge of address tried Varnodes.
Definition: merge.cc:523
int4 getMaxInfo(void) const
Get maximum information content of range.
Definition: rangeutil.cc:278
map< Address, string > addrtosymbol
Symbols sorted by address.
Definition: loadimage_xml.hh:34
A low-level representation of a single pcode operation.
Definition: pcoderaw.hh:94
void open(const AddrSpaceManager *m)
Read XML tags into the containers.
Definition: loadimage_xml.cc:67
Varnode * baseVn
Value being (quasi)copied to the Varnode.
Definition: jumptable.hh:136
Class for sub-sorting different SymbolEntry objects at the same address.
Definition: database.hh:83
virtual bool isSizeTypeLocked(void) const
Is the size of the parameter locked.
Definition: fspec.cc:2346
virtual void opIntOr(const PcodeOp *op)
Emit a INT_OR operator.
Definition: printc.hh:251
bool deprecated
Set to true if the specification is considered deprecated.
Definition: sleigh_arch.hh:59
@ enumtype
An enumeration type (as well as an integer)
Definition: type.hh:73
@ type_color
Data-type identifiers.
Definition: prettyprint.hh:90
bool traceBackward(TransformVar *rvn)
Trace a logical value backward through defining op one level.
Definition: subflow.cc:1853
Special AddrSpace for representing constants during analysis.
Definition: space.hh:177
virtual bool isZextCast(Datatype *outtype, Datatype *intype) const
Is zero-extending an input data-type, producing an output data-type, considered a cast.
Definition: cast.cc:421
virtual void printStatistics(ostream &s) const
Dump statistics to stream.
Definition: action.cc:593
vector< BlockEdge > outofthis
Blocks into which this block (can) fall.
Definition: block.hh:115
virtual void executeCall(void)
Standard behavior for a p-code CALL.
Definition: emulateutil.cc:234
void restoreXml(const Element *el)
Deserialize the reference from an XML element.
Definition: cpool.cc:187
void registerAction(const string &nm, Action *act)
Register a root Action.
Definition: action.cc:1080
void print(const char *str, EmitXml::syntax_highlight h)
Create a token for other (more unusual) syntax in source code.
Definition: prettyprint.hh:512
MemoryImage(AddrSpace *spc, int4 ws, int4 ps, LoadImage *ld)
Constructor for a loadimage memorybank.
Definition: memstate.cc:405
virtual int4 getSize(void) const
Get the number of bytes occupied by this parameter.
Definition: fspec.cc:2328
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:860
void component(ValueSet *vertex, Partition &part)
Generate a partition component given its head.
Definition: rangeutil.cc:1960
void buildOpDown(const PcodeOp *op)
Move the output Varnode for the given PcodeOp into staging.
Definition: dynamic.cc:159
virtual void dump(const Address &addr, const string &mnem, const string &body)=0
The main disassembly emitting method.
virtual void buildLabels(Funcdata *fd, vector< Address > &addresstable, vector< uintb > &label, const JumpModel *orig) const =0
Recover case labels associated with the Address table.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:215
vector< Address > addrlist
Addresses to which there is flow.
Definition: flow.hh:86
PcodeEmit * buildEmitter(const vector< OpBehavior * > &inst, uintb uniqReserve)
Provide the caller with an emitter for building the p-code snippet.
Definition: emulateutil.cc:310
void saveXmlRecursive(ostream &s, bool onlyGlobal) const
Save all contained scopes as an XML stream.
Definition: database.cc:1273
bool blockIntersection(HighVariable *a, HighVariable *b, int4 blk)
Test if two HighVariables intersect on a given BlockBasic.
Definition: merge.cc:1515
Associate data-type and behavior information with a specific p-code op-code.
Definition: typeop.hh:37
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5076
static OpToken divide
The division operator.
Definition: printc.hh:79
void registerOp(UserPcodeOp *op)
Insert a new UserPcodeOp description object in the map(s)
Definition: userop.cc:361
virtual void emitBlockInfLoop(const BlockInfLoop *bl)=0
Emit an infinite loop structure.
virtual void docTypeDefinitions(const TypeFactory *typegrp)=0
Emit definitions of data-types.
Prepare for data-flow analysis of function parameters, when recovery isn't required.
Definition: coreaction.hh:677
bool thisbeforeret
Does a this parameter come before a hidden return parameter.
Definition: fspec.hh:496
void setPieces(const PrototypePieces &pieces)
Set this prototype based on raw pieces.
Definition: fspec.cc:2984
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:764
int4 count
Depth first numbering / widening count.
Definition: rangeutil.hh:131
bool pushForwardUnary(OpCode opc, const CircleRange &in1, int4 inSize, int4 outSize)
Push-forward thru given unary operator.
Definition: rangeutil.cc:1083
virtual void opCast(const PcodeOp *op)
Emit a CAST operator.
Definition: printc.hh:286
PrintLanguage(Architecture *g, const string &nm)
Constructor.
Definition: printlanguage.cc:57
vector< uintb > value
The hashtable values.
Definition: memstate.hh:133
virtual ProtoParameter * getOutput(void)
Get the return-value description.
Definition: fspec.cc:2687
virtual const TrackedSet & getTrackedSet(const Address &addr) const
Get the set of tracked register values associated with the given address.
Definition: ghidra_context.cc:18
void buildDynamicSymbol(Varnode *vn)
Build a dynamic Symbol associated with the given Varnode.
Definition: funcdata_varnode.cc:1097
@ CALL_RETURN
Replace primary BRANCH or RETURN with suitable CALL/RETURN operation.
Definition: override.hh:47
PcodeOp * newOp(int4 inputs, const Address &pc)
Definition: funcdata_op.cc:295
void clear(void)
Clear out old disassembly.
Definition: funcdata.cc:64
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:7755
int4 terminal
1 if BlockTrace destination has no exit, 0 otherwise
Definition: blockaction.hh:148
virtual void pushConstant(uintb val, const Datatype *ct, const Varnode *vn, const PcodeOp *op)=0
Push a constant onto the RPN stack.
int4 intersect(const CircleRange &op2)
Intersect this with another range.
Definition: rangeutil.cc:547
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:388
int4 optype
0=constant 1=unary 2=binary
Definition: ruleaction.hh:1352
virtual void printUnicode(ostream &s, int4 onechar) const =0
Print a single unicode character as a character constant for the high-level language.
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1284
@ pop_failkill
Backtracking, from path with a bad ancestor, specifically killedbycall.
Definition: funcdata.hh:602
static bool neverConsumed(Varnode *vn, Funcdata &data)
Deal with unconsumed Varnodes.
Definition: coreaction.cc:3322
virtual void restoreXml(DocumentStorage &store)
Restore the Architecture state from an XML stream.
Definition: raw_arch.cc:96
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:397
vector< uintb > inputList
Temporary ids of input varnodes.
Definition: pcodeinject.hh:139
void inflate(Varnode *a, HighVariable *high)
Inflate the Cover of a given Varnode with a HighVariable.
Definition: merge.cc:1546
virtual void removeSymbol(Symbol *symbol)=0
Remove the given Symbol from this Scope.
@ error_toomanyinstructions
Throw an exception if too many instructions are encountered.
Definition: flow.hh:63
block_flags
Boolean properties of blocks.
Definition: block.hh:75
virtual SymbolEntry * findContainer(const Address &addr, int4 size, const Address &usepoint) const
Find the smallest Symbol containing the given memory range.
Definition: database.cc:2113
void addRange(uintb st, Datatype *ct, uint4 fl, RangeHint::RangeType rt, int4 hi)
Add a hint to the collection.
Definition: varmap.cc:735
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:590
@ smallsize_inttype
Assume values that are below the max size are sign OR zero extended based on integer type.
Definition: fspec.hh:56
virtual void startDocument(void)
Start processing a new XML document.
Definition: xml.hh:225
bool initialize(void)
Initialize the hint collection for iteration.
Definition: varmap.cc:864
Information about the FLOAT_ADD op-code.
Definition: typeop.hh:580
void append(const PathMeld &op2)
Append a new set of paths to this set of paths.
Definition: jumptable.cc:904
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:491
void clear(void)
Clear for a new test.
Definition: blockaction.cc:2092
virtual void executeSegmentOp(void)
Behavior for a SEGMENTOP.
Definition: emulateutil.cc:120
FuncCallSpecs * clone(PcodeOp *newop) const
Clone this given the mirrored p-code CALL.
Definition: fspec.cc:4031
void calcScaleMask(void)
Calculate scale and mask.
Definition: space.cc:21
Classes to support the c-language back-end of the decompiler.
uint4 vnmod
Printing modifications to enforce on the expression.
Definition: printlanguage.hh:182
@ CPUI_INT_SLESSEQUAL
Integer comparison, signed less-than-or-equal (<=)
Definition: opcodes.hh:54
JumpTable * getJumptable(void) const
Get the JumpTable associated this block.
Definition: block.cc:597
void gatherSymbols(const EntryMap *rangemap)
Add Symbol information as hints to the collection.
Definition: varmap.cc:846
virtual void saveXml(ostream &s) const =0
Write out this as a <scope> XML tag.
Address getLastAddrOpen(const AddrSpaceManager *manage) const
Get address of first byte after this.
Definition: address.cc:237
AddrSpace * getFspecSpace(void) const
Get the internal callspec space.
Definition: translate.hh:451
virtual void printRaw(ostream &s) const
Print a description of the type to stream.
Definition: type.cc:69
virtual bool getNextSymbol(LoadImageFunc &record) const
Get the next symbol record.
Definition: loadimage.hh:151
int4 pullcount
Number of instructions pulling out the logical value.
Definition: subflow.hh:91
~Funcdata(void)
Destructor.
Definition: funcdata.cc:162
virtual SymbolEntry * addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a memory range.
Definition: database.cc:1730
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:461
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1075
void addSpacebasePointer(SpacebaseSpace *basespace, const VarnodeData &ptrdata, int4 truncSize, bool stackGrowth)
Set the base register of a spacebase space.
Definition: translate.cc:404
virtual void buildInstructions(DocumentStorage &store)
Register the p-code operations.
Definition: architecture.cc:595
const PcodeOp * op
The single operator consuming value from the implied Varnode.
Definition: printlanguage.hh:181
vector< uintb > outputList
Temporary ids of output varnodes.
Definition: pcodeinject.hh:140
uintb getNZMaskLocal(bool cliploop) const
Calculate known zero bits for output to this op.
Definition: op.cc:408
Helper class for determining if Varnodes can trace their value from a legitimate source.
Definition: funcdata.hh:566
PcodeEmitCache(vector< PcodeOpRaw * > &ocache, vector< VarnodeData * > &vcache, const vector< OpBehavior * > &in, uintb uniqReserve)
Constructor.
Definition: emulate.cc:102
OpCode get_booleanflip(OpCode opc, bool &reorder)
Get the complementary OpCode.
Definition: opcodes.cc:92
Utilities for making references to dynamic variables: defined as locations and constants that can onl...
@ baddata_present
Set if function flowed into bad data.
Definition: funcdata.hh:58
@ ignore_unimplemented
Treat unimplemented instructions as a NOP (no operation)
Definition: flow.hh:59
virtual bool negateCondition(bool toporbottom)
Flip the condition computed by this.
Definition: block.hh:429
uint4 flags
Boolean properties inherited from Varnode members.
Definition: variable.hh:62
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:5351
void setLineCommentIndent(int4 val)
Set the number of characters to indent comment lines.
Definition: printlanguage.cc:82
Build Static Single Assignment (SSA) representation for function.
Definition: coreaction.hh:276
uint4 opflags
Cached pcode-op properties for this op-code.
Definition: typeop.hh:46
Dead code removal. Eliminate dead p-code ops.
Definition: coreaction.hh:540
void updateFlags(void) const
(Re)derive boolean properties of this from the member Varnodes
Definition: variable.cc:97
long adjustvma
What address byte 0 of the raw file gets treated as.
Definition: raw_arch.hh:36
virtual void executeBranchind(void)
Standard behavior for a BRANCHIND.
Definition: emulateutil.cc:228
@ has_thisptr
Referenced method has a this pointer.
Definition: cpool.hh:58
Action * getAction(const string &nm) const
Look up a root Action by name.
Definition: action.cc:1066
static XmlArchitectureCapability xmlArchitectureCapability
The singleton instance.
Definition: xml_arch.hh:23
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)
Attempt to recover details of the model, given a specific BRANCHIND.
Definition: jumptable.cc:1298
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:1026
bool isBooleanFlip(void) const
Return true if this op flips the true/false meaning of its control-flow branching.
Definition: op.hh:180
static char encodeRangeOverlaps(uintb op1left, uintb op1right, uintb op2left, uintb op2right)
Calculate overlap code.
Definition: rangeutil.hh:356
@ is_constructor
Referenced method is a constructor.
Definition: cpool.hh:59
virtual bool isXmlMatch(Document *doc) const
Determine is this extension can handle this XML document.
Definition: bfd_arch.cc:58
Shifting away all non-zero bits of one-side of a logical/arithmetic op.
Definition: ruleaction.hh:171
bool ruleBlockGoto(FlowBlock *bl)
Attempt to apply the BlockGoto structure.
Definition: blockaction.cc:1430
@ CPUI_INT_SBORROW
Test for signed borrow.
Definition: opcodes.hh:64
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:923
@ f_irreducible
Edge which must be removed to make graph reducible.
Definition: block.hh:99
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1086
static Varnode * getMultCoeff(Varnode *vn, uintb &coef)
Get the multiplicative coefficient.
Definition: ruleaction.cc:80
virtual void registerVariable(const string &nm, int4 sbit, int4 ebit)=0
Register a new named context variable (as a bit range) with the database.
@ rule_debug
Print debug info specific for this rule.
Definition: action.hh:197
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:662
void collapseConstantSymbol(Varnode *newConst) const
Propagate constant symbol from inputs to given output.
Definition: op.cc:364
Address current_address
Address of current instruction being executed.
Definition: emulate.hh:302
PcodeOp * create(int4 inputs, const Address &pc)
Create a PcodeOp with at a given Address.
Definition: op.cc:676
PcodeOpTree::const_iterator endOpAll(void) const
End of all (alive) PcodeOp objects sorted by sequence number.
Definition: funcdata.hh:470
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:346
virtual PcodeOp * getStartOp(void) const
Get the PcodeOp associated with the current value.
Definition: jumptable.cc:306
virtual int4 printAssembly(AssemblyEmit &emit, const Address &baseaddr) const
Disassemble a single machine instruction.
Definition: sleigh.cc:599
virtual void opIntSext(const PcodeOp *op, const PcodeOp *readOp)=0
Emit a INT_SEXT operator.
virtual void flush(void)
Flush any remaining character data.
Definition: prettyprint.cc:1171
HighVariable(Varnode *vn)
Construct a HighVariable with a single member Varnode.
Definition: variable.cc:22
Calculate the non-zero mask property on all Varnode objects.
Definition: coreaction.hh:287
int4 getAddrSize(void) const
Get the number of bytes in the address.
Definition: address.hh:263
Classes for specifying addresses and other low-level constants.
bool isinputactive
Are we actively trying to recover input parameters.
Definition: fspec.hh:1449
virtual Address getExecuteAddress(void) const =0
Get the address of the current instruction being executed.
virtual int4 beginReturnType(const Varnode *vn)
Begin a return type declaration.
Definition: prettyprint.cc:89
void inlineClone(const FlowInfo &inlineflow, const Address &retaddr)
Clone the given in-line flow into this flow using the hard model.
Definition: flow.cc:1047
virtual TrackedSet & getTrackedDefault(void)=0
Get the set of default values for all tracked registers.
static void readParameter(const Element *el, string &name, uint4 &size)
Read in an <input> or <output> XML tag describing an injection parameter.
Definition: pcodeinject.cc:24
virtual void closeParen(char c, int4 id)
Emit a close parenthesis.
Definition: prettyprint.cc:319
virtual void setTypeLock(bool val)
Toggle the lock on the data-type.
Definition: fspec.cc:2370
void getScopePath(vector< Scope * > &vec) const
Get the ordered list of parent scopes to this.
Definition: database.cc:1382
bool traceBackwardSext(ReplaceVarnode *rvn)
Trace logical data-flow backward assuming sign-extensions.
Definition: subflow.cc:881
LoadImage * loader
The underlying LoadImage.
Definition: memstate.hh:94
virtual bool checkFreeze(const ValueSet &valueSet)
Check if the given value set has been frozen for the remainder of the iteration process.
Definition: rangeutil.cc:1827
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:917
BlockBasic * nodeSplitBlockEdge(BlockBasic *b, int4 inedge)
Split given basic block b along an in edge.
Definition: funcdata_block.cc:741
virtual int4 numSpacebase(void) const
Number of base registers associated with this space.
Definition: space.hh:447
void parseSpacebase(const Element *el)
Create an additional indexed space.
Definition: architecture.cc:998
virtual int4 getBytesConsumed(void) const
Get number of bytes consumed within the address->symbol map.
Definition: database.cc:514
Data defining a specific memory location.
Definition: pcoderaw.hh:33
@ rule_onceperfunc
Apply rule once per function.
Definition: action.hh:55
uint4 flags
The collection of boolean attributes for this Varnode.
Definition: varnode.hh:123
void addInput(VarnodeData *i)
Add an additional input varnode to this op.
Definition: pcoderaw.hh:191
@ CPUI_COPY
Copy one operand to another.
Definition: opcodes.hh:36
int4 termOrder(const Varnode *op) const
Compare two Varnodes based on their term order.
Definition: varnode.cc:791
TypeSpacebase(const TypeSpacebase &op)
Construct from another TypeSpacebase.
Definition: type.hh:364
virtual ContextBitRange & getVariable(const string &nm)
Retrieve the context variable description object by name.
Definition: ghidra_context.hh:34
@ func_b
Start of a function body.
Definition: prettyprint.hh:297
virtual SymbolEntry * findContainer(const Address &addr, int4 size, const Address &usepoint) const =0
Find the smallest Symbol containing the given memory range.
ProtoModel * model
Model of for this prototype.
Definition: fspec.hh:1164
void fillinReadOnlyFromLoader(void)
Load info about read-only sections.
Definition: architecture.cc:1215
virtual void flush(void)
Flush any remaining character data.
Definition: prettyprint.hh:173
BlockBasic * newBlockBasic(Funcdata *fd)
Build a new BlockBasic.
Definition: block.cc:1570
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1647
bool operator<(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:346
virtual void printUnicode(ostream &s, int4 onechar) const
Print a single unicode character as a character constant for the high-level language.
Definition: printc.cc:1123
An implementation of the Architecture interface and connection to a Ghidra client.
Definition: ghidra_arch.hh:60
bool ruleBlockSwitch(FlowBlock *bl)
Attempt to apply the BlockSwitch structure.
Definition: blockaction.cc:1629
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.hh:74
uintb filesize
Total number of bytes in the loadimage/file.
Definition: loadimage.hh:99
int4 useropindex
Index passed in the CALLOTHER op.
Definition: userop.hh:39
void replaceOutEdge(int4 num, FlowBlock *b)
Make an outgoing edge flow to a given block.
Definition: block.cc:166
void setXML(bool val)
Set whether the low-level emitter, emits XML markup.
Definition: printlanguage.cc:752
vector< list< SymbolEntry >::iterator > mapentry
List of storage locations labeled with this Symbol.
Definition: database.hh:169
static const int4 SLA_FORMAT_VERSION
Current version of the .sla file read/written by SleighBash.
Definition: sleighbase.hh:30
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:511
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4562
virtual void setExecuteAddress(const Address &addr)=0
Set the address of the next instruction to emulate.
static void clearMarks(vector< FlowBlock * > &body)
Clear the body marks.
Definition: blockaction.cc:1032
virtual Datatype * castStandard(Datatype *reqtype, Datatype *curtype, bool care_uint_int, bool care_ptr_uint) const
Does there need to be a visible cast between the given data-types.
Definition: cast.cc:220
Class for freezing value sets at a specific iteration (to accelerate convergence)
Definition: rangeutil.hh:252
void resetLocalWindow(void)
Reset the set of addresses that are considered mapped by the scope to the default.
Definition: varmap.cc:298
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:725
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:312
@ oinv_t
Start of an arbitrary (invisible) grouping.
Definition: prettyprint.hh:319
static Varnode * findSubpiece(Varnode *basevn, uint4 outsize, uint4 shift)
Find a predefined SUBPIECE of a base Varnode.
Definition: ruleaction.cc:898
virtual void clear(void)
Clear all symbols from this scope.
Definition: database.cc:1858
virtual void restoreDebug(const Element *el)
A method for reading in p-code generated externally for use in debugging.
Definition: pcodeinject.hh:214
virtual void opIntEqual(const PcodeOp *op)=0
Emit a INT_EQUAL operator.
virtual bool next(void) const =0
Advance the iterator, return true if there is another value.
Information about the INT_LESSEQUAL op-code.
Definition: typeop.hh:341
int4 localcount
Number of passes made for this function.
Definition: coreaction.hh:182
SymbolEntry * getFirstWholeMap(void) const
Get the first entire mapping of the symbol.
Definition: database.cc:251
uint4 unique_allocatemask
Bits that are guaranteed to be zero in the unique allocation scheme.
Definition: sleighbase.hh:37
virtual void executeCpoolRef(void)=0
Standard behavior for a CPOOLREF (constant pool reference) op.
Push a Varnode with known pointer data-type to the bottom of its additive expression.
Definition: ruleaction.hh:1018
int4 checkSingle(Varnode *vn, MultiPredicate &branch, PcodeOp *op, Funcdata &data)
Check for the alternate form, tmp1 = (val2 == 0) ? val1 : 0;.
Definition: condexe.cc:1016
map< VarnodeData, const LanedRegister * > lanedMap
Current storage locations which may be laned registers.
Definition: funcdata.hh:84
int4 getReturnBytesConsumed(void) const
Get an estimate of the number of bytes consumed by callers of this prototype.
Definition: fspec.hh:1228
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1021
static OpToken bitwise_xor
The logical xor operator.
Definition: printc.hh:92
bool clipExtraRoots(void)
Mark edges between root components as unstructured gotos.
Definition: blockaction.cc:1101
@ poweroftwo
An enumeration type where all values are of 2^^n form.
Definition: type.hh:74
static bool replaceLessequal(Funcdata &data, PcodeOp *op)
Replace INT_LESSEQUAL and INT_SLESSEQUAL expressions.
Definition: funcdata_op.cc:978
void lockDefaultProperties(void)
Lock in the default state of the boolean property map.
Definition: database_ghidra.hh:65
Command to decompile a specific function.
Definition: ghidra_process.hh:152
bool copyShadow(const Varnode *op2) const
Are this and op2 copied from the same source?
Definition: varnode.cc:768
static PrintLanguageCapability * findCapability(const string &name)
Find a language capability by name.
Definition: printlanguage.cc:44
string cspec
Compiler specification to configure with.
Definition: ghidra_process.hh:104
vector< PcodeOp * > injectlist
List of p-code ops that need injection.
Definition: flow.hh:88
VarnodeData * createVarnode(const VarnodeData *var)
Clone and cache a raw VarnodeData.
Definition: emulate.cc:112
string token
Name or token associated with the object.
Definition: cpool.hh:66
bool operator!=(const SeqNum &op2) const
Compare two sequence numbers for inequality.
Definition: address.hh:141
uint4 addlflags
Additional properties.
Definition: typeop.hh:47
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:787
uint4 flags
Properties of the BlockTrace.
Definition: blockaction.hh:126
void restoreXmlJumpTable(const Element *el)
Restore jump-tables from an XML description.
Definition: funcdata.cc:558
bool syncVarnodesWithSymbol(VarnodeLocSet::const_iterator &iter, uint4 flags, Datatype *ct)
Update properties (and the data-type) for a set of Varnodes associated with one Symbol.
Definition: funcdata_varnode.cc:875
vector< int4 > soln
Collected solutions (corresponding to array of variables)
Definition: coreaction.cc:36
bool sameOpComplement(PcodeOp *bin1op, PcodeOp *bin2op)
Test if two operations with same opcode produce complementary boolean values.
Definition: condexe.cc:226
virtual void opSegmentOp(const PcodeOp *op)=0
Emit a SEGMENTOP operator.
list< NameRecommend > nameRecommend
Symbol name recommendations for specific addresses.
Definition: varmap.hh:185
A generic source code pretty printer.
Definition: prettyprint.hh:700
This is the basic set of transformation Rule objects.
Convert LESSEQUAL to LESS: V <= c => V < (c+1)
Definition: ruleaction.hh:191
void gather(const Funcdata *f, AddrSpace *spc, bool defer)
Gather Varnodes that point on the stack.
Definition: varmap.cc:534
virtual void pushAnnotation(const Varnode *vn, const PcodeOp *op)
Push an address which is not in the normal data-flow.
Definition: printc.cc:1511
uintb wrapOffset(uintb off) const
Wrap -off- to the offset that fits into this space.
Definition: space.hh:361
Varnode * vn
The Varnode itself.
Definition: merge.hh:46
int4 rightotal
Definition: prettyprint.hh:709
@ overlay
This space is an overlay of another space.
Definition: space.hh:82
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:279
bool checkForFlowModification(FuncCallSpecs &fspecs)
Check for modifications to flow at a call site given the recovered FuncCallSpecs.
Definition: flow.cc:622
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:682
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:2127
virtual bool next(void) const
Advance the iterator, return true if there is another value.
Definition: jumptable.cc:288
virtual Address getExecuteAddress(void) const
Get the address of the current instruction being executed.
Definition: emulateutil.hh:148
static void mergeIdenticalHeads(vector< LoopBody * > &looporder)
Merge loop bodies that share the same head.
Definition: blockaction.cc:439
Varnode * base
The Varnode holding the base pointer.
Definition: varmap.hh:112
void saveContext(ostream &s, const Address &addr, const uintm *vec) const
Write out a single context block as an XML tag.
Definition: globalcontext.cc:324
void adjustDirectMulti(void)
Update inputs to any MULTIEQUAL in the direct block.
Definition: condexe.cc:528
@ constant_space_index
Reserved index for the constant space.
Definition: space.hh:90
int4 numLanes
Number of lanes in the particular Varnode.
Definition: subflow.hh:171
AddrSpace * defaultdataspace
Default space where data lives.
Definition: translate.hh:225
@ voidinputlock
Set if this prototype takes no inputs and is locked.
Definition: fspec.hh:1150
@ vard_e
End of a variable declaration.
Definition: prettyprint.hh:304
@ extracheck_low
Perform extra checks during parameter recovery on least sig portion of the double.
Definition: fspec.hh:59
virtual Action * clone(const ActionGroupList &grouplist) const =0
Clone the Action.
virtual void restoreXml(const Element *el)
Definition: space.cc:386
CPUI_INT_ADD behavior.
Definition: opbehavior.hh:189
Add warnings for prototypes that aren't modeled properly.
Definition: coreaction.hh:1008
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:389
int4 index
Index of BlockBasic defining Varnode.
Definition: merge.hh:45
virtual void opBoolAnd(const PcodeOp *op)=0
Emit a BOOL_AND operator.
Varnode * createUnique(int4 s, Datatype *ct)
Create a temporary varnode.
Definition: varnode.cc:889
PcodeOp * cseElimination(Funcdata &data, PcodeOp *op1, PcodeOp *op2)
Perform a Common Subexpression Elimination step.
Definition: funcdata_op.cc:1184
void followFlow(const Address &baddr, const Address &eadddr, uint4 insn_max)
Generate raw p-code for the function.
Definition: funcdata_op.cc:708
virtual void modifySpaces(Translate *trans)=0
Modify address spaces as required by this Architecture.
vector< FloatFormat > floatformats
Floating point formats utilized by the processor.
Definition: translate.hh:298
BlockBasic * exita
First (common) exit point.
Definition: blockaction.hh:243
virtual void markLabelBumpUp(bool bump)
Let hierarchical blocks steal labels of their (first) components.
Definition: block.cc:1184
Try to merge an op's input Varnode to its output, if they are at the same storage location.
Definition: coreaction.hh:362
virtual void saveXml(ostream &s) const
Serialize this architecture to XML.
Definition: architecture.cc:403
void saveXmlBasic(ostream &s) const
Save basic data-type properties.
Definition: type.cc:239
string name
The local symbol name recommendation.
Definition: varmap.hh:33
uint4 maxleftright
Maximum shifts to normalize.
Definition: jumptable.hh:522
Varnode * basevn
The boolean Varnode on which the root CBRANCH keys.
Definition: condexe.hh:35
virtual bool isSextCast(Datatype *outtype, Datatype *intype) const =0
Is sign-extending an input data-type, producing an output data-type, considered a cast.
void guard(const Address &addr, int4 size, vector< Varnode * > &read, vector< Varnode * > &write, vector< Varnode * > &inputvars)
Normalize p-code ops so that phi-node placement and renaming works.
Definition: heritage.cc:984
void addParameter(const Address &addr, int4 sz)
Register a trial to be scored.
Definition: fspec.cc:2060
uint4 flags
Attributes of the space.
Definition: space.hh:98
PcodeInjectLibraryGhidra(ArchitectureGhidra *ghi)
Constructor.
Definition: inject_ghidra.cc:196
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1256
const Symbol * symbol
Associated Symbol being displayed.
Definition: prettyprint.hh:338
string id
Unique id for this language.
Definition: sleigh_arch.hh:57
Document * getType(const string &name, uint8 id)
Retrieve a data-type description for the given name and id.
Definition: ghidra_arch.cc:538
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:5138
bool allowFailingPath
True if we allow and test for failing paths due to conditional execution.
Definition: funcdata.hh:608
Perform SubVariableFlow analysis triggered by SUBPIECE.
Definition: ruleaction.hh:1242
@ indirect_creation
Output varnode is created by indirect effect.
Definition: op.hh:96
int4 whichTrial(const Address &addr, int4 sz) const
Get the trial overlapping with the given memory range.
Definition: fspec.cc:1423
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:154
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:417
Cleanup: Convert INT_2COMP from INT_MULT: V * -1 => -V
Definition: ruleaction.hh:1050
uintb size
Number of bytes in section.
Definition: loadimage.hh:54
const string & getAttributeValue(const string &nm) const
Get an attribute value by name.
PcodeOp * cbranch
CBRANCH determining if zero is set.
Definition: condexe.hh:218
virtual void printRaw(ostream &s, const PcodeOp *op)=0
Print (for debugging purposes) this specific PcodeOp to the stream.
void getBytes(uint1 *buf, int4 size, const Address &inaddr)
Retrieve bytes in the LoadImage at the given address.
Definition: ghidra_arch.cc:583
Eliminate locally constant indirect calls.
Definition: coreaction.hh:198
@ jumptablerecovery_dont
Don't try to recover jump-tables, always truncate.
Definition: funcdata.hh:55
SeqNum seqnum
Sequence number of first PcodeOp in the instruction (or INVALID if no p-code)
Definition: flow.hh:76
virtual void printState(ostream &s) const
Print status to stream.
Definition: action.cc:146
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.hh:766
virtual void opIntSborrow(const PcodeOp *op)=0
Emit a INT_SBORROW operator.
bool testIBlock(void)
Test the most basic requirements on iblock.
Definition: condexe.cc:385
virtual void closeSectionInfo(void) const
Stop reading section info.
Definition: loadimage.hh:165
void buildBinaryOp(OpCode opc, PcodeOp *op, TransformVar *in0Vars, TransformVar *in1Vars, TransformVar *outVars, int4 numLanes)
Build binary op placeholders with the same opcode across a set of lanes.
Definition: subflow.cc:2058
Architecture * glb
The Architecture to which this symbol table is attached.
Definition: database.hh:839
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const
Given an address and data-type, build a suitable generic symbol name.
Definition: database.cc:2289
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: action.cc:374
virtual int4 beginFuncProto(void)
Begin a function prototype declaration.
Definition: prettyprint.cc:139
string getCallOtherTarget(int4 injectid) const
Get the callother-fixup name associated with an id.
Definition: pcodeinject.cc:291
string name
Identifier for this capability.
Definition: architecture.hh:75
void emitLabel(const FlowBlock *bl)
Emit a formal label for a given control-flow block.
Definition: printc.cc:2707
Address getReplacementAddress(ReplaceVarnode *rvn) const
Calculcate address of replacement Varnode for given subgraph variable node.
Definition: subflow.cc:1193
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:75
Toggle whether off-cut reinterpretation of an instruction is a fatal error.
Definition: options.hh:225
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:741
void restoreXml(const Element *el)
Recover this jump-table from a <jumptable> XML tag.
Definition: jumptable.cc:2629
virtual int4 beginBlock(const FlowBlock *bl)
Begin a control-flow element.
Definition: prettyprint.hh:227
std::list< _recordtype >::iterator insert(const inittype &data, linetype a, linetype b)
Insert a new record into the container.
Definition: rangemap.hh:222
virtual bool isXmlMatch(Document *doc) const =0
Determine is this extension can handle this XML document.
void parseFuncPtrAlign(const Element *el)
Apply function pointer alignment configuration.
Definition: architecture.cc:975
const Translate * trans
Processor translator (for register names etc) for this space.
Definition: space.hh:96
bool contiguous_test(Varnode *vn1, Varnode *vn2)
Test if Varnodes are pieces of a whole.
Definition: varnode.cc:1575
void findLinkedVarnodes(SymbolEntry *entry, vector< Varnode * > &res) const
Find Varnodes that map to the given SymbolEntry.
Definition: funcdata_varnode.cc:1071
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:512
uintb uintbmasks[]
Precalculated masks indexed by size.
Definition: address.cc:571
int4 stackplaceholder
Which call input slot holds the stack placeholder.
Definition: fspec.hh:226
static int4 getCodepoint(const uint1 *buf, int4 charsize, bool bigend, int4 &skip)
Extract the next unicode codepoint from an array of character data.
Definition: printlanguage.cc:553
Class for splitting up Varnodes that hold 2 logical variables.
Definition: subflow.hh:132
Raw descriptions of varnodes and p-code ops.
Scope * resolveScope(const string &name) const
Find a child Scope of this.
Definition: database.cc:1236
const AddrSpace * spc
Associated Address.
Definition: prettyprint.hh:337
VarnodeDefSet::const_iterator beginDef(uint4 fl) const
Beginning of varnodes with set definition property.
Definition: varnode.cc:1392
Concatenation with 0 becomes an extension: V = concat(#0,W) => V = zext(W)
Definition: ruleaction.hh:81
const CompilerTag & getCompiler(const string &nm) const
Get compiler specification of the given name.
Definition: sleigh_arch.cc:75
static OpToken object_member
The member operator.
Definition: printc.hh:67
Varnode * newVarnode(int4 s, const Address &m, Datatype *ct=(Datatype *) 0)
Create a new unattached Varnode object.
Definition: funcdata_varnode.cc:139
bool doTrace(void)
Trace lanes as far as possible from the root Varnode.
Definition: subflow.cc:2479
vector< Rule * > perop[CPUI_MAX]
Rules associated with each OpCode.
Definition: action.hh:261
static string bogus_uri
A placeholder for the namespace URI that should be attached to the element.
Definition: xml.hh:37
virtual ~AddrSpaceManager(void)
Destroy the manager.
Definition: translate.cc:426
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3049
A container for parsed XML documents.
Definition: xml.hh:249
void printRaw(ostream &s) const
Write a text description of to the given stream.
Definition: rangeutil.cc:1742
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:967
string name
The (local) name of the element.
Definition: xml.hh:151
uint4 maxaddsub
Maximum ADDs or SUBs to normalize.
Definition: jumptable.hh:521
int4 curdepth
The current highest priority index with active blocks.
Definition: heritage.hh:66
virtual LabSymbol * findCodeLabel(const Address &addr) const
Find a label Symbol at the given address.
Definition: database.cc:2231
int4 size
Number of bytes of binary data in function body.
Definition: funcdata.hh:68
bool target_isbigendian
true if the general endianness of the process is big endian
Definition: translate.hh:294
void restoreXmlSpaces(const Element *el, const Translate *trans)
Restore address spaces in the model from an XML tag.
Definition: translate.cc:228
Varnode * cloneVarnode(const Varnode *vn)
Clone a Varnode (between copies of the function)
Definition: funcdata_varnode.cc:241
virtual Funcdata * resolveExternalRefFunction(ExternRefSymbol *sym) const
Convert an external reference to the referenced function.
Definition: database_ghidra.cc:358
Address localframe
Address of function whose symbol table is indexed (or INVALID for "global")
Definition: type.hh:359
virtual ~ProtoModel(void)
Destructor.
Definition: fspec.cc:1799
list< Partition > recordStorage
Storage for the Partitions establishing components.
Definition: rangeutil.hh:292
A structure for pushing nested fields to the RPN stack.
Definition: printc.hh:45
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4595
bool checkInputJoin(const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const
Check if the given two input storage locations can represent a single logical parameter.
Definition: fspec.hh:674
virtual bool isIndirectStorage(void) const =0
Is this really a pointer to the true parameter.
vector< PcodeOpRaw * > opList
Sequence of p-code ops to be executed.
Definition: emulateutil.hh:113
Extension to read executables based on an XML format.
virtual void renameSymbol(Symbol *sym, const string &newname)=0
Rename a Symbol within this Scope.
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:155
static bool mergeTestSpeculative(HighVariable *high_out, HighVariable *high_in)
Speculative tests for merging HighVariables that are not Cover related.
Definition: merge.cc:166
void separateFloat(ParamActive *active, int4 &floatstart, int4 &floatstop, int4 &start, int4 &stop) const
Calculate the range of floating-point entries within a given set of parameter trials.
Definition: fspec.cc:690
linetype last
End of the disjoint sub-range.
Definition: rangemap.hh:79
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1296
std::multiset< AddrRange >::const_iterator iter
The underlying multiset iterator.
Definition: rangemap.hh:101
TypeOpFloatEqual(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1356
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:261
vector< VarnodeData * > varcache
The cache of current varnodes.
Definition: emulate.hh:299
bool isLoopDAGOut(int4 i) const
Is the i-th outgoing edge part of the DAG sub-graph.
Definition: block.hh:249
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2737
static bool varnodeComplement(Varnode *a, Varnode *b)
Do the given boolean Varnodes always hold complementary values.
Definition: condexe.cc:193
TypeOpIntSright(TypeFactory *t)
Constructor.
Definition: typeop.cc:1184
virtual void executeCall(void)
Standard behavior for a p-code CALL.
Definition: emulate.cc:277
virtual bool sanityCheck(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable)=0
Perform a sanity check on recovered addresses.
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:365
CPUI_COPY behavior.
Definition: opbehavior.hh:123
virtual void tagLine(void)
Force a line break.
Definition: prettyprint.cc:73
void orderTails(void)
Find preferred tail.
Definition: blockaction.cc:238
AddrSpace * spc
Space containing range.
Definition: address.hh:163
Funcdata * fd
The function being emulated.
Definition: jumptable.hh:101
virtual void truncate(int4 nm)
Definition: jumptable.cc:257
int4 size
Size of the range (in bytes)
Definition: heritage.hh:31
@ f_duplicate_block
Block is a duplicated version of an original basic block.
Definition: block.hh:92
int4 curstart
Current restart iteration.
Definition: action.hh:173
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:660
void foldInNormalization(Funcdata *fd)
Hide the normalization code for the switch.
Definition: jumptable.cc:2400
int4 beginFuncProto(void)
Create a "begin function prototype declaration" command.
Definition: prettyprint.hh:428
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:75
static OpToken pointer_member
The points to member operator.
Definition: printc.hh:68
void executeCurrentOp(void)
Do a single pcode op step.
Definition: emulate.cc:141
bool inflateTest(Varnode *a, HighVariable *high)
Test if we can inflate the Cover of the given Varnode without incurring intersections.
Definition: merge.cc:1567
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:544
virtual const TrackedSet & getTrackedSet(const Address &addr) const =0
Get the set of tracked register values associated with the given address.
static void funcLinkOutput(FuncCallSpecs *fc, Funcdata &data)
Set up the return value recovery process for a single sub-function call.
Definition: coreaction.cc:1454
virtual void executeBinary(void)
Execute a binary arithmetic/logical operation.
Definition: emulateutil.cc:54
virtual bool executeCbranch(void)
Check if the conditional of a CBRANCH is true.
Definition: emulate.cc:263
list< DynamicRecommend > dynRecommend
Symbol name recommendations for dynamic locations.
Definition: varmap.hh:186
Apply a set of identities involving BOOL_NEGATE.
Definition: ruleaction.hh:934
A map from a linear space to value objects.
Definition: partmap.hh:48
void clearCodeLists(void)
Clear all op-code specific lists.
Definition: op.cc:662
static Address restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore an address from parsed XML.
Definition: address.cc:201
void clearUnlockedOutput(void)
Clear the return value if it has not been locked.
Definition: fspec.cc:3147
virtual void opIntLessEqual(const PcodeOp *op)
Emit a INT_LESSEQUAL operator.
Definition: printc.hh:239
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3374
bool operator<(const EffectRecord &op2) const
Comparator for EffectRecords.
Definition: fspec.hh:1546
SubfloatFlow(Funcdata *f, Varnode *root, int4 prec)
Definition: subflow.cc:1952
uintb curval
The current value pointed to be the iterator.
Definition: jumptable.hh:182
A simple raw binary loadimage.
Definition: loadimage.hh:96
virtual void removeSymbol(Symbol *symbol)
Remove the given Symbol from this Scope.
Definition: database_ghidra.hh:105
bool possibleOutputParam(const Address &loc, int4 size) const
Does the given storage location make sense as a return value.
Definition: fspec.hh:736
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:376
virtual void sendResult(void)
Send results of the command (if any) back to the Ghidra client.
Definition: ghidra_process.cc:185
void placeMultiequals(void)
Perform phi-node placement for the current set of address ranges.
Definition: heritage.cc:2157
string * elementname
The name of the XML element.
Definition: xml.hh:39
@ array_length
Integer length, token is language specific indicator, type is integral data-type.
Definition: cpool.hh:53
static void propagateAcrossReturns(Funcdata &data)
Give data-types a chance to propagate between CPUI_RETURN operations.
Definition: coreaction.cc:4596
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:370
void destroy(Varnode *vn)
Remove a Varnode from the container.
Definition: varnode.cc:900
void handleNewLoadCopies(void)
Mark the boundary of artificial ops introduced by load guards.
Definition: heritage.cc:543
void attachScope(Scope *newscope, Scope *parent)
Register a new Scope.
Definition: database.cc:2789
virtual LabSymbol * findCodeLabel(const Address &addr) const
Find a label Symbol at the given address.
Definition: database_ghidra.cc:339
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4265
Prepare for data-flow analysis of function parameters.
Definition: coreaction.hh:656
bool gotoPrints(void) const
Should a formal goto statement be emitted.
Definition: block.cc:2647
static const char arrange[]
Map from raw overlaps to normalized overlap code.
Definition: rangeutil.hh:54
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2300
void eliminateOutDups(FlowBlock *bl)
Eliminate duplicate out edges to given block.
Definition: block.cc:445
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:978
void a_v_i(ostream &s, const string &attr, intb val)
Output the given signed integer as an XML attribute value.
Definition: xml.hh:343
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)
Establish name, data-type, storage of a specific input parameter.
Definition: fspec.cc:2463
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:296
const FlowBlock * zeroBlock
Final block in path that sets zero.
Definition: condexe.hh:216
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:421
void pushVnExplicit(const Varnode *vn, const PcodeOp *op)
Push an explicit variable onto the RPN stack.
Definition: printlanguage.cc:206
void calcRange(Varnode *vn, CircleRange &rng) const
Calculate the range of values in the given Varnode that direct control-flow to the switch.
Definition: jumptable.cc:1073
static bool compareName(Varnode *vn1, Varnode *vn2)
Determine which given Varnode is most nameable.
Definition: variable.cc:201
virtual const VarnodeData & getSpacebase(int4 i) const
Get a base register that creates this virtual space.
Definition: translate.cc:89
void setOrder(uintm ord)
Set the order field of a sequence number.
Definition: address.hh:135
Address getEquivalentAddress(uintb offset, int4 &pos) const
Given offset in \join space, get equivalent address of piece.
Definition: translate.cc:127
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1000
vector< PcodeOp * > copyTrims
COPY ops inserted to facilitate merges.
Definition: merge.hh:83
bool mergeTest(HighVariable *high, vector< HighVariable * > &tmplist)
Test for intersections between a given HighVariable and a list of other HighVariables.
Definition: merge.cc:1594
uint4 maxtablesize
Maximum table size we allow to be built (sanity check)
Definition: jumptable.hh:520
virtual JumpModel * clone(JumpTable *jt) const
Clone this model.
Definition: jumptable.cc:1625
IopSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Definition: op.cc:27
virtual void saveXml(ostream &s) const
Save this Symbol to an XML stream.
Definition: database.cc:688
Transform canceling INT_RIGHT or INT_SRIGHT of INT_LEFT.
Definition: ruleaction.hh:388
void forwardRecursion(const FlowInfo &op2)
Pull in-lining recursion information from another flow.
Definition: flow.cc:1016
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:149
Support for programs stored using an XML schema.
virtual void initialize(void)
Complete initialization of an extension point.
Definition: printlanguage.cc:33
int4 meldOps(const vector< PcodeOp * > &path, int4 cutOff, const vector< int4 > &parentMap)
Meld in PcodeOps from a new path into this container.
Definition: jumptable.cc:788
@ comment_color
Comments.
Definition: prettyprint.hh:89
virtual void restoreXml(const Element *el, TypeFactory &typegrp)=0
Restore constant pool records from an XML stream.
virtual bool negateCondition(bool toporbottom)
Flip the condition computed by this.
Definition: block.cc:2733
void addBlock(FlowBlock *bl)
Add a component FlowBlock.
Definition: block.cc:787
Information about the FLOAT_TRUNC op-code.
Definition: typeop.hh:643
void stopComment(int4 id)
Create an "end a comment block" command.
Definition: prettyprint.hh:567
bool isJumpTarget(void) const
Return true if non-fallthru jump flows into this.
Definition: block.cc:305
virtual void endDocument(void)
End processing for the current XML document.
Definition: xml.hh:226
bool traceForwardSext(ReplaceVarnode *rvn)
Trace logical data-flow forward assuming sign-extensions.
Definition: subflow.cc:788
bool rightIsStable
Set to true if right boundary of range didn't change (last iteration)
Definition: rangeutil.hh:134
void parseReturnAddress(const Element *el)
Apply return address configuration.
Definition: architecture.cc:866
virtual string buildUndefinedName(void) const
Build a formal undefined name, used internally when a Symbol is not given a name.
Definition: database.cc:2375
Normalize jump-table construction.
Definition: coreaction.hh:571
vector< HeritageInfo > infolist
Heritage status for individual address spaces.
Definition: heritage.hh:213
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:434
static string normalizeProcessor(const string &nm)
Try to recover a language id processor field.
Definition: sleigh_arch.cc:333
TypeOpIntCarry(TypeFactory *t)
Constructor.
Definition: typeop.cc:1004
virtual void executeBranch(void)
Standard behavior for a BRANCH.
Definition: emulate.cc:257
Adjust improperly justified parameters.
Definition: coreaction.hh:878
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:618
void setVarnode(Varnode *v, int4 tCode)
Attach this to given Varnode and set initial values.
Definition: rangeutil.cc:1489
virtual void saveXmlAttributes(ostream &s, uintb offset, int4 size) const
Save an address and size as XML.
Definition: op.hh:36
void restoreXmlScope(const Element *el, Scope *new_scope)
Register and fill out a single Scope from XML.
Definition: database.cc:3129
A manager for different address spaces.
Definition: translate.hh:218
uint2 catindex
Index within category.
Definition: database.hh:167
uintb addressbase
Starting offset of the range.
Definition: fspec.hh:67
@ extrapop_unknown
Reserved extrapop value meaning the function's extrapop is unknown.
Definition: fspec.hh:636
int4 getDefaultSize(void) const
Get size of addresses for the default space.
Definition: translate.hh:433
int4 sizeIndices
Total number of indices in the table (not including the defaultaddress)
Definition: jumptable.hh:475
VarnodeLocSet::const_iterator beginLoc(const Address &addr) const
Start of Varnodes at a storage address.
Definition: funcdata.hh:310
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:201
void resolveSpacebaseRelative(Funcdata &data, Varnode *phvn)
Calculate the stack offset of this call site.
Definition: fspec.cc:3941
bool checkEZModel(void) const
Check if this flow matches the EX in-lining model.
Definition: flow.cc:1138
virtual void postSpecFile(void)
Let components initialize after Translate is built.
Definition: ghidra_arch.cc:273
P-code injection classes using a Ghidra client as the back-end for generating p-code.
virtual void opIntLess(const PcodeOp *op)
Emit a INT_LESS operator.
Definition: printc.hh:238
int4 getInputBytesConsumed(int4 slot) const
Get the estimated number of bytes within the given parameter that are consumed.
Definition: fspec.cc:4885
virtual void saveXml(ostream &s) const
Save this Symbol to an XML stream.
Definition: database.cc:488
Extension for building an XML format capable Architecture.
Definition: xml_arch.hh:22
void inlineEZClone(const FlowInfo &inlineflow, const Address &calladdr)
Clone the given in-line flow into this flow using the EZ model.
Definition: flow.cc:1081
bool updateLoopBody(void)
Find likely unstructured edges within the innermost loop body.
Definition: blockaction.cc:1186
int4 xml_parse(istream &i, ContentHandler *hand, int4 dbg=0)
Start-up the XML parser given a stream and a handler.
void setPcodeOp(PcodeOp *o, int4 slt)
Establish read this value set corresponds to.
Definition: rangeutil.cc:1767
virtual ~ActionGroup(void)
Destructor.
Definition: action.cc:356
void setSendCCode(bool val)
Toggle whether the recovered source code is emitted as part of the main decompile action.
Definition: ghidra_arch.hh:114
Address restricted_usepoint
A usepoint reference for storage locations (usually function entry -1)
Definition: fspec.hh:1082
virtual void tagLine(int4 indent)
Force a line break and indent level.
Definition: prettyprint.hh:229
Funcdata & data
The function being flow-followed.
Definition: flow.hh:80
void print(const TokenSplit &tok)
Output the given token to the low-level emitter.
Definition: prettyprint.cc:602
void rebuild(const Varnode *vn)
Reset this based on def-use of a single Varnode.
Definition: cover.cc:427
int4 var1
Variable with 1 coefficient.
Definition: coreaction.cc:23
void replace(Varnode *oldvn, Varnode *newvn)
Replace every read of one Varnode with another.
Definition: varnode.cc:956
CommentSorter commsorter
Container/organizer for comments in the current function.
Definition: printc.hh:122
int4 max
Size of the array.
Definition: prettyprint.hh:609
@ baddata_present
Indicate we have encountered flow into unaccessible data.
Definition: flow.hh:65
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:387
void replaceInput(ReplaceVarnode *rvn)
Replace an input Varnode in the subgraph with a temporary register.
Definition: subflow.cc:1154
static OpToken remequal
The in-place modulo operator.
Definition: printc.hh:102
virtual void tagOp(const char *ptr, syntax_highlight hl, const PcodeOp *op)
Emit an operation token.
Definition: prettyprint.cc:177
ScopeMap children
Sorted list of child scopes.
Definition: database.hh:418
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:365
uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering a constant input value.
Definition: typeop.hh:91
virtual int4 flipInPlaceTest(vector< PcodeOp * > &fliplist) const
Test normalizing the conditional branch in this.
Definition: block.hh:743
static const Scope * stackContainer(const Scope *scope1, const Scope *scope2, const Address &addr, int4 size, const Address &usepoint, SymbolEntry **addrmatch)
Definition: database.cc:875
Varnode * getTypeRepresentative(void) const
Get a member Varnode with the strongest data-type.
Definition: variable.cc:122
void endBlock(int4 id)
Create an "end control-flow element" command.
Definition: prettyprint.hh:383
bool istrivial
true if we use a trivial value model
Definition: jumptable.hh:432
static void initializeAll(void)
Finish initialization for all extension points.
Definition: capability.cc:38
virtual ~PcodeInjectLibrary(void)
Destructor.
Definition: pcodeinject.cc:175
static void readToResponse(istream &s)
Read the query response protocol marker.
Definition: ghidra_arch.cc:178
virtual void saveXml(ostream &s) const
Save this Symbol to an XML stream.
Definition: database.cc:638
static OpToken binary_plus
The binary addition operator.
Definition: printc.hh:81
CPUI_FLOAT_DIV behavior.
Definition: opbehavior.hh:396
virtual void saveXml(ostream &s) const
Definition: xml_arch.cc:94
int4 beginStatement(const PcodeOp *o)
Create a "begin source code statement" command.
Definition: prettyprint.hh:416
vector< GuardRecord > selectguards
Any guards associated with model.
Definition: jumptable.hh:348
bool callOpIndirectEffect(const Address &addr, int4 size, PcodeOp *op) const
Determine if the address range is affected by the given call p-code op.
Definition: heritage.cc:203
ValueSet * valueSet
Value set associated with this when performing Value Set Analysis.
Definition: varnode.hh:141
int4 recoverystage
0=no stages recovered, 1=additional stage needed, 2=complete
Definition: jumptable.hh:524
void universal_action(Architecture *conf)
The generic decompilation action.
Definition: coreaction.cc:4769
virtual ParamList * clone(void) const =0
Clone this parameter list model.
static Document * readXMLStream(istream &s)
Receive an XML document from the client.
Definition: ghidra_arch.cc:116
@ pop_success
Backtracking, from path that contained a reasonable ancestor.
Definition: funcdata.hh:599
virtual void opIntDiv(const PcodeOp *op)=0
Emit a INT_DIV operator.
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:1510
void addAction(Action *ac)
Add an Action to the group.
Definition: action.cc:368
@ smallsize_floatext
Assume values smaller than max size are floating-point extended to full size.
Definition: fspec.hh:57
void getChunk(uintb offset, int4 size, uint1 *res) const
Retrieve an arbitrary sequence of bytes.
Definition: memstate.cc:333
int4 getAlignment(void) const
Get the instruction alignment for the processor.
Definition: translate.hh:581
ProtoModel * evalfp_called
Function proto to use when evaluating called functions.
Definition: architecture.hh:141
void printRaw(ostream &s) const
Write a text representation of this to stream.
Definition: rangeutil.cc:1456
CPUI_INT_LESSEQUAL behavior.
Definition: opbehavior.hh:166
void registerCallFixup(const string &fixupName, int4 injectid)
Map a call-fixup name to a payload id.
Definition: pcodeinject.cc:187
virtual bool possibleParam(const Address &loc, int4 size) const
Does the given storage location make sense as a parameter.
Definition: fspec.cc:1197
Address pc
Program counter at start of instruction.
Definition: address.hh:112
const Varnode * vn
Associated Varnode.
Definition: prettyprint.hh:333
Search for input Varnodes that have been officially provided constant values.
Definition: coreaction.hh:253
virtual void markLabelBumpUp(bool bump)
Let hierarchical blocks steal labels of their (first) components.
Definition: block.cc:247
PcodeOp * target(void) const
Return starting op for instruction associated with this op.
Definition: op.cc:260
void remove13Refinement(vector< int4 > &refine)
If we see 1-3 or 3-1 pieces in the partition, replace with a 4.
Definition: heritage.cc:1447
rangemap< SymbolEntry > EntryMap
A rangemap of SymbolEntry.
Definition: database.hh:141
A basic instantiation of a breakpoint table.
Definition: emulate.hh:137
Cover wholecover
The ranges of code addresses covered by this HighVariable.
Definition: variable.hh:65
void open(void)
Open any descriptors.
Definition: loadimage_ghidra.cc:25
void dedupUnprocessed(void)
Get rid of duplicates in the unprocessed list.
Definition: flow.cc:839
virtual void restoreXmlBody(List::const_iterator &iter, List::const_iterator enditer, BlockMap &resolver)
Restore details about this FlowBlock from an XML stream.
Definition: block.cc:1293
uintm getUniqueBase(void) const
Get the base offset for new temporary registers.
Definition: translate.hh:591
const ProtoModel * model
Prototype model to score against.
Definition: fspec.hh:858
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:599
virtual int4 localExtensionType(const Varnode *vn) const =0
Decide on integer promotion by examining just local properties of the given Varnode.
int4 size
Size of ptr type in question.
Definition: ruleaction.hh:34
uint4 maxext
Maximum extensions to normalize.
Definition: jumptable.hh:523
int4 slot
slot being affected or other parameter
Definition: subflow.hh:77
map< Varnode *, ReplaceVarnode > varmap
Map from original Varnodes to the overlaying subgraph nodes.
Definition: subflow.hh:86
CPUI_INT_SLESSEQUAL behavior.
Definition: opbehavior.hh:152
Two conditional blocks combined into one conditional using BOOL_AND or BOOL_OR.
Definition: block.hh:516
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:481
BlockBasic * joinblock
The new joined condition block.
Definition: blockaction.hh:251
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3164
void checkOutputTrialUse(Funcdata &data, vector< Varnode * > &trialvn)
Mark if output trials are being actively used.
Definition: fspec.cc:4689
virtual void buildTypegrp(DocumentStorage &store)
Build the data-type factory/container.
Definition: architecture.cc:540
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: action.cc:873
int4 defaultBlock
The out-edge corresponding to the default switch destination (-1 = undefined)
Definition: jumptable.hh:518
bool buildLoad(PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes)
Split a given CPUI_LOAD operation into a sequence of LOADs of individual lanes.
Definition: subflow.cc:2211
void clearProperties(void)
Clear any discovered flow properties.
Definition: flow.cc:76
void analyzeNewLoadGuards(void)
Make final determination of what range new LoadGuards are protecting.
Definition: heritage.cc:682
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:402
@ nonprinting
Op should not be directly printed as source.
Definition: op.hh:89
bool operator<(const MergePair &op2) const
Lexicographic comparator.
Definition: blockaction.cc:1878
SleighArchitecture(const string &fname, const string &targ, ostream *estream)
Construct given executable file.
Definition: sleigh_arch.cc:288
Mark all the implied Varnode objects, which will have no explicit token in the output.
Definition: coreaction.hh:437
void saveXml(ostream &s) const
Write out the SLEIGH specification as an XML <sleigh> tag.
Definition: sleighbase.cc:143
Attempt to normalize symmetric block structures.
Definition: blockaction.hh:285
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:564
static bool compareByPosition(const IndexPair &op1, const IndexPair &op2)
Compare just by position.
Definition: jumptable.hh:582
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:897
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: double.hh:306
FlowBlock * resolveBlock(FlowBlock::block_type bt)
Construct a FlowBlock of the given type.
Definition: block.cc:3192
virtual uintb find(uintb addr) const
Overridden find method.
Definition: memstate.cc:363
@ indirect_source
Op is source of (one or more) CPUI_INDIRECTs.
Definition: op.hh:79
void addOtherSpace(void)
Add OTHER space and all of its overlays to the symboltab.
Definition: architecture.cc:813
virtual void opFloatAbs(const PcodeOp *op)
Emit a FLOAT_ABS operator.
Definition: printc.hh:274
Funcdata * getFunction(void)
Get the underlying Funcdata object.
Definition: database.cc:562
void collapseConditions(void)
Simplify conditionals.
Definition: blockaction.cc:1834
void restoreXml(const Element *el, Architecture *glb)
Restore this from an XML stream.
Definition: fspec.cc:3741
void floatExtensionRead(Varnode *vn, JoinRecord *joinrec)
Create float truncation into a free lower precision join-space Varnode.
Definition: heritage.cc:1792
void saveXml(ostream &s, Architecture *glb) const
Write the override commands to an XML stream.
Definition: override.cc:284
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:357
void guardCalls(uint4 flags, const Address &addr, int4 size, vector< Varnode * > &write)
Guard CALL/CALLIND ops in preparation for renaming algorithm.
Definition: heritage.cc:1082
static bool spanAddTree(PcodeOp *op, AddTreeState *state)
Traverse the additive expression accumulating offset information.
Definition: ruleaction.cc:5724
static OpToken boolean_and
The boolean and operator.
Definition: printc.hh:94
vector< TypeField > field
The list of fields.
Definition: type.hh:304
virtual int4 getTableSize(void) const
Return the number of entries in the address table.
Definition: jumptable.hh:481
static void deconstructValue(uint1 *ptr, uintb val, int4 size, bool bigendian)
Encode value to bytes.
Definition: memstate.cc:51
int4 getDelay(void) const
Get number of heritage passes being delayed.
Definition: space.hh:300
map< int4, CoverBlock > cover
block index -> CoverBlock
Definition: cover.hh:69
LoadImage * loader
Method for loading portions of binary.
Definition: architecture.hh:144
virtual void opCallind(const PcodeOp *op)
Emit a CALLIND operator.
Definition: printjava.cc:227
@ merge_problems
Set if some SymbolEntrys did not get merged.
Definition: database.hh:184
PcodeOpTree::const_iterator beginAll(void) const
Start of all PcodeOps in sequence number order.
Definition: op.hh:279
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:1160
int4 max_basetype_size
Maximum size of an "integer" type before creating an array type.
Definition: architecture.hh:125
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6166
Pull SUBPIECE back through MULTIEQUAL.
Definition: ruleaction.hh:222
virtual void printUnicode(ostream &s, int4 onechar) const
Print a single unicode character as a character constant for the high-level language.
Definition: printjava.cc:152
void opHiddenFunc(const PcodeOp *op)
Push the given p-code op as a hidden token.
Definition: printc.cc:332
int4 pass
Current pass being executed.
Definition: heritage.hh:209
void addDescend(PcodeOp *op)
Add a descendant (reading) PcodeOp to this Varnode's list.
Definition: varnode.cc:303
void spacebaseConstant(PcodeOp *op, int4 slot, SymbolEntry *entry, const Address &rampoint, uintb origval, int4 origsize)
Convert a constant pointer into a ram CPUI_PTRSUB.
Definition: funcdata.cc:291
Varnode * newConstant(int4 s, uintb constant_val)
Create a new constant Varnode.
Definition: funcdata_varnode.cc:64
bool preferred(const RangeHint *b, bool reconcile) const
Return true if the this range's data-type is preferred over the other given range.
Definition: varmap.cc:73
virtual void addRegister(const string &nm, AddrSpace *base, uintb offset, int4 size)
Add a named register to the model for this processor.
Definition: sleighbase.cc:85
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4466
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1085
A generic functional operator.
Definition: typeop.hh:189
uintm uniqid
Counter for producing unique id's for each op.
Definition: op.hh:253
virtual void findByName(const string &name, vector< Symbol * > &res) const
Find a Symbol by name within this Scope.
Definition: database_ghidra.hh:91
virtual void executeIndirect(void)=0
Standard behavior for an INDIRECT op.
@ booloutput
Boolean operation.
Definition: op.hh:76
@ addrforce
Varnode is used to force variable into an address.
Definition: varnode.hh:97
A function prototype.
Definition: fspec.hh:1147
An implementation of the ConstantPool interface storing records internally in RAM.
Definition: cpool.hh:155
int4 typeCode
The constraint characteristic 0=absolute 1=relative to a spacebase register.
Definition: rangeutil.hh:122
Exception thrown is there are no legal flows to a switch.
Definition: jumptable.hh:33
void fillinBranchStubs(void)
Fill-in artificial HALT p-code for unprocessed addresses.
Definition: flow.cc:862
virtual void flipInPlaceExecute(void)
Perform the flip to normalize conditional branch executed by this block.
Definition: block.cc:2264
vector< FuncCallSpecs * > qlst
List of calls this function makes.
Definition: funcdata.hh:73
static int4 tracePathologyForward(PcodeOp *op, Funcdata &data)
Given a known pathological concatenation, trace it forward to CALLs and RETURNs.
Definition: ruleaction.cc:8755
bool getBiggestContainedInputParam(const Address &loc, int4 size, VarnodeData &res) const
Pass-back the biggest potential input parameter contained within the given range.
Definition: fspec.cc:3534
@ unimplemented_present
Indicate we have encountered unimplemented instructions.
Definition: flow.hh:64
virtual void clearUnlocked(void)
Clear all unlocked symbols from this scope.
Definition: database.cc:1923
virtual void executeStore(void)=0
Standard behavior for a p-code STORE.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:7506
virtual Translate * buildTranslator(DocumentStorage &store)
Build the Translator object.
Definition: sleigh_arch.cc:148
void closeGroup(int4 id)
Create an "end a printing group" command.
Definition: prettyprint.hh:541
virtual void executeLoad(void)
Standard behavior for a p-code LOAD.
Definition: emulate.cc:235
bool emitInplaceOp(const PcodeOp *op)
Attempt to emit an expression rooted at an in-place operator.
Definition: printc.cc:2027
Simplify predication constructions involving the INT_OR operator.
Definition: condexe.hh:211
@ other_space_index
Reserved index for the other space.
Definition: space.hh:91
uintb evaluate(const vector< uintb > &input)
Evaluate the snippet on the given inputs.
Definition: pcodeinject.cc:159
BlockIf * newBlockIfElse(FlowBlock *cond, FlowBlock *tc, FlowBlock *fc)
Build a new BlockIfElse.
Definition: block.cc:1733
string error
The last error condition returned by the parser (if not empty)
Definition: xml.hh:220
void close(void)
Close any descriptor.
Definition: loadimage_ghidra.cc:30
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)=0
Attempt to recover details of the model, given a specific BRANCHIND.
Address eaddr
End of range in which we are allowed to flow.
Definition: flow.hh:95
static Varnode * findPreexistingWhole(Varnode *vn1, Varnode *vn2)
Check if given two Varnodes are merged into a whole.
Definition: fspec.cc:4772
static bool isStackRelative(Varnode *spcbasein, Varnode *vn, uintb &constval)
Is the given Varnode defined as a pointer relative to the stack-pointer?
Definition: coreaction.cc:326
@ unsignedprint
Constant that must be explicitly printed as unsigned.
Definition: varnode.hh:118
void removeBranch(BlockBasic *bb, int4 num)
Remove the indicated branch from a basic block.
Definition: funcdata_block.cc:215
Information about the FLOAT_NOTEQUAL op-code.
Definition: typeop.hh:552
void setModelLock(bool val)
Toggle the lock on the prototype model for this.
Definition: fspec.hh:1208
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:190
void saveXmlHeader(ostream &s) const
Write out (as XML) basic attributes of the active executable.
Definition: sleigh_arch.cc:314
virtual bool isCharacterConstant(const uint1 *buf, int4 size, int4 charsize) const =0
Decide is the given byte array looks like a character string.
virtual void processingInstruction(const string &target, const string &data)
Callback for a formal processing instruction seen in the current document.
Definition: xml.hh:235
virtual bool isNameUsed(const string &name) const
Check if the given name is used within this scope.
Definition: database.cc:2280
ConstantPool * cpool
Deferred constant values.
Definition: architecture.hh:148
Information about the INT_SDIV op-code.
Definition: typeop.hh:493
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:6211
RecovError(const string &s)
Initialize the error with an explanatory string.
Definition: error.hh:57
bool isInstructionStart(void) const
Return true if we are at an instruction start.
Definition: emulate.hh:330
type_metatype metain
The metatype of the inputs.
Definition: typeop.hh:191
void finalizeRange(const ValueSetRead &valueSet)
Convert value set analysis to final guard range.
Definition: heritage.cc:635
const Varnode * vn
A Varnode associated with the token.
Definition: printlanguage.hh:200
virtual ProtoParameter * getOutput(void)
Get the return-value description.
Definition: fspec.cc:2564
Funcdata * fd
Containing function.
Definition: subflow.hh:85
string currentactname
The name associated with the current root Action.
Definition: action.hh:296
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:1549
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2236
static OpToken hidden
Hidden functional (that may force parentheses)
Definition: printc.hh:65
virtual JumpModel * clone(JumpTable *jt) const
Clone this model.
Definition: jumptable.cc:1879
virtual void opPopcountOp(const PcodeOp *op)
Emit a POPCOUNT operator.
Definition: printc.hh:294
Varnode * findInput(int4 s, const Address &loc) const
Find an input Varnode.
Definition: varnode.cc:1089
virtual void opNewOp(const PcodeOp *op)
Emit a NEW operator.
Definition: printc.cc:937
static Varnode * getBooleanResult(Varnode *vn, int4 bitPos, int4 &constRes)
Extract boolean Varnode producing bit at given Varnode and position.
Definition: ruleaction.cc:8583
bool pushConstFurther(Funcdata &data, TypePointer *outtype, PcodeOp *op, int4 slot, uintb val)
Try to push constant pointer further.
Definition: ruleaction.cc:6354
TypeOpBoolNegate(TypeFactory *t)
Constructor.
Definition: typeop.cc:1328
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:788
TypeOpIntNegate(TypeFactory *t)
Constructor.
Definition: typeop.cc:1063
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:683
virtual void opCallother(const PcodeOp *op)=0
Emit a CALLOTHER operator.
Information about the INT_ADD op-code.
Definition: typeop.hh:367
type_metatype type
Data-type class that this entry must match.
Definition: fspec.hh:63
Varnode * side2
Varnode coming from block2.
Definition: blockaction.hh:236
SymbolNameTree::const_iterator findFirstByName(const string &name) const
Find an iterator pointing to the first Symbol in the ordering with a given name.
Definition: database.cc:2592
TypeFactory * tlst
Type factory associated with the Architecture.
Definition: cast.hh:54
CPUI_INT_SCARRY behavior.
Definition: opbehavior.hh:212
virtual void executeCallind(void)
Standard behavior for a CALLIND.
Definition: emulate.cc:283
int4 missedvariables
Number of variables for which we are missing an equation.
Definition: coreaction.cc:37
static bool needZeroArray(const Varnode *vn)
Do we need '[0]' syntax.
Definition: printjava.cc:139
void xrefInlinedBranch(PcodeOp *op)
Check for control-flow in a new injected p-code op.
Definition: flow.cc:1026
@ m_maximal
Biggest possible address.
Definition: address.hh:54
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2424
virtual int4 openGroup(void)
Start a group of things that are printed together.
Definition: prettyprint.cc:1092
void removeRange(AddrSpace *spc, uintb first, uintb last)
Remove a range of addresses.
Definition: address.cc:351
@ force_left_justify
Big endian values are left justified within their slot.
Definition: fspec.hh:51
A light-weight class for analyzing pointers and aliasing on the stack.
Definition: varmap.hh:108
void opUnsetInput(PcodeOp *op, int4 slot)
Clear an input operand slot for the given PcodeOp.
Definition: funcdata_op.cc:90
void setDeadcodeDelay(AddrSpace *spc, int4 delaydelta)
Set the deadcodedelay for a specific space.
Definition: translate.cc:701
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:434
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:274
Varnode * newVarnodeIop(PcodeOp *op)
Create a PcodeOp annotation Varnode.
Definition: funcdata_varnode.cc:165
@ processing_complete
Set if processing completed.
Definition: funcdata.hh:51
BlockTrace * selectBadEdge(void)
Select the the most likely unstructured edge from active BlockTraces.
Definition: blockaction.cc:723
virtual void executeCall(void)=0
Standard behavior for a p-code CALL.
map< ScopeKey, Scope * > ScopeMap
A map from ScopeKey to Scope.
Definition: database.hh:390
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:1011
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4779
BranchPoint * parent
The parent BranchPoint along which this is only one path.
Definition: blockaction.hh:101
@ indirectonly
If all uses of illegalinput varnode are inputs to INDIRECT.
Definition: varnode.hh:95
Information about the FLOAT_LESS op-code.
Definition: typeop.hh:559
bool lastvalue
true is the extra value has been visited by the iterator
Definition: jumptable.hh:207
string getRegisterName(const VarnodeData &vndata)
Retrieve a register name given its storage location.
Definition: ghidra_arch.cc:389
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:391
virtual void opFloatMult(const PcodeOp *op)
Emit a FLOAT_MULT operator.
Definition: printc.hh:271
virtual Datatype * arithmeticOutputStandard(const PcodeOp *op)
What is the output data-type produced by the given integer arithmetic operation.
Definition: cast.cc:289
PrintJava(Architecture *g, const string &nm="java-language")
Constructor.
Definition: printjava.cc:37
void establishRange(const ValueSetRead &valueSet)
Convert partial value set analysis into guard range.
Definition: heritage.cc:588
bool loadersymbols_parsed
True if loader symbols have been read.
Definition: architecture.hh:157
virtual void emitBlockCondition(const BlockCondition *bl)
Emit a conditional statement.
Definition: printc.cc:2449
PcodeOp * opstate[2]
p-code operations along the critical path
Definition: condexe.hh:43
Contents of a <compiler> tag in a .ldefs file.
Definition: sleigh_arch.hh:29
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:907
void setDeadCodeDelay(AddrSpace *spc, int4 delay)
Set a delay before removing dead code for a specific address space.
Definition: funcdata.hh:219
void selfIdentify(void)
Inherit our edges from the edges of our components.
Definition: block.cc:820
int4 res
Success status returned to the client (0=success)
Definition: ghidra_process.hh:138
void trimOpOutput(PcodeOp *op)
Trim the output HighVariable of the given PcodeOp so that its Cover is tiny.
Definition: merge.cc:552
static uint1 * readPackedAll(istream &s)
Read a whole response as packed p-code op information.
Definition: ghidra_arch.cc:222
@ f_loop_exit_edge
Edge exits the body of a loop.
Definition: block.hh:104
virtual void endDocument(int4 id)
End a whole document of output.
Definition: prettyprint.hh:224
Symbol * symbol
The symbol being mapped.
Definition: database.hh:70
virtual bool getBiggestContainedParam(const Address &loc, int4 size, VarnodeData &res) const
Pass-back the biggest parameter contained within the given range.
Definition: fspec.cc:947
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:877
string name
The name of the high-level language.
Definition: printlanguage.hh:231
void saveXml(ostream &s) const
Save this to an XML stream.
Definition: database.cc:176
LocationMap globaldisjoint
Disjoint cover of every heritaged memory location.
Definition: heritage.hh:202
TypeOpStore(TypeFactory *t)
Constructor.
Definition: typeop.cc:423
@ presurround
Modifier form (like a cast operation)
Definition: printlanguage.hh:88
AddrSpace * contain
Containing space.
Definition: translate.hh:172
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1113
@ rule_warnings_on
If this action makes a change, issue a warning.
Definition: action.hh:58
virtual void saveXml(ostream &s) const
Serialize the entire database to an XML stream.
Definition: globalcontext.cc:490
virtual void retypeSymbol(Symbol *sym, Datatype *ct)=0
Change the data-type of a Symbol within this Scope.
ParamTrial splitHi(int4 sz) const
Create a trial representing the first part of this.
Definition: fspec.cc:1307
virtual JumpModel * clone(JumpTable *jt) const =0
Clone this model.
int4 leastsigbit_set(uintb val)
Return index of least significant bit set in given value.
Definition: address.cc:684
Varnode * createDef(int4 s, const Address &m, Datatype *ct, PcodeOp *op)
Create a Varnode as the output of a PcodeOp.
Definition: varnode.cc:1035
uintb multsum
Sum of multiple constants.
Definition: ruleaction.hh:38
Varnode * newSpacebasePtr(AddrSpace *id)
Construct a new spacebase register for a given address space.
Definition: funcdata.cc:247
@ f_back_edge
Within (reducible) graph, a back edge defining a loop.
Definition: block.hh:103
uintb right
Right boundary of the open range [left,right)
Definition: rangeutil.hh:50
int4 trialNorm(Funcdata *fd, Varnode *trialvn, uint4 tolerance)
Test a given Varnode as a potential normalized switch variable.
Definition: jumptable.cc:1695
virtual void opFloatFloat2Float(const PcodeOp *op)
Emit a FLOAT_FLOAT2FLOAT operator.
Definition: printc.hh:277
A token representing an operator in the high-level language.
Definition: printlanguage.hh:81
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:2010
int4 getIndentIncrement(void) const
Get the number of characters indented per level of nesting.
Definition: prettyprint.hh:207
StackNode(Varnode *v, uintb o, uint4 trav)
Constructor.
Definition: heritage.hh:193
MemoryState * getMemoryState(void) const
Get the emulator's memory state.
Definition: emulate.hh:269
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: coreaction.hh:816
void restoreFromSpec(DocumentStorage &store)
Fully initialize the Translate object.
Definition: architecture.cc:610
Database * symboltab
Memory map of global variables and functions.
Definition: architecture.hh:135
virtual JumpModel * clone(JumpTable *jt) const
Clone this model.
Definition: jumptable.cc:1485
@ badinstruction
placeholder for bad instruction data
Definition: op.hh:91
type_metatype
Definition: type.hh:33
Convert INT_MULT and shift forms into INT_DIV or INT_SDIV.
Definition: ruleaction.hh:1162
virtual bool stackGrowsNegative(void) const
Return true if a stack in this space grows negative.
Definition: translate.hh:184
map< Address, vector< Varnode * > > VariableStack
Definition: heritage.hh:27
int4 numHeritagePasses(AddrSpace *spc)
Get the number of heritage passes performed for the given address space.
Definition: funcdata.hh:208
vector< PrintLanguage * > printlist
List of high-level language printers supported.
Definition: architecture.hh:150
const VarnodeData & cacheRegister(const string &nm, const VarnodeData &data) const
Associate a Varnode with a register name.
Definition: ghidra_translate.cc:24
bool ancestorOpUse(int4 maxlevel, const Varnode *invn, const PcodeOp *op, ParamTrial &trial) const
Test if the given trial Varnode is likely only used for parameter passing.
Definition: funcdata_varnode.cc:1484
int4 b_in1
In edge of exitb coming from block1.
Definition: blockaction.hh:247
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:597
Get rid of redundant branches: duplicate edges between the same input and output block.
Definition: coreaction.hh:501
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:301
virtual void endStatement(int4 id)
End a source code statement.
Definition: prettyprint.hh:236
Datatype * type
The data-type for this.
Definition: variable.hh:63
void mapGlobals(void)
Make sure there is a Symbol entry for all global Varnodes.
Definition: funcdata_varnode.cc:1302
void clear(void)
Clear all PcodeOps from this container.
Definition: op.cc:925
virtual void assignMap(const vector< Datatype * > &proto, bool isinput, TypeFactory &typefactory, vector< ParameterPieces > &res) const
Given list of data-types, map the list positions to storage locations.
Definition: fspec.cc:534
IntPromotionCode
Types of integer promotion.
Definition: cast.hh:46
SymbolEntry(Symbol *sym)
Construct a mapping for a Symbol without an address.
Definition: database.cc:25
virtual void executeCpoolRef(void)
Standard behavior for a CPOOLREF (constant pool reference) op.
Definition: emulate.cc:314
virtual void clearUnlockedCategory(int4 cat)
Clear unlocked symbols of the given category from this scope.
Definition: database.cc:1945
Infer and propagate data-types.
Definition: coreaction.hh:920
AddrSpace * defaultcodespace
Default space where code lives, generally main RAM.
Definition: translate.hh:224
bool checkArrayDeref(const Varnode *vn) const
Determine whether a LOAD/STORE expression requires pointer '*' syntax.
Definition: printc.cc:268
virtual void endFunction(int4 id)
End a whole declaration and body of a function.
Definition: prettyprint.cc:879
void commitNewInputs(Funcdata &data, vector< Varnode * > &newinput)
Update input Varnodes to this CALL to reflect the formal input parameters.
Definition: fspec.cc:4220
Datatype * dataType
Temporary data-type associated with this for use in type propagate algorithm.
Definition: varnode.hh:140
Address assignAddress(const Datatype *tp, vector< int4 > &status) const
Assign storage for given parameter data-type.
Definition: fspec.cc:510
Address maxaddr
End of actual function range.
Definition: flow.hh:97
string name
Formal name of the payload.
Definition: pcodeinject.hh:87
uint4 flags
Additional boolean properties on the record.
Definition: cpool.hh:65
Information about the INT_OR op-code.
Definition: typeop.hh:439
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1318
virtual void fallthruOp(void)
Standard p-code fall-thru semantics.
Definition: emulateutil.cc:282
virtual bool checkSplit(const Address &loc, int4 size, int4 splitpoint) const
Check if it makes sense to split a single storage location into two parameters.
Definition: fspec.cc:914
Remove PTRADD operations with mismatched data-type information.
Definition: ruleaction.hh:1028
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:339
@ CALLFIXUP_TYPE
Injection that replaces a CALL.
Definition: pcodeinject.hh:81
uintb offset
Offset (in bytes)
Definition: address.hh:49
Datatype * type
The symbol's data-type.
Definition: database.hh:160
void sortList(void)
Sort the list of FlowBlock objects.
Definition: block.cc:3231
void setInitialRange(const Address &beg, const Address &end)
Set the initial address range of the block.
Definition: block.cc:2511
Information about the BOOL_OR op-code.
Definition: typeop.hh:538
virtual void pushUnnamedLocation(const Address &addr, const Varnode *vn, const PcodeOp *op)
Push an address as a substitute for a Symbol onto the RPN stack.
Definition: printc.cc:1606
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:693
void pushVnLHS(const Varnode *vn, const PcodeOp *op)
Push a variable as the left-hand side of an expression.
Definition: printlanguage.cc:241
virtual SymbolEntry * addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a memory range.
Definition: database_ghidra.hh:52
Varnode * newVarnodeSpace(AddrSpace *spc)
Create a constant Varnode referring to an address space.
Definition: funcdata_varnode.cc:179
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:515
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8827
list< PcodeOp * >::const_iterator endOpAlive(void) const
End of PcodeOp objects in the alive list.
Definition: funcdata.hh:458
virtual void emit(PrintLanguage *lng) const
Emit the instructions in this FlowBlock as structured code.
Definition: block.hh:619
void markUnaliased(const vector< uintb > &alias)
Mark all local symbols for which there are no aliases.
Definition: varmap.cc:1080
virtual void categorySanity(void)
Make sure Symbol categories are sane.
Definition: database.cc:1873
vector< string > attr
A list of attribute names for this element.
Definition: xml.hh:153
bool sendsyntaxtree
True if the syntax tree should be sent with function output.
Definition: ghidra_arch.hh:68
bool useSameAddress(ReplaceVarnode *rvn)
Decide if we use the same memory range of the original Varnode for the logical replacement.
Definition: subflow.cc:1170
Information about the CPOOLREF op-code.
Definition: typeop.hh:761
A jump-table starting range with two possible execution paths.
Definition: jumptable.hh:203
set< Address > * inline_recursion
Active list of addresses for function that are in-lined.
Definition: flow.hh:101
virtual FlowBlock * getSplitPoint(void)
Get the leaf splitting block.
Definition: block.hh:526
list< BlockTrace * >::iterator openBranch(BlockTrace *parent)
Open a new BranchPoint along a given BlockTrace.
Definition: blockaction.cc:832
Simplify INT_LESSEQUAL applied to extremal constants.
Definition: ruleaction.hh:954
Varnode * index
The index value or NULL.
Definition: varmap.hh:113
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:769
virtual void setCommentStyle(const string &nm)
Set the way comments are displayed in decompiler output.
Definition: printc.cc:1940
uint4 cast_phase_index
Creation index of first Varnode created after ActionSetCasts.
Definition: funcdata.hh:65
@ EITHER_EXTENSION
The value is promoted using either signed or unsigned extension.
Definition: cast.hh:51
const Element * rootel
The root XML element.
Definition: loadimage_xml.hh:29
void print(ostream &s) const
Dump a description to stream.
Definition: cover.cc:186
Simplify break and rejoin: concat( sub(V,c), sub(V,0) ) => V
Definition: ruleaction.hh:874
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:551
void restoreXmlHeader(const Element *el)
Restore basic Symbol properties from XML.
Definition: database.cc:373
static int4 repair(Funcdata &data, AddrSpace *id, Varnode *spcbasein, PcodeOp *loadop, uintb constz)
Link LOAD to matching STORE of a constant.
Definition: coreaction.cc:375
virtual void saveXml(ostream &s) const
Definition: space.cc:378
TypeOpIndirect(TypeFactory *t)
Constructor.
Definition: typeop.cc:1507
@ has_thisptr
First parameter ( getIn(1) ) is a this pointer.
Definition: op.hh:103
The attributes for a single XML element.
Definition: xml.hh:36
@ explict
This varnode CANNOT be a temporary variable.
Definition: varnode.hh:80
static string normalizeSize(const string &nm)
Try to recover a language id size field.
Definition: sleigh_arch.cc:359
virtual void nameFunction(const Address &addr, string &name) const
Pick a default name for a function.
Definition: architecture.cc:462
uintb stackoffset
Relative offset of stack-pointer at time of this call.
Definition: fspec.hh:1442
The base class for a symbol in a symbol table or scope.
Definition: database.hh:153
AddrSpace * stackspace
Stack space associated with stack-pointer register.
Definition: coreaction.hh:83
bool isExtraOut(void) const
Is this Varnode created indirectly by a CALL operation?
Definition: varnode.hh:250
virtual list< SymbolEntry >::const_iterator beginDynamic(void) const
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:96
void collectCovering(vector< Varnode * > &vlist, HighVariable *high, PcodeOp *op)
Collect all instances of the given HighVariable whose Cover intersects a p-code op.
Definition: merge.cc:670
bool commentmode
true if in the middle of a comment
Definition: prettyprint.hh:711
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:4634
bool checkCopyPair(HighVariable *high, PcodeOp *domOp, PcodeOp *subOp)
Check if the given PcodeOp COPYs are redundant.
Definition: merge.cc:1010
BranchPoint * top
Parent BranchPoint for which this is a path.
Definition: blockaction.hh:127
bool leftIsStable
Set to true if left boundary of range didn't change (last iteration)
Definition: rangeutil.hh:184
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:274
void updateType(void) const
(Re)derive the data-type for this from the member Varnodes
Definition: variable.cc:145
Try to merge the input and output Varnodes of a CPUI_COPY op.
Definition: coreaction.hh:373
void buildUnaryOp(OpCode opc, PcodeOp *op, TransformVar *inVars, TransformVar *outVars, int4 numLanes)
Build unary op placeholders with the same opcode across a set of lanes.
Definition: subflow.cc:2039
@ vard_b
Start of a variable declaration.
Definition: prettyprint.hh:303
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3935
vector< int4 > deadcodedelay
Delay count indexed by address space.
Definition: override.hh:52
void saveXml(ostream &s) const
Write out this to an XML stream.
Definition: block.cc:2377
int4 analysisState
0=unanalyzed, 1=analyzed(partial result), 2=analyzed(full result)
Definition: heritage.hh:113
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:4514
int4 missedactivecount
Current number of active BlockTraces that can't be pushed further.
Definition: blockaction.hh:158
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:1054
@ instance_of
Boolean value, token is language specific indicator, type is boolean data-type.
Definition: cpool.hh:54
virtual string getOperatorName(const PcodeOp *op) const
Get the symbol representing this operation in decompiled code.
Definition: userop.cc:55
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6127
Comparator for sorting Symbol objects by name.
Definition: database.hh:309
Toggle whether null pointers should be printed as the string "NULL".
Definition: options.hh:123
virtual Scope * buildGlobalScope(void)
Build the global scope for this executable.
Definition: architecture.cc:525
bool flowsOnlyToModel(Varnode *vn, PcodeOp *trailOp)
Check if the given Varnode flows to anything other than this model.
Definition: jumptable.cc:1236
static int4 doesOrSet(PcodeOp *orop, uintb mask)
Return slot of constant if INT_OR op sets all bits in mask, otherwise -1.
Definition: subflow.cc:23
void sortTerms(void)
Sort the terms using additiveCompare()
Definition: coreaction.cc:4718
void addNoHighPtr(const Range &rng)
Add a new region where pointers do not exist.
Definition: architecture.cc:497
virtual void executeStore(void)
Standard behavior for a p-code STORE.
Definition: emulateutil.cc:76
CPUI_INT_AND behavior.
Definition: opbehavior.hh:247
Propagate conditional constants.
Definition: coreaction.hh:556
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:756
virtual void opIntLessEqual(const PcodeOp *op)=0
Emit a INT_LESSEQUAL operator.
static string generateDeadcodeDelayMessage(int4 index, Architecture *glb)
Generate warning message related to a dead code delay.
Definition: override.cc:41
maptype::const_iterator const_iterator
A constant iterator.
Definition: partmap.hh:52
@ TYPE_BOOL
Boolean.
Definition: type.hh:39
virtual const TrackedSet & getTrackedSet(const Address &addr) const
Get the set of tracked register values associated with the given address.
Definition: globalcontext.hh:296
HighVariable * findHigh(const string &name) const
Find a high-level variable by name.
Definition: funcdata_varnode.cc:303
virtual Address getAddress(void) const =0
Get the storage address for this parameter.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:318
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:399
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:99
virtual InjectContext & getCachedContext(void)
Retrieve a reusable context object for this library.
Definition: inject_ghidra.hh:90
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:35
Information about the FLOAT_FLOAT2FLOAT op-code.
Definition: typeop.hh:636
void visitIncr(FlowBlock *qnode, FlowBlock *vnode)
The heart of the phi-node placement algorithm.
Definition: heritage.cc:1951
const RangeList & uselimit
Reference to the range of code addresses for which the storage is valid.
Definition: database.hh:73
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:419
int4 mismatch
Number of trials that don't fit the prototype model at all.
Definition: fspec.hh:860
TypeOpFloatTrunc(TypeFactory *t, const Translate *trans)
Constructor.
Definition: typeop.cc:1454
uintb pointerBase
Base offset of the pointer.
Definition: heritage.hh:109
@ CPUI_FLOAT_MULT
Floating-point multiplication (*)
Definition: opcodes.hh:95
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:26
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:562
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:652
virtual void executeLoad(void)
Standard behavior for a p-code LOAD.
Definition: emulateutil.cc:64
The Varnode and VarnodeBank classes.
An iterator over values a switch variable can take.
Definition: jumptable.hh:156
@ var_color
Local variable identifiers.
Definition: prettyprint.hh:92
bool operator<(const ToOpEdge &op2) const
Compare two edges based on PcodeOp.
Definition: dynamic.cc:66
@ print_load_value
Hide pointer deref for load with other ops.
Definition: printlanguage.hh:143
set< Varnode *, VarnodeCompareLocDef > VarnodeLocSet
A set of Varnodes sorted by location (then by definition)
Definition: varnode.hh:44
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.cc:957
static int4 countbase
Static counter for uniquely assigning begin/end pair ids.
Definition: prettyprint.hh:345
CPUI_BOOL_XOR behavior.
Definition: opbehavior.hh:327
list< BlockTrace * > activetrace
The list of active BlockTrace objects.
Definition: blockaction.hh:159
typeflags
Properties associated with a Rule.
Definition: action.hh:195
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:374
virtual void buildAddresses(Funcdata *fd, PcodeOp *indop, vector< Address > &addresstable, vector< LoadTable > *loadpoints) const
Construct the explicit list of target addresses (the Address Table) from this model.
Definition: jumptable.cc:1314
iterator add(Address addr, int4 size, int4 pass, int4 &intersect)
Mark new address as heritaged.
Definition: heritage.cc:30
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2970
Class that determines a ValueSet for each Varnode in a data-flow system.
Definition: rangeutil.hh:272
void splitUses(Varnode *vn)
Make all reads of the given Varnode unique.
Definition: funcdata_varnode.cc:1271
vector< EffectRecord > effectlist
Side-effects associated with non-parameter storage locations.
Definition: fspec.hh:1168
virtual void emitVarDecl(const Symbol *sym)
Emit a variable declaration.
Definition: printc.cc:2106
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:3334
bool markExplicitUnsigned(PcodeOp *op, int4 slot) const
Check if a constant input should be explicitly labeled as unsigned.
Definition: typeop.cc:230
virtual void opIntRem(const PcodeOp *op)
Emit a INT_REM operator.
Definition: printc.hh:258
bool isBigEndian(void) const
Is the processor big endian?
Definition: translate.hh:571
@ func_e
End of a function body.
Definition: prettyprint.hh:298
CPUI_INT_NEGATE behavior.
Definition: opbehavior.hh:233
virtual const VarnodeData & getRegister(const string &nm) const
Get a register as VarnodeData given its name.
Definition: ghidra_translate.cc:42
virtual void loadParameters(void)
Read parameters directing command execution.
Definition: ghidra_process.cc:357
uintb calc_mask(int4 size)
Calculate a mask for a given byte size.
Definition: address.hh:467
virtual SymbolEntry * findClosestFit(const Address &addr, int4 size, const Address &usepoint) const
Find Symbol which is the closest fit to the given memory range.
Definition: database_ghidra.hh:82
int4 slotstate[2]
Input Varnode to follow to stay on critical path.
Definition: condexe.hh:45
virtual void opBranchind(const PcodeOp *op)
Emit a BRANCHIND operator.
Definition: printc.cc:440
void insert(FlowBlock *bl, int4 depth)
Insert a block into the queue given its priority.
Definition: heritage.cc:109
vector< VarnodeData * > & varcache
The cache of current varnodes.
Definition: emulate.hh:280
void open(void)
Open the raw file for reading.
Definition: loadimage.cc:56
void findDeterminingVarnodes(PcodeOp *op, int4 slot)
Calculate the initial set of Varnodes that might be switch variables.
Definition: jumptable.cc:506
virtual int4 manualCallOtherFixup(const string &name, const string &outname, const vector< string > &inname, const string &snippet)
Manually add a callother-fixup payload given a compilable snippet of p-code source.
Definition: inject_ghidra.cc:216
PcodeOpTree::const_iterator beginOp(const Address &addr) const
Start of all (alive) PcodeOp objects attached to a specific Address.
Definition: funcdata.hh:473
A container for Varnode objects from a specific function.
Definition: varnode.hh:325
void setSendSyntaxTree(bool val)
Toggle whether the data-flow and control-flow is emitted as part of the main decompile action.
Definition: ghidra_arch.hh:106
vector< TransformVar * > worklist
Pending work list of Varnodes to push the split through.
Definition: subflow.hh:134
EmitXml * lowlevel
The low-level emitter.
Definition: prettyprint.hh:704
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)
Attempt to recover details of the model, given a specific BRANCHIND.
Definition: jumptable.cc:1957
void createEntry(const RangeHint &a)
Create a Symbol entry corresponding to the given (fitted) RangeHint.
Definition: varmap.cc:459
@ overlaybase
This is the base space for overlay space(s)
Definition: space.hh:83
virtual const string & getName(void) const
Get the name of the parameter ("" for return value)
Definition: fspec.hh:972
void opUndoPtradd(PcodeOp *op, bool finalize)
Convert a CPUI_PTRADD back into a CPUI_INT_ADD.
Definition: funcdata_op.cc:529
Datatype * type
Datatype associated with this varnode.
Definition: varnode.hh:134
A record mapping trials to parameter entries in the prototype model.
Definition: fspec.hh:845
bool traceForward(TransformVar *rvn, int4 numLanes, int4 skipLanes)
Push the logical lanes forward through any PcodeOp reading the given variable.
Definition: subflow.cc:2296
@ CPUI_FLOAT_TRUNC
Round towards zero.
Definition: opcodes.hh:103
virtual void opFloatInt2Float(const PcodeOp *op)=0
Emit a FLOAT_INT2FLOAT operator.
virtual ProtoParameter * getOutput(void)=0
Get the return-value description.
void restoreXml(const Element *el)
Read a SLEIGH specification from XML.
Definition: sleighbase.cc:180
virtual JumpValues * clone(void) const =0
Clone this iterator.
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:510
static PcodeOp * findMatch(BlockBasic *bl, PcodeOp *target, Varnode *in)
Find match to CPUI_MULTIEQUAL.
Definition: coreaction.cc:766
vector< Varnode * > inst
The member Varnode objects making up this HighVariable.
Definition: variable.hh:59
ValueSetEdge(ValueSet *node, const vector< ValueSet * > &roots)
Construct an iterator over the outbound edges of the given ValueSet node.
Definition: rangeutil.cc:1896
int4 visited
The current stage of printing for the operator.
Definition: printlanguage.hh:168
Analyze change to the stack pointer across sub-function calls.
Definition: coreaction.hh:82
@ locked_input
Input that exists even if its unused.
Definition: varnode.hh:120
void insertDeadcodeDelay(AddrSpace *spc, int4 delay)
Override the number of passes that are executed before dead-code elimination starts.
Definition: override.cc:69
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:262
virtual void opIntZext(const PcodeOp *op, const PcodeOp *readOp)
Emit a INT_ZEXT operator.
Definition: printc.cc:594
JumpAssistOp(Architecture *g)
Constructor.
Definition: userop.cc:235
Varnode * opStackLoad(AddrSpace *spc, uintb off, uint4 sz, PcodeOp *op, Varnode *stackptr, bool insertafter)
Create a LOAD expression at an offset relative to a spacebase register for a given address space.
Definition: funcdata_op.cc:511
static OpToken type_expr_space
Type declaration involving a space (identifier or adornment)
Definition: printc.hh:110
virtual void setVersion(const string &val)
Set the XML version as specified by the current document.
Definition: xml.hh:236
Varnode * ptr
The pointer varnode.
Definition: ruleaction.hh:33
void updateOpFromSpec(FuncCallSpecs *fc)
Update CALL PcodeOp properties based on its corresponding call specification.
Definition: funcdata.cc:426
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:626
virtual void executeStore(void)
Standard behavior for a p-code STORE.
Definition: emulateutil.cc:196
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:431
BlockBasic * parent
Basic block in which this op is contained.
Definition: op.hh:117
void removeJumpTable(JumpTable *jt)
Remove/delete the given jump-table.
Definition: funcdata_block.cc:62
@ print_store_value
Hide pointer deref for store with other ops.
Definition: printlanguage.hh:144
void solve(void)
Solve the system of equations.
Definition: coreaction.cc:109
virtual void printHeader(ostream &s) const
Print a simple description of this to stream.
Definition: block.cc:2658
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:6675
void parsePreferSplit(const Element *el)
Designate registers to be split.
Definition: architecture.cc:1028
virtual void endStatement(int4 id)
End a source code statement.
Definition: prettyprint.cc:971
int4 pagesize
Number of bytes in an aligned page access.
Definition: memstate.hh:40
A snippet of p-code that can be executed outside of normal analysis.
Definition: pcodeinject.hh:134
Label for describing extent of address range that has been heritaged.
Definition: heritage.hh:30
Commute SUBPIECE operations with earlier operations where possible.
Definition: ruleaction.hh:753
~ConditionMarker(void)
Destructor.
Definition: condexe.cc:30
void saveXmlEdges(ostream &s) const
Save edge information to an XML stream.
Definition: block.cc:2350
virtual Symbol * getCategorySymbol(int4 cat, int4 ind) const
Retrieve a Symbol by index within a specific category.
Definition: database_ghidra.hh:113
string name
The name of the Scope.
Definition: database.hh:384
InjectCallfixupGhidra(const string &src, const string &nm)
Constructor.
Definition: inject_ghidra.cc:78
vector< vector< FlowBlock * > > augment
Augmented edges.
Definition: heritage.hh:205
int4 bump
Spaces to indent if we break here.
Definition: printlanguage.hh:98
Information about the INT_REM op-code.
Definition: typeop.hh:501
void printOffset(ostream &s, uintb offset) const
Write an address offset to a stream.
Definition: space.cc:176
virtual void loadFill(uint1 *ptr, int4 size, const Address &addr)
Get data from the LoadImage.
Definition: loadimage_ghidra.cc:35
patchtype type
The type of this patch.
Definition: subflow.hh:73
Translate * trans
The SLEIGH translator.
Definition: emulate.hh:297
int4 getMapEntryPosition(const SymbolEntry *entry) const
Position of given SymbolEntry within this multi-entry Symbol.
Definition: database.cc:284
GuardRecord(PcodeOp *bOp, PcodeOp *rOp, int4 path, const CircleRange &rng, Varnode *v)
Constructor.
Definition: jumptable.cc:570
PcodeOp * newIndirectCreation(PcodeOp *indeffect, const Address &addr, int4 size, bool possibleout)
Build a CPUI_INDIRECT op that indirectly creates a Varnode.
Definition: funcdata_op.cc:660
virtual void executeSegmentOp(void)=0
Behavior for a SEGMENTOP.
int4 markExitsAsGotos(vector< FlowBlock * > &body)
Mark edges exiting the body as unstructured gotos.
Definition: blockaction.cc:1076
virtual void pushMismatchSymbol(const Symbol *sym, int4 off, int4 sz, const Varnode *vn, const PcodeOp *op)
Push an identifier for a variable that mismatches with its Symbol.
Definition: printc.cc:1704
Apply INT_NEGATE identities: V & ~V => #0, V | ~V -> #-1
Definition: ruleaction.hh:161
ScopeInternal * cache
An internal cache of previously fetched Symbol objects.
Definition: database_ghidra.hh:37
void labelLoops(vector< LoopBody * > &looporder)
Identify all the loops in this graph.
Definition: blockaction.cc:1119
void findNormalized(Funcdata *fd, BlockBasic *rootbl, int4 pathout, uint4 matchsize, uint4 maxtablesize)
Do all the work necessary to recover the normalized switch variable.
Definition: jumptable.cc:1167
int4 pathout
Index of the out-edge for this path (relative to the parent BranchPoint)
Definition: blockaction.hh:128
Flip conditional control-flow so that preferred comparison operators are used.
Definition: blockaction.hh:269
virtual bool empty(void) const =0
Is the container empty of records.
void parseAggressiveTrim(const Element *el)
Designate how to trim extension p-code ops.
Definition: architecture.cc:1048
int4 direction
1=stack grows negative, -1=positive
Definition: varmap.hh:125
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:841
void setOutputErrors(bool val)
Toggle the output error setting for this prototype.
Definition: fspec.hh:1278
int4 size
Size of address bus in bits.
Definition: sleigh_arch.hh:52
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:1011
Bare bones capability for treating a file as a raw executable image.
void setSymbolReference(Symbol *sym, int4 off)
Attach a reference to a Symbol to this.
Definition: variable.cc:71
int4 pathout
Index (of the out edge from the parent) of the path along which this lies.
Definition: blockaction.hh:102
Varnode * otherVn
Other (non-zero) Varnode getting set on other path.
Definition: condexe.hh:219
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:397
void apply(vector< uintb > &refs) const
Convert the reference back to a formal array of integers.
Definition: cpool.hh:185
Eliminate any INT_AND when the bits it zeroes out are discarded by a shift.
Definition: ruleaction.hh:814
@ CPUI_FLOAT_INT2FLOAT
Convert an integer to a floating-point.
Definition: opcodes.hh:101
void printDebug(ostream &s) const
Print debug description of this op to stream.
Definition: op.cc:276
Symbol * symbol
Symbol object being mapped.
Definition: database.hh:53
@ f_active
This BlockTrace is active.
Definition: blockaction.hh:123
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:351
ReplaceVarnode * addConstant(ReplaceOp *rop, uintb mask, uint4 slot, uintb val)
Add a constant variable node to the logical subgraph.
Definition: subflow.cc:1001
_valuetype & clearRange(const _linetype &pnt1, const _linetype &pnt2)
Clear a range of split points.
Definition: partmap.hh:144
void merge(HighVariable *tv2, bool isspeculative)
Merge another HighVariable into this.
Definition: variable.cc:302
void deleteUnusedTrials(void)
Remove trials that were found not to be parameters.
Definition: fspec.cc:1454
int4 injectUponReturn
Id of injection to perform after a call to this function (-1 means not used)
Definition: fspec.hh:625
virtual int4 openGroup(void)
Start a group of things that are printed together.
Definition: prettyprint.hh:131
virtual void initialize(DocumentStorage &store)=0
Initialize the translator given XML configuration documents.
Element * cur
The current XML element being processed by this handler.
Definition: xml.hh:219
void restoreXml(const Element *el, const AddrSpaceManager *manage, bool normalstack)
Restore the entry from an XML stream.
Definition: fspec.cc:302
@ op_t
An operator.
Definition: prettyprint.hh:310
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:405
bool escapeCharacterData(ostream &s, const uint1 *buf, int4 count, int4 charsize, bool bigend) const
Emit a byte buffer to the stream as unicode characters.
Definition: printlanguage.cc:623
@ indirect_creation
The value in this Varnode is created indirectly.
Definition: varnode.hh:100
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:150
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Recover this object from an XML tag.
Definition: pcoderaw.cc:22
virtual Funcdata * findFunction(const Address &addr) const =0
Find the function starting at the given address.
Information about the INT_SLESS op-code.
Definition: typeop.hh:317
virtual int4 beginFunction(const Funcdata *fd)
Begin a whole declaration and body of a function.
Definition: prettyprint.hh:225
The segmented address operator.
Definition: userop.hh:199
@ halt
instruction causes processor or process to halt
Definition: op.hh:90
TypeChar(const TypeChar &op)
Construct TypeChar copying properties from another data-type.
Definition: type.hh:179
virtual uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering the input value.
Definition: opbehavior.cc:135
Simplify composition of SUBPIECE with INT_ZEXT or INT_SEXT.
Definition: ruleaction.hh:854
@ calculated_bool
Output has been determined to be a 1-bit boolean value.
Definition: op.hh:97
Datatype * findByName(const string &n)
Return type of given name.
Definition: type.cc:1400
The core decompiler commands capability.
Definition: ghidra_process.hh:52
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: fspec.cc:1616
LaneDescription description
Global description of lanes that need to be split.
Definition: subflow.hh:175
bool checkInputJoin(int4 slot1, bool ishislot, Varnode *vn1, Varnode *vn2) const
Check if adjacent parameter trials can be combined into a single logical parameter.
Definition: fspec.cc:4384
CPUI_POPCOUNT behavior.
Definition: opbehavior.hh:506
virtual void postSpecFile(void)
Let components initialize after Translate is built.
Definition: bfd_arch.cc:111
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:674
virtual void setVarnodeValue(Varnode *vn, uintb val)=0
Given a specific Varnode, set the given value for it in the current machine state.
virtual bool possibleParamWithSlot(const Address &loc, int4 size, int4 &slot, int4 &slotsize) const =0
Pass-back the slot and slot size for the given storage location as a parameter.
TypeOpInsert(TypeFactory *t)
Constructor.
Definition: typeop.cc:1834
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:1629
virtual void restoreXml(const Element *el)
Restore the detailed description from an XML stream.
Definition: userop.cc:163
virtual string apply(Architecture *glb, const string &p1, const string &p2, const string &p3) const
Apply a particular configuration option to the Architecture.
Definition: options.cc:384
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:496
const OpToken * tok
The operator token.
Definition: printlanguage.hh:167
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8150
const Datatype * ct
Associated Data-type.
Definition: prettyprint.hh:336
Perform SubvariableFlow analysis triggered by testing of a single bit.
Definition: ruleaction.hh:1281
uint4 mods
Currently active printing modifications.
Definition: printlanguage.hh:245
PcodeOp * extraop
The starting PcodeOp associated with the extra value.
Definition: jumptable.hh:206
Mark illegal Varnode inputs used only in CPUI_INDIRECT ops.
Definition: coreaction.hh:338
virtual Varnode * foldInNormalization(Funcdata *fd, PcodeOp *indop)=0
Do normalization of the given switch specific to this model.
EmitXml * emit
The low-level token emitter.
Definition: printlanguage.hh:244
void checkbreak(void)
Enforce whitespace for a line break.
Definition: prettyprint.cc:835
FreeArray & operator=(const FreeArray &op2)
Assignment operator.
Definition: globalcontext.cc:296
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:571
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:461
void opFunc(const PcodeOp *op)
Push a functional expression based on the given p-code op to the RPN stack.
Definition: printc.cc:290
virtual Architecture * buildArchitecture(const string &filename, const string &target, ostream *estream)
Build an Architecture given a raw file or data.
Definition: xml_arch.cc:27
void restoreNextInEdge(const Element *el, BlockMap &resolver)
Restore the next input edge from XML.
Definition: block.cc:73
@ indirectstorage
Is this Varnode storing a pointer to the actual symbol.
Definition: varnode.hh:105
Information about the FLOAT_FLOOR op-code.
Definition: typeop.hh:657
virtual void removeSymbolMappings(Symbol *symbol)
Remove all SymbolEntrys from the given Symbol.
Definition: database.cc:1985
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.hh:776
void removeDoNothingBlock(BlockBasic *bb)
Remove a basic block from control-flow that performs no operations.
Definition: funcdata_block.cc:322
A jump-table model assisted by pseudo-op directives in the code.
Definition: jumptable.hh:472
List children
A list of child Element objects.
Definition: xml.hh:157
int4 distance
Minimum distance crossed by this and any other BlockTrace sharing same exit block.
Definition: blockaction.hh:147
vector< CompilerTag > compilers
List of compiler specifications compatible with this processor.
Definition: sleigh_arch.hh:60
@ cpar_t
Close parenthesis.
Definition: prettyprint.hh:318
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:634
uintb off
Offset associated either with address or field markup.
Definition: prettyprint.hh:340
void saveXml(ostream &s) const
Save the whole Database to an XML stream.
Definition: database.cc:3021
void guardInput(const Address &addr, int4 size, vector< Varnode * > &input)
Make sure existing inputs for the given range fill it entirely.
Definition: heritage.cc:1536
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:273
int4 index
Reference index for this block (reverse post order)
Definition: block.hh:111
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:2731
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:802
@ CPUI_INT_MULT
Integer multiplication, signed and unsigned (*)
Definition: opcodes.hh:73
virtual void opBoolOr(const PcodeOp *op)=0
Emit a BOOL_OR operator.
bool doesEquationApply(int4 num, int4 slot) const
Does the indicated equation apply for the given input slot.
Definition: rangeutil.hh:373
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:484
static bool mergeTestRequired(HighVariable *high_out, HighVariable *high_in)
Required tests to merge HighVariables that are not Cover related.
Definition: merge.cc:72
virtual Varnode * foldInNormalization(Funcdata *fd, PcodeOp *indop)
Do normalization of the given switch specific to this model.
Definition: jumptable.cc:2051
bool buildRightShift(PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes)
Check that a CPUI_INT_RIGHT respects the lanes then generate lane placeholders.
Definition: subflow.cc:2259
void snipIndirect(PcodeOp *indop)
Snip instances of the input of an INDIRECT op that interfere with its output.
Definition: merge.cc:725
Do any post-processing after decompilation.
Definition: coreaction.hh:44
bool tryCallReturnPush(PcodeOp *op, ReplaceVarnode *rvn)
Determine if the given subgraph variable can act as a created value for the given INDIRECT op.
Definition: subflow.cc:290
virtual bool isXmlMatch(Document *doc) const
Determine is this extension can handle this XML document.
Definition: xml_arch.cc:50
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:1959
void recoverAddresses(Funcdata *fd)
Recover the raw jump-table addresses (the address table)
Definition: jumptable.cc:2449
@ seen_solid0
Indicates a solid movement into the Varnode occurred on at least one path to MULTIEQUAL.
Definition: funcdata.hh:571
SymbolTable symtab
The SLEIGH symbol table.
Definition: sleighbase.hh:35
static bool acceptableSize(int4 size)
Return true if given size is a suitable truncated size.
Definition: ruleaction.cc:807
@ CPUI_INT_SLESS
Integer comparison, signed less-than (<)
Definition: opcodes.hh:53
int4 beginReturnType(const Varnode *v)
Create a "begin return type declaration" command.
Definition: prettyprint.hh:390
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.cc:3011
int4 beginFunction(const Funcdata *f)
Create a "begin function body" command.
Definition: prettyprint.hh:364
void overrideFlow(const Address &addr, uint4 type)
Override the control-flow p-code for a particular instruction.
Definition: funcdata_op.cc:917
@ does_deadcode
Dead-code analysis is done on this space.
Definition: space.hh:79
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:387
A structured switch construction.
Definition: block.hh:630
type_metatype metaout
The metatype of the output.
Definition: typeop.hh:190
_valuetype defaultvalue
The value object before the first split point.
Definition: partmap.hh:55
void markLanedVarnode(Funcdata &data, Varnode *vn)
Mark possible laned register storage.
Definition: coreaction.cc:1216
virtual bool recoverModel(Funcdata *fd, PcodeOp *indop, uint4 matchsize, uint4 maxtablesize)
Attempt to recover details of the model, given a specific BRANCHIND.
Definition: jumptable.cc:1535
Simplify SUBPIECE applied to INT_LEFT: sub( V << 8*c, c) => sub(V,0)
Definition: ruleaction.hh:864
const FloatFormat * getFloatFormat(int4 size) const
Get format for a particular floating point encoding.
Definition: translate.cc:867
virtual void restoreXml(const Element *el)
Restore this Symbol from an XML stream.
Definition: database.cc:585
TransformVar * setReplacement(Varnode *vn, int4 numLanes, int4 skipLanes)
Find or build the placeholder objects for a Varnode that needs to be split into lanes.
Definition: subflow.cc:2003
BlockBasic * initblock
The initial block computing the boolean value.
Definition: condexe.hh:134
BranchPoint(void)
Create the (unique) root branch point.
Definition: blockaction.cc:548
vector< EntryMap * >::const_iterator curmap
Current EntryMap being iterated.
Definition: database.hh:332
@ tokenbreak
White space (where line breaks can be inserted)
Definition: prettyprint.hh:285
bool checkCallDoubleUse(const PcodeOp *opmatch, const PcodeOp *op, const Varnode *vn, const ParamTrial &trial) const
Test for legitimate double use of a parameter trial.
Definition: funcdata_varnode.cc:1369
SymbolEntry * queryProperties(const Address &addr, int4 size, const Address &usepoint, uint4 &flags) const
Find a Symbol or properties at the given address.
Definition: database.cc:1185
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter's RPN stack.
Definition: typeop.hh:402
void byte_swap(intb &val, int4 size)
Swap bytes in the given value.
Definition: address.cc:651
int4 startbit
Starting bit of the value within its word (0=most significant bit 1=least significant)
Definition: globalcontext.hh:32
A system for sending override commands to the decompiler.
Templates to define interval map containers.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:365
virtual bool isFileMatch(const string &filename) const
Determine if this extension can handle this file.
Definition: raw_arch.cc:39
void setupInitOp(PcodeOp *op)
Map out the root boolean expression.
Definition: condexe.cc:50
void processHole(const Element *el)
Parse a <hole> XML tag that describes boolean properties of memory range.
Definition: database.cc:2548
list< FloatingEdge > & likelygoto
A reference to the list of likely goto edges being produced.
Definition: blockaction.hh:154
Command to release all resources associated with a Program (executable) in the decompiler.
Definition: ghidra_process.hh:119
Start clean up after main transform phase.
Definition: coreaction.hh:56
@ prot_b
Start of a function prototype.
Definition: prettyprint.hh:307
MapIterator & operator=(const MapIterator &op2)
Assignment operator.
Definition: database.hh:357
@ TYPE_FLOAT
Floating-point.
Definition: type.hh:41
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:8524
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:836
@ TYPE_UINT
Unsigned integer.
Definition: type.hh:38
virtual void restoreXml(const Element *el)=0
Restore the detailed description from an XML stream.
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.
Definition: ghidra_arch.cc:710
virtual void restoreXml(const Element *el, ProtoModel *model)
Restore any internal parameter descriptions from an XML stream.
Definition: fspec.cc:2749
vector< AddBase > addBase
Collection of pointers into the AddressSpace.
Definition: varmap.hh:119
Cleanup: Convert INT_ADD back to INT_SUB: V + -W ==> V - W
Definition: ruleaction.hh:1072
@ addrtied
High-level variable is tied to address.
Definition: varnode.hh:92
virtual FlowBlock * nextFlowAfter(const FlowBlock *bl) const
Get the leaf FlowBlock that will execute after the given FlowBlock.
Definition: block.cc:2665
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:1489
Simplify INT_ZEXT and SUBPIECE in masked comparison: zext(V) & c == 0 => V & (c & mask) == 0
Definition: ruleaction.hh:338
virtual int4 beginReturnType(const Varnode *vn)
Begin a return type declaration.
Definition: prettyprint.cc:923
void setSymbolReference(SymbolEntry *entry, int4 off)
Attach a Symbol reference to this.
Definition: varnode.cc:403
Information about the INT_XOR op-code.
Definition: typeop.hh:423
@ hiddenfunction
Operation that isn't explicitly printed.
Definition: printlanguage.hh:90
bool attemptDynamicMapping(SymbolEntry *entry, DynamicHash &dhash)
Map properties of a dynamic symbol to a Varnode.
Definition: funcdata_varnode.cc:1124
uint4 numSections
Number of named sections.
Definition: sleighbase.hh:38
_recordtype::linetype linetype
Integer data-type defining the linear domain.
Definition: rangemap.hh:67
virtual void rawAction(void)
Perform the action of the command.
Definition: ghidra_process.cc:240
void opInsertBegin(PcodeOp *op, BlockBasic *bl)
Insert given PcodeOp at the beginning of a basic block.
Definition: funcdata_op.cc:383
void buildDomTree(vector< vector< FlowBlock * > > &child) const
Build the dominator tree.
Definition: block.cc:1929
virtual Varnode * getStartVarnode(void) const
Get the Varnode associated with the current value.
Definition: jumptable.cc:356
Address address
Starting address of section.
Definition: loadimage.hh:53
map< string, ActionGroupList > groupmap
Map from root Action name to the grouplist it uses.
Definition: action.hh:297
vector< Varnode * > nonmult
Varnodes which are not multiples.
Definition: ruleaction.hh:37
static OpToken boolean_xor
The boolean xor operator.
Definition: printc.hh:96
FlowBlock * point
Other end of the edge.
Definition: block.hh:46
list< PcodeOp * >::const_iterator desciter
The current edge being traversed.
Definition: coreaction.hh:441
bool res
Set to true if the option change succeeded.
Definition: ghidra_process.hh:229
bool setWarning(bool val, const string &specify)
Set a warning on this action.
Definition: action.cc:191
void setNoReturn(bool val)
Toggle the no-return setting for functions with this prototype.
Definition: fspec.hh:1238
Definition: double.hh:174
@ NO_PROMOTION
There is no integer promotion.
Definition: cast.hh:47
int4 slot
The slot being read.
Definition: rangeutil.hh:179
virtual OpCode assumedExtension(const Address &addr, int4 size, VarnodeData &res) const
Get the type of extension and containing parameter for the given storage.
Definition: fspec.cc:995
EmulateMemory(MemoryState *mem)
Construct given a memory state.
Definition: emulate.hh:264
virtual void saveXml(ostream &s) const
Save any parameters that are not backed by symbols to an XML stream.
Definition: fspec.cc:2711
@ error_outofbounds
Throw an exception for flow into addresses out of the specified range.
Definition: flow.hh:60
virtual list< SymbolEntry >::const_iterator endDynamic(void) const
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:97
~TraceDAG(void)
Destructor.
Definition: blockaction.cc:951
@ toomanyinstructions_present
Indicate the maximum instruction threshold was reached.
Definition: flow.hh:68
virtual void opBoolNegate(const PcodeOp *op)=0
Emit a BOOL_NEGATE operator.
int4 returnBytesConsumed
Number of bytes of return value that are consumed by callers (0 = all bytes)
Definition: fspec.hh:1171
list< PcodeOp * > returnlist
List of RETURN PcodeOps.
Definition: op.hh:250
virtual list< SymbolEntry >::iterator beginDynamic(void)
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:98
@ CPUI_CALLOTHER
User-defined operation.
Definition: opcodes.hh:46
bool isReverseJustified(void) const
Return true if alignment justification does not match endianness.
Definition: space.hh:417
Datatype(int4 s, type_metatype m, const string &n)
Construct the base data-type providing size, meta-type, and name.
Definition: type.hh:94
bool incidentalCopy
True if injected COPYs are considered incidental.
Definition: pcodeinject.hh:90
@ splittingbranch
Dead edge cannot be removed as it splits.
Definition: op.hh:88
void cacheCoreTypes(void)
Cache common types.
Definition: type.cc:1278
virtual uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering the input value.
Definition: opbehavior.cc:257
bool loadGuardSearch
true if the search for LOAD ops to guard has been performed
Definition: heritage.hh:91
virtual int4 apply(Funcdata &data)
Make a single attempt to apply this Action.
Definition: coreaction.hh:380
void checkMultistageJumptables(void)
Look for changes in control-flow near indirect jumps that were discovered after the jumptable recover...
Definition: flow.cc:1382
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:59
virtual ~EmulateSnippet(void)
Destructor.
Definition: emulateutil.cc:293
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: fspec.cc:1597
AddrSpace * uniq_space
Space to allocate unique varnodes from.
Definition: varnode.hh:327
union PrintLanguage::Atom::@23 ptr_second
Other meta-data associated with the token.
bool isNoReturn(void) const
Does a function with this prototype never return.
Definition: fspec.hh:1233
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:1361
A trace of a single path out of a BranchPoint.
Definition: blockaction.hh:121
void buildDominantCopy(HighVariable *high, vector< PcodeOp * > ©, int4 pos, int4 size)
Try to replace a set of COPYs from the same Varnode with a single dominant COPY.
Definition: merge.cc:1049
uint4 flags
Boolean properties associated with this function.
Definition: funcdata.hh:62
virtual void opCallind(const PcodeOp *op)=0
Emit a CALLIND operator.
A Dispatcher for possible ArchOption commands.
Definition: options.hh:63
bool operator==(const Varnode &op2) const
Equality operator.
Definition: varnode.cc:501
@ error_inputparam
Set if the input parameters are not properly represented.
Definition: fspec.hh:1155
virtual void overrideSizeLockType(Datatype *ct)
Change (override) the data-type of a size-locked parameter.
Definition: fspec.cc:2393
bool findIrreducible(const vector< FlowBlock * > &preorder, int4 &irreduciblecount)
Identify irreducible edges.
Definition: block.cc:1073
virtual void printRaw(ostream &s, const PcodeOp *op)
Print (for debugging purposes) this specific PcodeOp to the stream.
Definition: typeop.cc:656
Information about the INT_SRIGHT op-code.
Definition: typeop.hh:466
static OpToken subscript
The array subscript operator.
Definition: printc.hh:69
This class is used to mirror the BlockBasic objects in the fixed control-flow graph for a function.
Definition: block.hh:417
int4 lastBlock
Block out-edge corresponding to last entry in the address table.
Definition: jumptable.hh:519
bool processVarnode(Funcdata &data, Varnode *vn, const LanedRegister &lanedRegister, int4 mode)
Search for a likely lane size and try to divide a single Varnode into these lanes.
Definition: coreaction.cc:555
void resetSizeLockType(Symbol *sym)
Clear a Symbol's size-locked data-type.
Definition: database.cc:1304
bool isDestructor(void) const
Is this prototype for a class destructor method.
Definition: fspec.hh:1257
virtual int4 beginBlock(const FlowBlock *bl)
Begin a control-flow element.
Definition: prettyprint.cc:60
vector< VarnodeData > pieces
All the physical pieces of the symbol.
Definition: translate.hh:197
static bool additiveCompare(const PcodeOpEdge *op1, const PcodeOpEdge *op2)
A comparison operator for ordering terms in a sum.
Definition: coreaction.hh:1076
bool buildMultiequal(PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes)
Split a given CPUI_MULTIEQUAL operation into placeholders given the output lanes.
Definition: subflow.cc:2134
void generateFalseEquation(Varnode *vn, PcodeOp *op, int4 slot, int4 type, const CircleRange &range)
Generate the complementary equation given a true constraint and the input/output Varnodes it affects.
Definition: rangeutil.cc:2070
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: ruleaction.cc:359
BlockBasic * block1
Side 1 of the (putative) split.
Definition: blockaction.hh:241
CPUI_INT_OR behavior.
Definition: opbehavior.hh:254
const Translate * translate
Translate object for recovering float format.
Definition: opbehavior.hh:373
int4 slot
vn = op->getIn(slot)
Definition: funcdata.hh:577
virtual int4 startComment(void)
Start a comment block within the emitted source code.
Definition: prettyprint.hh:160
vector< PreferSplitRecord > splitrecords
registers that we would prefer to see split for this processor
Definition: architecture.hh:154
~JumpTable(void)
Destructor.
Definition: jumptable.cc:2251
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:795
An iterator over out-bound edges for a single ValueSet node in a data-flow system.
Definition: rangeutil.hh:279
@ possible_unreachable
Indicate a CALL was converted to a BRANCH and some code may be unreachable.
Definition: flow.hh:69
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: ruleaction.cc:8088
bool setReturnBytesConsumed(int4 val)
Set the number of bytes consumed by callers of this.
Definition: fspec.cc:3103
virtual void opIntAdd(const PcodeOp *op)
Emit a INT_ADD operator.
Definition: printc.hh:242
virtual FlowBlock * getSplitPoint(void)
Get the leaf splitting block.
Definition: block.cc:2742
void setPrintLanguage(const string &nm)
Establish a particular output language.
Definition: architecture.cc:340
ReplaceVarnode * setReplacement(Varnode *vn, uintb mask, bool &inworklist)
Add the given Varnode as a new node in the logical subgraph.
Definition: subflow.cc:63
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:1362
int4 step
Explicit step size.
Definition: rangeutil.hh:53
const Funcdata * fd
Function being searched for aliases.
Definition: varmap.hh:117
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: ruleaction.hh:602
virtual void resetStats(void)
Reset Rule statistics.
Definition: action.cc:641
BadDataError(const string &s)
Constructor.
Definition: translate.hh:54
A generic recoverable error.
Definition: error.hh:55
void restoreXml(uint4 grouptype, const Element *el, const AddrSpaceManager *manage)
Restore the record from an XML stream.
Definition: fspec.cc:1670
virtual bool next(void) const
Advance the iterator, return true if there is another value.
Definition: jumptable.cc:345
@ smallsize_zext
Assume values that are below the max size are zero extended into this container.
Definition: fspec.hh:53
virtual int4 beginDocument(void)
Begin a whole document of output.
Definition: prettyprint.hh:223
void set(const PathMeld &op2)
Copy paths from another container.
Definition: jumptable.cc:869
Fill-in CPUI_CAST p-code ops as required by the casting strategy.
Definition: coreaction.hh:314
void switchEdge(FlowBlock *in, FlowBlock *outbefore, FlowBlock *outafter)
Move an edge from one out FlowBlock to another.
Definition: block.cc:1389
bool isCompatible(const FuncProto &op2) const
Decide if this can be safely restricted to match another prototype.
Definition: fspec.cc:3570
Address baddr
Start of range in which we are allowed to flow.
Definition: flow.hh:94
list< PcodeOp * >::iterator codeiter
Position in opcode list.
Definition: op.hh:120
static int4 baseExplicit(Varnode *vn, int4 maxref)
Make initial determination if a Varnode should be explicit.
Definition: coreaction.cc:2535
virtual void opLoad(const PcodeOp *op)
Emit a LOAD operator.
Definition: printc.cc:345
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:534
static bool compareBlockIndex(const FlowBlock *bl1, const FlowBlock *bl2)
Compare FlowBlock by index.
Definition: block.hh:775
CPUI_FLOAT_ADD behavior.
Definition: opbehavior.hh:388
CPUI_INT_REM behavior.
Definition: opbehavior.hh:306
Varnode * getNameRepresentative(void) const
Get a member Varnode that dictates the naming of this HighVariable.
Definition: variable.cc:235
const_iterator find_begin(linetype point) const
Find beginning of sub-ranges that contain the given boundary point.
Definition: rangemap.hh:375
virtual void registerInject(int4 injectid)=0
Finalize a payload within the library, once the payload is initialized.
int4 edgelump
If >1, edge to destnode is "virtual" representing multiple edges coming together.
Definition: blockaction.hh:131
Abstract extension point for building Architecture objects.
Definition: architecture.hh:70
JumpBasicOverride(JumpTable *jt)
Constructor.
Definition: jumptable.cc:1642
A collection of breakpoints for the emulator.
Definition: emulate.hh:37
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: coreaction.hh:778