19 #ifndef __CPUI_VARMAP__ 20 #define __CPUI_VARMAP__ 37 addr(ad), useaddr(use), size(sz), name(nm), symbolId(id) {}
41 string getName(
void)
const {
return name; }
56 usePoint(addr), hash(h), name(nm), symbolId(id) {}
58 uint8
getHash(
void)
const {
return hash; }
59 string getName(
void)
const {
return name; }
90 start=st; size=sz; sstart=sst; type=ct; flags=fl; rangeType = rt; highind=hi; }
93 bool preferred(
const RangeHint *b,
bool reconcile)
const;
119 mutable vector<AddBase> addBase;
120 mutable vector<uintb> alias;
121 mutable bool calculated;
124 mutable uintb aliasBoundary;
126 void deriveBoundaries(
const FuncProto &proto);
127 void gatherInternal(
void)
const;
131 bool hasLocalAlias(
Varnode *vn)
const;
132 void sortAlias(
void)
const;
133 const vector<AddBase> &
getAddBase(
void)
const {
return addBase; }
134 const vector<uintb> &
getAlias(
void)
const {
return alias; }
135 static void gatherAdditiveBase(
Varnode *startvn,vector<AddBase> &addbase);
136 static uintb gatherOffset(
Varnode *vn);
148 vector<RangeHint *> maplist;
149 vector<RangeHint *>::iterator iter;
154 void reconcileDatatypes(
void);
156 #ifdef OPACTION_DEBUG 157 mutable bool debugon;
159 void turnOnDebug(
Architecture *g)
const { debugon =
true; glb=g; }
160 void turnOffDebug(
void)
const { debugon =
false; }
164 bool initialize(
void);
168 void gatherVarnodes(
const Funcdata &fd);
169 void gatherHighs(
const Funcdata &fd);
170 void gatherOpen(
const Funcdata &fd);
172 bool getNext(
void) { ++iter;
if (iter==maplist.end())
return false;
return true; }
185 list<NameRecommend> nameRecommend;
186 list<DynamicRecommend> dynRecommend;
187 bool stackGrowsNegative;
192 void markUnaliased(
const vector<uintb> &alias);
193 void fakeInputSymbols(
void);
194 void addRecommendName(
Symbol *sym);
195 void collectNameRecs(
void);
208 void markNotMapped(
AddrSpace *spc,uintb first,int4 sz,
bool param);
211 virtual void saveXml(ostream &s)
const;
212 virtual void restoreXml(
const Element *el);
213 virtual string buildVariableName(
const Address &addr,
216 int4 &index,uint4 flags)
const;
217 void resetLocalWindow(
void);
218 void restructureVarnode(
bool aliasyes);
219 void restructureHigh(
void);
222 void recoverNameRecommendationsForSymbols(
void);
A region where processor data is stored.
Definition: space.hh:73
const Address & getAddr(void) const
Get the storage address.
Definition: varmap.hh:38
The base datatype class for the decompiler.
Definition: type.hh:62
A storage location for a particular Symbol.
Definition: database.hh:51
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
AliasChecker()
Constructor.
Definition: varmap.hh:129
Container for data structures associated with a single function.
Definition: funcdata.hh:45
Varnode * index
The index value or NULL.
Definition: varmap.hh:113
int4 getSize(void) const
Get the optional size.
Definition: varmap.hh:40
A helper class holding a Varnode pointer reference and a possible index added to it.
Definition: varmap.hh:111
const vector< uintb > & getAlias(void) const
Get the list of alias starting offsets.
Definition: varmap.hh:134
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:615
int4 compare(const RangeHint &op2) const
Order this with another RangeHint.
Definition: varmap.cc:247
string getName(void) const
Get the recommended name.
Definition: varmap.hh:41
const Address & getAddress(void) const
Get the use point address.
Definition: varmap.hh:57
const vector< uintb > & getAlias(void)
Get the list of alias starting offsets.
Definition: varmap.hh:166
void sortAlias(void) const
Sort the alias starting offsets.
Definition: varmap.cc:568
DynamicRecommend(const Address &addr, uint8 h, const string &nm, uint8 id)
Constructor.
Definition: varmap.hh:55
bool isUnaffectedStorage(Varnode *vn) const
Is this a storage location for unaffected registers.
Definition: varmap.hh:206
static bool compareRanges(const RangeHint *a, const RangeHint *b)
Compare two RangeHint pointers.
Definition: varmap.hh:97
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
string getName(void) const
Get the recommended name.
Definition: varmap.hh:59
bool getNext(void)
Advance the iterator, return true if another hint is available.
Definition: varmap.hh:172
RangeHint(void)
Uninitialized constructor.
Definition: varmap.hh:88
RangeHint(uintb st, int4 sz, intb sst, Datatype *ct, uint4 fl, RangeType rt, int4 hi)
Initialized constructor.
Definition: varmap.hh:89
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
RangeType
The basic categorization of the range.
Definition: varmap.hh:74
A name recommendation for a particular dynamic storage location.
Definition: varmap.hh:49
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
Description of a LOAD operation that needs to be guarded.
Definition: heritage.hh:105
const Address & getUseAddr(void) const
Get the use point address.
Definition: varmap.hh:39
uint8 getSymbolId(void) const
Get the original Symbol id.
Definition: varmap.hh:42
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
An XML element. A node in the DOM tree.
Definition: xml.hh:150
AddrSpace * getSpaceId(void) const
Get the associated (stack) address space.
Definition: varmap.hh:200
A light-weight class for analyzing pointers and aliasing on the stack.
Definition: varmap.hh:108
AddrSpace * getSpace(void) const
Get the AddrSpace storing this Varnode.
Definition: varnode.hh:168
An interval map container.
Definition: rangemap.hh:65
An in-memory implementation of the Scope interface.
Definition: database.hh:721
void sortAlias(void)
Sort the alias starting offsets.
Definition: varmap.hh:165
A symbol name recommendation with its associated storage location.
Definition: varmap.hh:29
Symbol and Scope objects for the decompiler.
const vector< AddBase > & getAddBase(void) const
Get the collection of pointer Varnodes.
Definition: varmap.hh:133
A function prototype.
Definition: fspec.hh:1147
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
The base class for a symbol in a symbol table or scope.
Definition: database.hh:153
RangeHint * next(void)
Get the current RangeHint in the collection.
Definition: varmap.hh:171
virtual ~ScopeLocal(void)
Destructor.
Definition: varmap.hh:198
Partial data-type information mapped to a specific range of bytes.
Definition: varmap.hh:69
AddBase(Varnode *b, Varnode *i)
Constructor.
Definition: varmap.hh:114
NameRecommend(const Address &ad, const Address &use, int4 sz, const string &nm, uint8 id)
Constructor.
Definition: varmap.hh:36
uint8 getSymbolId(void) const
Get the original Symbol id.
Definition: varmap.hh:60
Varnode * base
The Varnode holding the base pointer.
Definition: varmap.hh:112
uint8 getHash(void) const
Get the dynamic hash.
Definition: varmap.hh:58
A Symbol scope for local variables of a particular function.
Definition: varmap.hh:182
A container for hints about the data-type layout of an address space.
Definition: varmap.hh:145