My Project
fspec.hh
Go to the documentation of this file.
1 /* ###
2  * IP: GHIDRA
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
18 
19 #ifndef __CPUI_FSPEC__
20 #define __CPUI_FSPEC__
21 
22 #include "op.hh"
23 #include "rangemap.hh"
24 
25 class JoinRecord;
26 
29  ParamUnassignedError(const string &s) : LowlevelError(s) {}
30 };
31 
48 class ParamEntry {
49 public:
50  enum {
51  force_left_justify = 1,
52  reverse_stack = 2,
53  smallsize_zext = 4,
54  smallsize_sext = 8,
55 // is_big_endian = 16, ///< Set if this value should be treated as big endian
56  smallsize_inttype = 32,
57  smallsize_floatext = 64,
58  extracheck_high = 128,
59  extracheck_low = 256
60  };
61 private:
62  uint4 flags;
63  type_metatype type;
64  int4 group;
65  int4 groupsize;
66  AddrSpace *spaceid;
67  uintb addressbase;
68  int4 size;
69  int4 minsize;
70  int4 alignment;
71  int4 numslots;
72  JoinRecord *joinrec;
73  void resolveJoin(void);
74 
76  bool isLeftJustified(void) const { return (((flags&force_left_justify)!=0)||(!spaceid->isBigEndian())); }
77 public:
78  ParamEntry(int4 grp) { group=grp; }
79  ParamEntry(type_metatype t,int4 grp,int4 grpsize,const Address &loc,int4 sz,int4 mnsz,int4 align,bool normalstack);
80  int4 getGroup(void) const { return group; }
81  int4 getGroupSize(void) const { return groupsize; }
82  int4 getSize(void) const { return size; }
83  int4 getMinSize(void) const { return minsize; }
84  int4 getAlign(void) const { return alignment; }
85  type_metatype getType(void) const { return type; }
86  bool isExclusion(void) const { return (alignment==0); }
87  bool isReverseStack(void) const { return ((flags & reverse_stack)!=0); }
88  bool contains(const ParamEntry &op2) const;
89  bool containedBy(const Address &addr,int4 sz) const;
90  int4 justifiedContain(const Address &addr,int4 sz) const;
91  bool getContainer(const Address &addr,int4 sz,VarnodeData &res) const;
92  OpCode assumedExtension(const Address &addr,int4 sz,VarnodeData &res) const;
93  int4 getSlot(const Address &addr,int4 skip) const;
94  AddrSpace *getSpace(void) const { return spaceid; }
95  uintb getBase(void) const { return addressbase; }
96  Address getAddrBySlot(int4 &slot,int4 sz) const;
97  void restoreXml(const Element *el,const AddrSpaceManager *manage,bool normalstack);
98  void extraChecks(list<ParamEntry> &entry);
99  bool isParamCheckHigh(void) const { return ((flags & extracheck_high)!=0); }
100  bool isParamCheckLow(void) const { return ((flags & extracheck_low)!=0); }
101 };
102 
105  uintb first;
106  uintb last;
107  int4 position;
108  ParamEntry *entry;
109 
111  class InitData {
112  friend class ParamEntryRange;
113  int4 position;
114  ParamEntry *entry;
115  public:
116  InitData(int4 pos,ParamEntry *e) { position = pos; entry = e; }
117  };
118 
120  class SubsortPosition {
121  int4 position;
122  public:
123  SubsortPosition(void) {}
124  SubsortPosition(int4 pos) { position = pos; }
125  SubsortPosition(bool val) { position = val ? 1000000 : 0; }
126  bool operator<(const SubsortPosition &op2) { return position < op2.position; }
127  };
128 public:
129  typedef uintb linetype;
130  typedef SubsortPosition subsorttype;
131  typedef InitData inittype;
132 
133  ParamEntryRange(void) {}
134  void initialize(const inittype &data,uintb f,uintb l) {
135  first = f; last = l; position = data.position; entry = data.entry; }
136  uintb getFirst(void) const { return first; }
137  uintb getLast(void) const { return last; }
138  subsorttype getSubsort(void) const { return SubsortPosition(position); }
139  ParamEntry *getParamEntry(void) const { return entry; }
140 };
142 
157 class ParamTrial {
158 public:
159  enum {
160  checked = 1,
161  used = 2,
162  defnouse = 4,
163  active = 8,
164  unref = 16,
165  killedbycall = 32,
166  rem_formed = 64,
167  indcreate_formed = 128,
168  condexe_effect = 256
169  };
170 private:
171  uint4 flags;
172  Address addr;
173  int4 size;
174  int4 slot;
175  const ParamEntry *entry;
176  int4 offset;
177 public:
179  ParamTrial(const Address &ad,int4 sz,int4 sl) { addr = ad; size = sz; slot = sl; flags=0; entry=(ParamEntry *)0; offset=-1; }
180  const Address &getAddress(void) const { return addr; }
181  int4 getSize(void) const { return size; }
182  int4 getSlot(void) const { return slot; }
183  void setSlot(int4 val) { slot = val; }
184  const ParamEntry *getEntry(void) const { return entry; }
185  int4 getOffset(void) const { return offset; }
186  void setEntry(const ParamEntry *ent,int4 off) { entry=ent; offset=off; }
187  void markUsed(void) { flags |= used; }
188  void markActive(void) { flags |= (active|checked); }
189  void markInactive(void) { flags &= ~((uint4)active); flags |= checked; }
190  void markNoUse(void) { flags &= ~((uint4)(active|used)); flags |= (checked|defnouse); }
191  void markUnref(void) { flags |= (unref|checked); slot = -1; }
192  void markKilledByCall(void) { flags |= killedbycall; }
193  bool isChecked(void) const { return ((flags & checked)!=0); }
194  bool isActive(void) const { return ((flags & active)!=0); }
195  bool isDefinitelyNotUsed(void) const { return ((flags & defnouse)!=0); }
196  bool isUsed(void) const { return ((flags & used)!=0); }
197  bool isUnref(void) const { return ((flags & unref)!=0); }
198  bool isKilledByCall(void) const { return ((flags & killedbycall)!=0); }
199  void setRemFormed(void) { flags |= rem_formed; }
200  bool isRemFormed(void) const { return ((flags & rem_formed)!=0); }
201  void setIndCreateFormed(void) { flags |= indcreate_formed; }
202  bool isIndCreateFormed(void) const { return ((flags & indcreate_formed)!=0); }
203  void setCondExeEffect(void) { flags |= condexe_effect; }
204  bool hasCondExeEffect(void) const { return ((flags & condexe_effect)!=0); }
205  int4 slotGroup(void) const { return entry->getSlot(addr,size-1); }
206  void setAddress(const Address &ad,int4 sz) { addr=ad; size=sz; }
207  ParamTrial splitHi(int4 sz) const;
208  ParamTrial splitLo(int4 sz) const;
209  bool testShrink(const Address &newaddr,int4 sz) const;
210  bool operator<(const ParamTrial &b) const;
211 };
212 
223 class ParamActive {
224  vector<ParamTrial> trial;
225  int4 slotbase;
226  int4 stackplaceholder;
227  int4 numpasses;
228  int4 maxpass;
229  bool isfullychecked;
230  bool needsfinalcheck;
231  bool recoversubcall;
232 public:
233  ParamActive(bool recoversub);
234  void clear(void);
235  void registerTrial(const Address &addr,int4 sz);
236  int4 getNumTrials(void) const { return trial.size(); }
237  ParamTrial &getTrial(int4 i) { return trial[i]; }
238  const ParamTrial &getTrialForInputVarnode(int4 slot) const;
239  int4 whichTrial(const Address &addr,int4 sz) const;
240  bool needsFinalCheck(void) const { return needsfinalcheck; }
241  void markNeedsFinalCheck(void) { needsfinalcheck = true; }
242  bool isRecoverSubcall(void) const { return recoversubcall; }
243  bool isFullyChecked(void) const { return isfullychecked; }
244  void markFullyChecked(void) { isfullychecked = true; }
245  void setPlaceholderSlot(void) { stackplaceholder = slotbase; slotbase += 1; }
246  void freePlaceholderSlot(void);
247  int4 getNumPasses(void) const { return numpasses; }
248  int4 getMaxPass(void) const { return maxpass; }
249  void setMaxPass(int4 val) { maxpass = val; }
250  void finishPass(void) { numpasses += 1; }
251  void sortTrials(void) { sort(trial.begin(),trial.end()); }
252  void deleteUnusedTrials(void);
253  void splitTrial(int4 i,int4 sz);
254  void joinTrial(int4 slot,const Address &addr,int4 sz);
255  int4 getNumUsed(void) const;
256 
263  bool testShrink(int4 i,const Address &addr,int4 sz) const { return trial[i].testShrink(addr,sz); }
264 
270  void shrink(int4 i,const Address &addr,int4 sz) { trial[i].setAddress(addr,sz); }
271 };
272 
283 class FspecSpace : public AddrSpace {
284 public:
285  FspecSpace(AddrSpaceManager *m,const Translate *t,const string &nm,int4 ind);
286  virtual void saveXmlAttributes(ostream &s,uintb offset) const;
287  virtual void saveXmlAttributes(ostream &s,uintb offset,int4 size) const;
288  virtual void printRaw(ostream &s,uintb offset) const;
289  virtual void saveXml(ostream &s) const;
290  virtual void restoreXml(const Element *el);
291 };
292 
297  uint4 flags;
298 };
299 
306 public:
307  enum {
308  unaffected = 1,
309  killedbycall = 2,
310  return_address = 3,
311  unknown_effect = 4
312  };
313 private:
314  VarnodeData address;
315  uint4 type;
316 public:
317  EffectRecord(void) {}
318  EffectRecord(const EffectRecord &op2) { address = op2.address; type = op2.type; }
319  EffectRecord(const Address &addr,int4 size);
320  EffectRecord(const ParamEntry &entry,uint4 t);
321  EffectRecord(const VarnodeData &addr,uint4 t);
322  uint4 getType(void) const { return type; }
323  Address getAddress(void) const { return Address(address.space,address.offset); }
324  int4 getSize(void) const { return address.size; }
325  bool operator<(const EffectRecord &op2) const;
326  bool operator==(const EffectRecord &op2) const;
327  bool operator!=(const EffectRecord &op2) const;
328  void saveXml(ostream &s) const;
329  void restoreXml(uint4 grouptype,const Element *el,const AddrSpaceManager *manage);
330 };
331 
339 class ParamList {
340 public:
341  enum {
345  p_merged
346  };
347  virtual ~ParamList(void) {}
348  virtual uint4 getType(void) const=0;
349 
357  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
358  TypeFactory &typefactory,vector<ParameterPieces> &res) const=0;
359 
366  virtual void fillinMap(ParamActive *active) const=0;
367 
377  virtual bool checkJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const=0;
378 
387  virtual bool checkSplit(const Address &loc,int4 size,int4 splitpoint) const=0;
388 
399  virtual int4 characterizeAsParam(const Address &loc,int4 size) const=0;
400 
407  virtual bool possibleParam(const Address &loc,int4 size) const=0;
408 
418  virtual bool possibleParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const=0;
419 
426  virtual bool getBiggestContainedParam(const Address &loc,int4 size,VarnodeData &res) const=0;
427 
437  virtual bool unjustifiedContainer(const Address &loc,int4 size,VarnodeData &res) const=0;
438 
449  virtual OpCode assumedExtension(const Address &addr,int4 size,VarnodeData &res) const=0;
450 
454  virtual AddrSpace *getSpacebase(void) const=0;
455 
461  virtual void getRangeList(AddrSpace *spc,RangeList &res) const=0;
462 
469  virtual int4 getMaxDelay(void) const=0;
470 
477  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack)=0;
478 
479  virtual ParamList *clone(void) const=0;
480 };
481 
491 class ParamListStandard : public ParamList {
492 protected:
493  int4 numgroup;
494  int4 maxdelay;
495  int4 pointermax;
498  list<ParamEntry> entry;
499  vector<ParamEntryResolver *> resolverMap;
501  const ParamEntry *findEntry(const Address &loc,int4 size) const;
502  Address assignAddress(const Datatype *tp,vector<int4> &status) const;
503  void buildTrialMap(ParamActive *active) const;
504  void separateFloat(ParamActive *active,int4 &floatstart,int4 &floatstop,int4 &start,int4 &stop) const;
505  void forceExclusionGroup(ParamActive *active) const;
506  void forceNoUse(ParamActive *active,int4 start,int4 stop) const;
507  void forceInactiveChain(ParamActive *active,int4 maxchain,int4 start,int4 stop) const;
508  void calcDelay(void);
509  void populateResolver(void);
510 public:
513  virtual ~ParamListStandard(void);
514  const list<ParamEntry> &getEntry(void) const { return entry; }
515  virtual uint4 getType(void) const { return p_standard; }
516  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
517  TypeFactory &typefactory,vector<ParameterPieces> &res) const;
518  virtual void fillinMap(ParamActive *active) const;
519  virtual bool checkJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const;
520  virtual bool checkSplit(const Address &loc,int4 size,int4 splitpoint) const;
521  virtual int4 characterizeAsParam(const Address &loc,int4 size) const;
522  virtual bool possibleParam(const Address &loc,int4 size) const;
523  virtual bool possibleParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const;
524  virtual bool getBiggestContainedParam(const Address &loc,int4 size,VarnodeData &res) const;
525  virtual bool unjustifiedContainer(const Address &loc,int4 size,VarnodeData &res) const;
526  virtual OpCode assumedExtension(const Address &addr,int4 size,VarnodeData &res) const;
527  virtual AddrSpace *getSpacebase(void) const { return spacebase; }
528  virtual void getRangeList(AddrSpace *spc,RangeList &res) const;
529  virtual int4 getMaxDelay(void) const { return maxdelay; }
530  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack);
531  virtual ParamList *clone(void) const;
532 };
533 
542 public:
545  virtual uint4 getType(void) const { return p_standard_out; }
546  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
547  TypeFactory &typefactory,vector<ParameterPieces> &res) const;
548  virtual void fillinMap(ParamActive *active) const;
549  virtual bool possibleParam(const Address &loc,int4 size) const;
550  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack);
551  virtual ParamList *clone(void) const;
552 };
553 
562 public:
565  virtual uint4 getType(void) const { return p_register; }
566  virtual void fillinMap(ParamActive *active) const;
567  virtual ParamList *clone(void) const;
568 };
569 
579 public:
582  void foldIn(const ParamListStandard &op2);
583  void finalize(void) { populateResolver(); }
584  virtual uint4 getType(void) const { return p_merged; }
585  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
586  TypeFactory &typefactory,vector<ParameterPieces> &res) const {
587  throw LowlevelError("Cannot assign prototype before model has been resolved"); }
588  virtual void fillinMap(ParamActive *active) const {
589  throw LowlevelError("Cannot determine prototype before model has been resolved"); }
590  virtual ParamList *clone(void) const;
591 };
592 
615 class ProtoModel {
616  friend class ProtoModelMerged;
617  Architecture *glb;
618  string name;
619  int4 extrapop;
620  ParamList *input;
621  ParamList *output;
622  vector<EffectRecord> effectlist;
623  vector<VarnodeData> likelytrash;
624  int4 injectUponEntry;
625  int4 injectUponReturn;
626  RangeList localrange;
627  RangeList paramrange;
628  bool stackgrowsnegative;
629  bool hasThis;
630  bool isConstruct;
631  void defaultLocalRange(void);
632  void defaultParamRange(void);
633  void buildParamList(const string &strategy);
634 public:
635  enum {
637  };
639  ProtoModel(const string &nm,const ProtoModel &op2);
640  virtual ~ProtoModel(void);
641  const string &getName(void) const { return name; }
642  Architecture *getArch(void) const { return glb; }
643  uint4 hasEffect(const Address &addr,int4 size) const;
644  int4 getExtraPop(void) const { return extrapop; }
645  void setExtraPop(int4 ep) { extrapop = ep; }
646  int4 getInjectUponEntry(void) const { return injectUponEntry; }
647  int4 getInjectUponReturn(void) const { return injectUponReturn; }
648 
653  void deriveInputMap(ParamActive *active) const {
654  input->fillinMap(active); }
655 
660  void deriveOutputMap(ParamActive *active) const {
661  output->fillinMap(active); }
662 
663  void assignParameterStorage(const vector<Datatype *> &typelist,vector<ParameterPieces> &res,bool ignoreOutputError);
664 
674  bool checkInputJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const {
675  return input->checkJoin(hiaddr,hisize,loaddr,losize); }
676 
686  bool checkOutputJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const {
687  return output->checkJoin(hiaddr,hisize,loaddr,losize); }
688 
697  bool checkInputSplit(const Address &loc,int4 size,int4 splitpoint) const {
698  return input->checkSplit(loc,size,splitpoint); }
699 
700  const RangeList &getLocalRange(void) const { return localrange; }
701  const RangeList &getParamRange(void) const { return paramrange; }
702  vector<EffectRecord>::const_iterator effectBegin(void) const { return effectlist.begin(); }
703  vector<EffectRecord>::const_iterator effectEnd(void) const { return effectlist.end(); }
704  int4 numLikelyTrash(void) const { return likelytrash.size(); }
705  const VarnodeData &getLikelyTrash(int4 i) const { return likelytrash[i]; }
706 
717  int4 characterizeAsInputParam(const Address &loc,int4 size) const {
718  return input->characterizeAsParam(loc, size);
719  }
720 
727  bool possibleInputParam(const Address &loc,int4 size) const {
728  return input->possibleParam(loc,size); }
729 
736  bool possibleOutputParam(const Address &loc,int4 size) const {
737  return output->possibleParam(loc,size); }
738 
748  bool possibleInputParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const {
749  return input->possibleParamWithSlot(loc,size,slot,slotsize); }
750 
760  bool possibleOutputParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const {
761  return output->possibleParamWithSlot(loc,size,slot,slotsize); }
762 
772  bool unjustifiedInputParam(const Address &loc,int4 size,VarnodeData &res) const {
773  return input->unjustifiedContainer(loc,size,res); }
774 
785  OpCode assumedInputExtension(const Address &addr,int4 size,VarnodeData &res) const {
786  return input->assumedExtension(addr,size,res); }
787 
798  OpCode assumedOutputExtension(const Address &addr,int4 size,VarnodeData &res) const {
799  return output->assumedExtension(addr,size,res); }
800 
807  bool getBiggestContainedInputParam(const Address &loc,int4 size,VarnodeData &res) const {
808  return input->getBiggestContainedParam(loc, size, res);
809  }
810 
811  AddrSpace *getSpacebase(void) const { return input->getSpacebase(); }
812  bool isStackGrowsNegative(void) const { return stackgrowsnegative; }
813  bool hasThisPointer(void) const { return hasThis; }
814  bool isConstructor(void) const { return isConstruct; }
815 
822  int4 getMaxInputDelay(void) const { return input->getMaxDelay(); }
823 
830  int4 getMaxOutputDelay(void) const { return output->getMaxDelay(); }
831 
832  virtual bool isMerged(void) const { return false; }
833  virtual void restoreXml(const Element *el);
834  static uint4 lookupEffect(const vector<EffectRecord> &efflist,const Address &addr,int4 size);
835 };
836 
845  class PEntry {
846  public:
847  int4 origIndex;
848  int4 slot;
849  int4 size;
850  bool operator<(const PEntry &op2) const { return (slot < op2.slot); }
855  };
856  bool isinputscore;
857  vector<PEntry> entry;
858  const ProtoModel *model;
859  int4 finalscore;
860  int4 mismatch;
861 public:
862  ScoreProtoModel(bool isinput,const ProtoModel *mod,int4 numparam);
863  void addParameter(const Address &addr,int4 sz);
864  void doScore(void);
865  int4 getScore(void) const { return finalscore; }
866  int4 getNumMismatch(void) const { return mismatch; }
867 };
868 
880 class ProtoModelMerged : public ProtoModel {
881  vector<ProtoModel *> modellist;
882  void intersectEffects(const vector<EffectRecord> &efflist);
883  void intersectLikelyTrash(const vector<VarnodeData> &trashlist);
884 public:
886  virtual ~ProtoModelMerged(void) {}
887  int4 numModels(void) const { return modellist.size(); }
888  ProtoModel *getModel(int4 i) const { return modellist[i]; }
889  void foldIn(ProtoModel *model);
890  ProtoModel *selectModel(ParamActive *active) const;
891  virtual bool isMerged(void) const { return true; }
892  virtual void restoreXml(const Element *el);
893 };
894 
895 class Symbol;
896 class AliasChecker;
897 
904 public:
905  ProtoParameter(void) {}
906  virtual ~ProtoParameter(void) {}
907  virtual const string &getName(void) const=0;
908  virtual Datatype *getType(void) const=0;
909  virtual Address getAddress(void) const=0;
910  virtual int4 getSize(void) const=0;
911  virtual bool isTypeLocked(void) const=0;
912  virtual bool isNameLocked(void) const=0;
913  virtual bool isSizeTypeLocked(void) const=0;
914  virtual bool isIndirectStorage(void) const=0;
915  virtual bool isHiddenReturn(void) const=0;
916  virtual bool isNameUndefined(void) const=0;
917  virtual void setTypeLock(bool val)=0;
918  virtual void setNameLock(bool val)=0;
919 
925  virtual void overrideSizeLockType(Datatype *ct)=0;
926 
931  virtual void resetSizeLockType(TypeFactory *factory)=0;
932 
933  virtual ProtoParameter *clone(void) const=0;
934 
939  virtual Symbol *getSymbol(void) const=0;
940 
945  bool operator==(const ProtoParameter &op2) const {
946  if (getAddress() != op2.getAddress()) return false;
947  if (getType() != op2.getType()) return false;
948  return true;
949  }
950 
955  bool operator!=(const ProtoParameter &op2) const {
956  return !(*this==op2); }
957 };
958 
965  string name;
966  Address addr;
967  Datatype *type;
968  uint4 flags;
969 public:
970  ParameterBasic(const string &nm,const Address &ad,Datatype *tp,uint4 fl) {
971  name = nm; addr = ad; type = tp; flags=fl; }
972  virtual const string &getName(void) const { return name; }
973  virtual Datatype *getType(void) const { return type; }
974  virtual Address getAddress(void) const { return addr; }
975  virtual int4 getSize(void) const { return type->getSize(); }
976  virtual bool isTypeLocked(void) const { return ((flags&Varnode::typelock)!=0); }
977  virtual bool isNameLocked(void) const { return ((flags&Varnode::namelock)!=0); }
978  virtual bool isSizeTypeLocked(void) const { return ((flags&Varnode::mark)!=0); }
979  virtual bool isIndirectStorage(void) const { return ((flags&Varnode::indirectstorage)!=0); }
980  virtual bool isHiddenReturn(void) const { return ((flags&Varnode::hiddenretparm)!=0); }
981  virtual bool isNameUndefined(void) const { return (name.size()==0); }
982  virtual void setTypeLock(bool val);
983  virtual void setNameLock(bool val);
984  virtual void overrideSizeLockType(Datatype *ct);
985  virtual void resetSizeLockType(TypeFactory *factory);
986  virtual ProtoParameter *clone(void) const;
987  virtual Symbol *getSymbol(void) const { throw LowlevelError("Parameter is not a real symbol"); }
988 };
989 
995 class ProtoStore {
996 public:
997  virtual ~ProtoStore(void) {}
998 
1008  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces)=0;
1009 
1015  virtual void clearInput(int4 i)=0;
1016 
1017  virtual void clearAllInputs(void)=0;
1018  virtual int4 getNumInputs(void) const=0;
1019  virtual ProtoParameter *getInput(int4 i)=0;
1020 
1027  virtual ProtoParameter *setOutput(const ParameterPieces &piece)=0;
1028 
1029  virtual void clearOutput(void)=0;
1030  virtual ProtoParameter *getOutput(void)=0;
1031  virtual ProtoStore *clone(void) const=0;
1032 
1038  virtual void saveXml(ostream &s) const=0;
1039 
1044  virtual void restoreXml(const Element *el,ProtoModel *model)=0;
1045 };
1046 
1053  friend class ProtoStoreSymbol;
1054  Symbol *sym;
1055 public:
1056  ParameterSymbol(void) { sym = (Symbol *)0; }
1057  virtual const string &getName(void) const;
1058  virtual Datatype *getType(void) const;
1059  virtual Address getAddress(void) const;
1060  virtual int4 getSize(void) const;
1061  virtual bool isTypeLocked(void) const;
1062  virtual bool isNameLocked(void) const;
1063  virtual bool isSizeTypeLocked(void) const;
1064  virtual bool isIndirectStorage(void) const;
1065  virtual bool isHiddenReturn(void) const;
1066  virtual bool isNameUndefined(void) const;
1067  virtual void setTypeLock(bool val);
1068  virtual void setNameLock(bool val);
1069  virtual void overrideSizeLockType(Datatype *ct);
1070  virtual void resetSizeLockType(TypeFactory *factory);
1071  virtual ProtoParameter *clone(void) const;
1072  virtual Symbol *getSymbol(void) const;
1073 };
1074 
1081  Scope *scope;
1082  Address restricted_usepoint;
1083  vector<ProtoParameter *> inparam;
1084  ProtoParameter *outparam;
1085  ParameterSymbol *getSymbolBacked(int4 i);
1086 public:
1087  ProtoStoreSymbol(Scope *sc,const Address &usepoint);
1088  virtual ~ProtoStoreSymbol(void);
1089  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces);
1090  virtual void clearInput(int4 i);
1091  virtual void clearAllInputs(void);
1092  virtual int4 getNumInputs(void) const;
1093  virtual ProtoParameter *getInput(int4 i);
1094  virtual ProtoParameter *setOutput(const ParameterPieces &piece);
1095  virtual void clearOutput(void);
1096  virtual ProtoParameter *getOutput(void);
1097  virtual ProtoStore *clone(void) const;
1098  virtual void saveXml(ostream &s) const;
1099  virtual void restoreXml(const Element *el,ProtoModel *model);
1100 };
1101 
1107  Datatype *voidtype;
1108  vector<ProtoParameter *> inparam;
1109  ProtoParameter *outparam;
1110 public:
1112  virtual ~ProtoStoreInternal(void);
1113  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces);
1114  virtual void clearInput(int4 i);
1115  virtual void clearAllInputs(void);
1116  virtual int4 getNumInputs(void) const;
1117  virtual ProtoParameter *getInput(int4 i);
1118  virtual ProtoParameter *setOutput(const ParameterPieces &piece);
1119  virtual void clearOutput(void);
1120  virtual ProtoParameter *getOutput(void);
1121  virtual ProtoStore *clone(void) const;
1122  virtual void saveXml(ostream &s) const;
1123  virtual void restoreXml(const Element *el,ProtoModel *model);
1124 };
1125 
1129  string name;
1131  vector<Datatype *> intypes;
1132  vector<string> innames;
1133  bool dotdotdot;
1134 };
1135 
1147 class FuncProto {
1148  enum {
1149  dotdotdot = 1,
1150  voidinputlock = 2,
1151  modellock = 4,
1152  is_inline = 8,
1153  no_return = 16,
1154  paramshift_applied = 32,
1155  error_inputparam = 64,
1156  error_outputparam = 128,
1157  custom_storage = 256,
1158  unknown_model = 512,
1159  is_constructor = 0x400,
1160  is_destructor = 0x800,
1161  has_thisptr= 0x1000,
1162  is_override = 0x2000
1163  };
1164  ProtoModel *model;
1165  ProtoStore *store;
1166  int4 extrapop;
1167  uint4 flags;
1168  vector<EffectRecord> effectlist;
1169  vector<VarnodeData> likelytrash;
1170  int4 injectid;
1171  int4 returnBytesConsumed;
1172 protected:
1173  void paramShift(int4 paramshift);
1174  bool isParamshiftApplied(void) const { return ((flags&paramshift_applied)!=0); }
1175  void setParamshiftApplied(bool val) { flags = val ? (flags|paramshift_applied) : (flags & ~((uint4)paramshift_applied)); }
1177 public:
1178  FuncProto(void);
1179  ~FuncProto(void);
1180  Architecture *getArch(void) const { return model->getArch(); }
1181  void copy(const FuncProto &op2);
1182  void copyFlowEffects(const FuncProto &op2);
1183  void getPieces(PrototypePieces &pieces) const;
1184  void setPieces(const PrototypePieces &pieces);
1185  void setScope(Scope *s,const Address &startpoint);
1186  void setInternal(ProtoModel *m,Datatype *vt);
1187  void setModel(ProtoModel *m);
1188  bool hasModel(void) const { return (model != (ProtoModel *)0); }
1189 
1190  bool hasMatchingModel(const FuncProto *op2) const { return (model == op2->model); }
1191  bool hasMatchingModel(const ProtoModel *op2) const { return (model == op2); }
1192  const string &getModelName(void) const { return model->getName(); }
1193  int4 getModelExtraPop(void) const { return model->getExtraPop(); }
1194 
1195  bool isInputLocked(void) const;
1196  bool isOutputLocked(void) const { return store->getOutput()->isTypeLocked(); }
1197  bool isModelLocked(void) const { return ((flags&modellock)!=0); }
1198  bool isUnknownModel(void) const { return ((flags&unknown_model)!=0); }
1199  bool hasCustomStorage(void) const { return ((flags&custom_storage)!=0); }
1200  void setInputLock(bool val);
1201  void setOutputLock(bool val);
1202 
1208  void setModelLock(bool val) { flags = val ? (flags|modellock) : (flags & ~((uint4)modellock)); }
1209 
1210  bool isInline(void) const { return ((flags & is_inline)!=0); }
1211 
1216  void setInline(bool val) { flags = val ? (flags|is_inline) : (flags & ~((uint4)is_inline)); }
1217 
1222  int4 getInjectId(void) const { return injectid; }
1223 
1228  int4 getReturnBytesConsumed(void) const { return returnBytesConsumed; }
1229 
1230  bool setReturnBytesConsumed(int4 val);
1231 
1233  bool isNoReturn(void) const { return ((flags & no_return)!=0); }
1234 
1238  void setNoReturn(bool val) { flags = val ? (flags|no_return) : (flags & ~((uint4)no_return)); }
1239 
1241  bool hasThisPointer(void) const { return ((flags & has_thisptr)!=0); }
1242 
1246  void setThisPointer(bool val) { flags = val ? (flags|has_thisptr) : (flags & ~((uint4)has_thisptr)); }
1247 
1249  bool isConstructor(void) const { return ((flags & is_constructor)!=0); }
1250 
1254  void setConstructor(bool val) { flags = val ? (flags|is_constructor) : (flags & ~((uint4)is_constructor)); }
1255 
1257  bool isDestructor(void) const { return ((flags & is_destructor)!=0); }
1258 
1262  void setDestructor(bool val) { flags = val ? (flags|is_destructor) : (flags & ~((uint4)is_destructor)); }
1263 
1265  bool hasInputErrors(void) const { return ((flags&error_inputparam)!=0); }
1266 
1268  bool hasOutputErrors(void) const { return ((flags&error_outputparam)!=0); }
1269 
1273  void setInputErrors(bool val) { flags = val ? (flags|error_inputparam) : (flags & ~((uint4)error_inputparam)); }
1274 
1278  void setOutputErrors(bool val) { flags = val ? (flags|error_outputparam) : (flags & ~((uint4)error_outputparam)); }
1279 
1280  int4 getExtraPop(void) const { return extrapop; }
1281  void setExtraPop(int4 ep) { extrapop = ep; }
1282  int4 getInjectUponEntry(void) const { return model->getInjectUponEntry(); }
1283  int4 getInjectUponReturn(void) const { return model->getInjectUponReturn(); }
1284  void resolveExtraPop(void);
1285 
1286  void clearUnlockedInput(void);
1287  void clearUnlockedOutput(void);
1288  void clearInput(void);
1289  void cancelInjectId(void);
1290 
1291  void resolveModel(ParamActive *active);
1292 
1297  void deriveInputMap(ParamActive *active) const {
1298  model->deriveInputMap(active); }
1299 
1304  void deriveOutputMap(ParamActive *active) const {
1305  model->deriveOutputMap(active); }
1306 
1316  bool checkInputJoin(const Address &hiaddr,int4 hisz,const Address &loaddr,int4 losz) const {
1317  return model->checkInputJoin(hiaddr,hisz,loaddr,losz); }
1318 
1327  bool checkInputSplit(const Address &loc,int4 size,int4 splitpoint) const {
1328  return model->checkInputSplit(loc,size,splitpoint); }
1329 
1330  void updateInputTypes(const vector<Varnode *> &triallist,ParamActive *activeinput);
1331  void updateInputNoTypes(const vector<Varnode *> &triallist,ParamActive *activeinput,TypeFactory *factory);
1332  void updateOutputTypes(const vector<Varnode *> &triallist);
1333  void updateOutputNoTypes(const vector<Varnode *> &triallist,TypeFactory *factory);
1334  void updateAllTypes(const vector<string> &namelist,const vector<Datatype *> &typelist,bool dtdtdt);
1335  ProtoParameter *getParam(int4 i) const { return store->getInput(i); }
1336  void removeParam(int4 i) { store->clearInput(i); }
1337  int4 numParams(void) const { return store->getNumInputs(); }
1338  ProtoParameter *getOutput(void) const { return store->getOutput(); }
1339  Datatype *getOutputType(void) const { return store->getOutput()->getType(); }
1340  const RangeList &getLocalRange(void) const { return model->getLocalRange(); }
1341  const RangeList &getParamRange(void) const { return model->getParamRange(); }
1342  bool isStackGrowsNegative(void) const { return model->isStackGrowsNegative(); }
1343  bool isDotdotdot(void) const { return ((flags&dotdotdot)!=0); }
1344  void setDotdotdot(bool val) { flags = val ? (flags|dotdotdot) : (flags & ~((uint4)dotdotdot)); }
1345  bool isOverride(void) const { return ((flags&is_override)!=0); }
1346  void setOverride(bool val) { flags = val ? (flags|is_override) : (flags & ~((uint4)is_override)); }
1347  uint4 hasEffect(const Address &addr,int4 size) const;
1348  vector<EffectRecord>::const_iterator effectBegin(void) const;
1349  vector<EffectRecord>::const_iterator effectEnd(void) const;
1350  int4 numLikelyTrash(void) const;
1351  const VarnodeData &getLikelyTrash(int4 i) const;
1352  int4 characterizeAsInputParam(const Address &addr,int4 size) const;
1353  bool possibleInputParam(const Address &addr,int4 size) const;
1354  bool possibleOutputParam(const Address &addr,int4 size) const;
1355 
1362  int4 getMaxInputDelay(void) const { return model->getMaxInputDelay(); }
1363 
1370  int4 getMaxOutputDelay(void) const { return model->getMaxOutputDelay(); }
1371 
1372  bool unjustifiedInputParam(const Address &addr,int4 size,VarnodeData &res) const;
1373 
1384  OpCode assumedInputExtension(const Address &addr,int4 size,VarnodeData &res) const {
1385  return model->assumedInputExtension(addr,size,res); }
1386 
1397  OpCode assumedOutputExtension(const Address &addr,int4 size,VarnodeData &res) const {
1398  return model->assumedOutputExtension(addr,size,res); }
1399 
1401  bool getBiggestContainedInputParam(const Address &loc,int4 size,VarnodeData &res) const;
1402 
1403  bool isCompatible(const FuncProto &op2) const;
1404  AddrSpace *getSpacebase(void) const { return model->getSpacebase(); }
1405  void printRaw(const string &funcname,ostream &s) const;
1406 
1411  uint4 getComparableFlags(void) const { return (flags & (dotdotdot | is_constructor | is_destructor | has_thisptr )); }
1412 
1413  void saveXml(ostream &s) const;
1414  void restoreXml(const Element *el,Architecture *glb);
1415 };
1416 
1417 class Funcdata;
1418 
1436 class FuncCallSpecs : public FuncProto {
1437  PcodeOp *op;
1438  string name;
1439  Address entryaddress;
1440  Funcdata *fd;
1441  int4 effective_extrapop;
1442  uintb stackoffset;
1443  int4 stackPlaceholderSlot;
1444  int4 paramshift;
1445  int4 matchCallCount;
1446  ParamActive activeinput;
1447  ParamActive activeoutput;
1448  mutable vector<int4> inputConsume;
1449  bool isinputactive;
1450  bool isoutputactive;
1451  bool isbadjumptable;
1452  Varnode *getSpacebaseRelative(void) const;
1453  Varnode *buildParam(Funcdata &data,Varnode *vn,ProtoParameter *param,Varnode *stackref);
1454  int4 transferLockedInputParam(ProtoParameter *param);
1455  PcodeOp *transferLockedOutputParam(ProtoParameter *param);
1456  bool transferLockedInput(vector<Varnode *> &newinput);
1457  bool transferLockedOutput(Varnode *&newoutput);
1458  void commitNewInputs(Funcdata &data,vector<Varnode *> &newinput);
1459  void commitNewOutputs(Funcdata &data,Varnode *newout);
1460  void collectOutputTrialVarnodes(vector<Varnode *> &trialvn);
1461 public:
1462  enum {
1463  offset_unknown = 0xBADBEEF
1464  };
1465  FuncCallSpecs(PcodeOp *call_op);
1466  void setAddress(const Address &addr) { entryaddress = addr; }
1467  PcodeOp *getOp(void) const { return op; }
1468  Funcdata *getFuncdata(void) const { return fd; }
1469  void setFuncdata(Funcdata *f);
1470  FuncCallSpecs *clone(PcodeOp *newop) const;
1471  const string &getName(void) const { return name; }
1472  const Address &getEntryAddress(void) const { return entryaddress; }
1473  void setEffectiveExtraPop(int4 epop) { effective_extrapop = epop; }
1474  int4 getEffectiveExtraPop(void) const { return effective_extrapop; }
1475  uintb getSpacebaseOffset(void) const { return stackoffset; }
1476  void setParamshift(int4 val) { paramshift = val; }
1477  int4 getParamshift(void) const { return paramshift; }
1478  int4 getMatchCallCount(void) const { return matchCallCount; }
1479  int4 getStackPlaceholderSlot(void) const { return stackPlaceholderSlot; }
1480  void setStackPlaceholderSlot(int4 slot) { stackPlaceholderSlot = slot;
1481  if (isinputactive) activeinput.setPlaceholderSlot(); }
1483  stackPlaceholderSlot = -1; if (isinputactive) activeinput.freePlaceholderSlot(); }
1484 
1485  void initActiveInput(void);
1486  void clearActiveInput(void) { isinputactive = false; }
1487  void initActiveOutput(void) { isoutputactive = true; }
1488  void clearActiveOutput(void) { isoutputactive = false; }
1489  bool isInputActive(void) const { return isinputactive; }
1490  bool isOutputActive(void) const { return isoutputactive; }
1491  void setBadJumpTable(bool val) { isbadjumptable = val; }
1492  bool isBadJumpTable(void) const { return isbadjumptable; }
1493  ParamActive *getActiveInput(void) { return &activeinput; }
1494  ParamActive *getActiveOutput(void) { return &activeoutput; }
1495 
1496  bool checkInputJoin(int4 slot1,bool ishislot,Varnode *vn1,Varnode *vn2) const;
1497  void doInputJoin(int4 slot1,bool ishislot);
1498  bool lateRestriction(const FuncProto &restrictedProto,vector<Varnode *> &newinput,Varnode *&newoutput);
1499  void deindirect(Funcdata &data,Funcdata *newfd);
1500  void forceSet(Funcdata &data,const FuncProto &fp);
1501  void insertPcode(Funcdata &data);
1502  void resolveSpacebaseRelative(Funcdata &data,Varnode *phvn);
1503  void abortSpacebaseRelative(Funcdata &data);
1504  void finalInputCheck(void);
1505  void checkInputTrialUse(Funcdata &data,AliasChecker &aliascheck);
1506  void checkOutputTrialUse(Funcdata &data,vector<Varnode *> &trialvn);
1507  void buildInputFromTrials(Funcdata &data);
1508  void buildOutputFromTrials(Funcdata &data,vector<Varnode *> &trialvn);
1509  int4 getInputBytesConsumed(int4 slot) const;
1510  bool setInputBytesConsumed(int4 slot,int4 val) const;
1511  void paramshiftModifyStart(void);
1512  bool paramshiftModifyStop(Funcdata &data);
1513  uint4 hasEffectTranslate(const Address &addr,int4 size) const;
1514  static Varnode *findPreexistingWhole(Varnode *vn1,Varnode *vn2);
1515 
1520  static FuncCallSpecs *getFspecFromConst(const Address &addr) { return (FuncCallSpecs *)(uintp)addr.getOffset(); }
1521 
1527  static bool compareByEntryAddress(const FuncCallSpecs *a,const FuncCallSpecs *b) { return a->entryaddress < b->entryaddress; }
1528  static void countMatchingCalls(const vector<FuncCallSpecs *> &qlst);
1529 };
1530 
1536 inline const ParamTrial &ParamActive::getTrialForInputVarnode(int4 slot) const
1537 
1538 {
1539  slot -= ((stackplaceholder<0)||(slot<stackplaceholder)) ? 1 : 2;
1540  return trial[slot];
1541 }
1542 
1546 inline bool EffectRecord::operator<(const EffectRecord &op2) const
1547 
1548 {
1549  if (address < op2.address) return true;
1550  if (address != op2.address) return false;
1551  return (type < op2.type);
1552 }
1553 
1554 inline bool EffectRecord::operator==(const EffectRecord &op2) const
1555 
1556 {
1557  if (address != op2.address) return false;
1558  return (type == op2.type);
1559 }
1560 
1561 inline bool EffectRecord::operator!=(const EffectRecord &op2) const
1562 
1563 {
1564  if (address != op2.address) return true;
1565  return (type != op2.type);
1566 }
1567 
1568 #endif
bool hasCustomStorage(void) const
Is this a "custom" function prototype.
Definition: fspec.hh:1199
void sortTrials(void)
Sort the trials in formal parameter order.
Definition: fspec.hh:251
ParameterSymbol(void)
Constructor.
Definition: fspec.hh:1056
bool dotdotdot
True if prototype takes variable arguments.
Definition: fspec.hh:1133
A region where processor data is stored.
Definition: space.hh:73
int4 maxdelay
Maximum heritage delay across all parameters.
Definition: fspec.hh:494
A class for analyzing parameters to a sub-function call.
Definition: fspec.hh:1436
virtual bool isMerged(void) const
Is this a merged prototype model.
Definition: fspec.hh:832
ProtoModelMerged(Architecture *g)
Constructor.
Definition: fspec.hh:885
Standard output (return value) model.
Definition: fspec.hh:343
uint4 getType(void) const
Get the type of effect.
Definition: fspec.hh:322
virtual ~ProtoParameter(void)
Destructor.
Definition: fspec.hh:906
int4 getNumMismatch(void) const
Get the number of mismatched trials.
Definition: fspec.hh:866
int4 numgroup
Number of groups in this parameter convention.
Definition: fspec.hh:493
int4 slotGroup(void) const
Get position of this within its parameter group.
Definition: fspec.hh:205
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely output prototype.
Definition: fspec.hh:660
Exception thrown when a prototype can&#39;t be modeled properly.
Definition: fspec.hh:28
uintb getSpacebaseOffset(void) const
Get the stack-pointer relative offset at the point of this call site.
Definition: fspec.hh:1475
The base datatype class for the decompiler.
Definition: type.hh:62
ParamUnassignedError(const string &s)
Constructor.
Definition: fspec.hh:29
void setIndCreateFormed(void)
Mark this trial as formed by indirect creation.
Definition: fspec.hh:201
void setThisPointer(bool val)
Toggle the this-call setting for this prototype.
Definition: fspec.hh:1246
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely input prototype.
Definition: fspec.hh:653
bool isRecoverSubcall(void) const
Are these trials for a call to a sub-function.
Definition: fspec.hh:242
virtual ProtoStore * clone(void) const
Clone the entire collection of parameter descriptions.
Definition: fspec.cc:2573
int4 getExtraPop(void) const
Get the general extrapop setting for this prototype.
Definition: fspec.hh:1280
int4 getGroupSize(void) const
Get the number of groups occupied by this.
Definition: fspec.hh:81
SubsortPosition subsorttype
The sub-sort object for a rangemap.
Definition: fspec.hh:130
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
A manager for different address spaces.
Definition: translate.hh:218
EffectRecord(void)
Constructor for use with restoreXml()
Definition: fspec.hh:317
void markUnref(void)
Mark that this trial has no Varnode representative.
Definition: fspec.hh:191
AddrSpace * getSpace(void) const
Get the address space containing this entry.
Definition: fspec.hh:94
type_metatype getType(void) const
Get the data-type class associated with this.
Definition: fspec.hh:85
AddrSpace * getSpacebase(void) const
Get the stack address space.
Definition: fspec.hh:1404
void setDotdotdot(bool val)
Toggle whether this takes variable arguments.
Definition: fspec.hh:1344
rangemap< ParamEntryRange > ParamEntryResolver
A map from offset to ParamEntry.
Definition: fspec.hh:141
vector< Datatype * > intypes
Input data-types.
Definition: fspec.hh:1131
virtual AddrSpace * getSpacebase(void) const
Get the address space associated with any stack based parameters in this list.
Definition: fspec.hh:527
int4 nonfloatgroup
Group of first entry which is not marked float.
Definition: fspec.hh:497
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:584
bool isParamCheckLow(void) const
Return true if there is a low overlap.
Definition: fspec.hh:100
ParamListRegister(void)
Constructor for use with restoreXml()
Definition: fspec.hh:563
void removeParam(int4 i)
Remove the i-th input parameter.
Definition: fspec.hh:1336
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
Container for data structures associated with a single function.
Definition: funcdata.hh:45
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.
int4 getSize(void) const
Get the number of bytes in this trial.
Definition: fspec.hh:181
void setInputErrors(bool val)
Toggle the input error setting for this prototype.
Definition: fspec.hh:1273
const ParamTrial & getTrialForInputVarnode(int4 slot) const
Get trial corresponding to the given input Varnode.
Definition: fspec.hh:1536
bool isReverseStack(void) const
Return true if parameters are allocated in reverse order.
Definition: fspec.hh:87
void initialize(const inittype &data, uintb f, uintb l)
Initialize the range.
Definition: fspec.hh:134
void assignParameterStorage(const vector< Datatype *> &typelist, vector< ParameterPieces > &res, bool ignoreOutputError)
Calculate input and output storage locations given a function prototype.
Definition: fspec.cc:1828
void setMaxPass(int4 val)
Set the maximum number of passes.
Definition: fspec.hh:249
AddrSpace * spacebase
Address space containing relative offset parameters.
Definition: fspec.hh:500
virtual bool isTypeLocked(void) const =0
Is the parameter data-type locked.
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely inputs for this prototype.
Definition: fspec.hh:1297
subsorttype getSubsort(void) const
Get the sub-subsort object.
Definition: fspec.hh:138
ParamListStandardOut(const ParamListStandardOut &op2)
Copy constructor.
Definition: fspec.hh:544
PcodeOp * getOp(void) const
Get the CALL or CALLIND corresponding to this.
Definition: fspec.hh:1467
void setModelLock(bool val)
Toggle the lock on the prototype model for this.
Definition: fspec.hh:1208
virtual Symbol * getSymbol(void) const
Retrieve the formal Symbol associated with this parameter.
Definition: fspec.hh:987
virtual Datatype * getType(void) const =0
Get the data-type associate with this.
vector< EffectRecord >::const_iterator effectEnd(void) const
Get an iterator to the last EffectRecord.
Definition: fspec.hh:703
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:615
bool isModelLocked(void) const
Is the prototype model for this locked.
Definition: fspec.hh:1197
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
void setRemFormed(void)
Mark that this is formed by a INT_REM operation.
Definition: fspec.hh:199
void markKilledByCall(void)
Mark that this storage is killed-by-call.
Definition: fspec.hh:192
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:1362
void setBadJumpTable(bool val)
Toggle whether call site looked like an indirect jump.
Definition: fspec.hh:1491
uintb getBase(void) const
Get the starting offset of this entry.
Definition: fspec.hh:95
int4 getGroup(void) const
Get the group id this belongs to.
Definition: fspec.hh:80
virtual int4 getMaxDelay(void) const
Return the maximum heritage delay across all possible parameters.
Definition: fspec.hh:529
void initActiveOutput(void)
Turn on analysis recovering the return value.
Definition: fspec.hh:1487
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
int4 getExtraPop(void) const
Get the stack-pointer extrapop for this model.
Definition: fspec.hh:644
ParamListStandardOut(void)
Constructor.
Definition: fspec.hh:543
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
bool isUnref(void) const
Does this trial not have a Varnode representative.
Definition: fspec.hh:197
type_metatype
Definition: type.hh:33
virtual bool isHiddenReturn(void) const
Is this a pointer to storage for a return value.
Definition: fspec.hh:980
int4 getScore(void) const
Get the fitness score.
Definition: fspec.hh:865
void setConstructor(bool val)
Toggle whether this prototype is a constructor method.
Definition: fspec.hh:1254
virtual Address getAddress(void) const =0
Get the storage address for this parameter.
virtual void fillinMap(ParamActive *active) const =0
Given an unordered list of storage locations, calculate a function prototype.
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
bool operator!=(const ProtoParameter &op2) const
Compare storage location and data-type for inequality.
Definition: fspec.hh:955
int4 getMaxPass(void) const
What is the maximum number of passes.
Definition: fspec.hh:248
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely return value for this prototype.
Definition: fspec.hh:1304
LowlevelError(const string &s)
Initialize the error with an explanatory string.
Definition: error.hh:47
A collection of parameter descriptions without backing symbols.
Definition: fspec.hh:1106
int4 getOffset(void) const
Get the offset associated with this trial.
Definition: fspec.hh:185
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
ParamEntryRange(void)
Constructor for use with rangemap.
Definition: fspec.hh:133
void markInactive(void)
Mark that trial is not actively used.
Definition: fspec.hh:189
virtual void clearInput(int4 i)=0
Clear the input parameter at the specified slot.
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
Class for calculating "goodness of fit" of parameter trials against a prototype model.
Definition: fspec.hh:843
int4 numParams(void) const
Get the number of input parameters.
Definition: fspec.hh:1337
bool isParamCheckHigh(void) const
Return true if there is a high overlap.
Definition: fspec.hh:99
virtual bool isNameUndefined(void) const
Is the name of this parameter undefined.
Definition: fspec.hh:981
Raw components of a function prototype (obtained from parsing source code)
Definition: fspec.hh:1127
bool hasCondExeEffect(void) const
Is this trial possibly affected by conditional execution.
Definition: fspec.hh:204
bool isRemFormed(void) const
Is this formed by a INT_REM operation.
Definition: fspec.hh:200
A union of other input parameter passing models.
Definition: fspec.hh:578
int4 getInjectUponReturn(void) const
Get any upon-return injection id (or -1)
Definition: fspec.hh:1283
ParamListStandard(void)
Construct for use with restoreXml()
Definition: fspec.hh:511
AddrSpace * space
The address space.
Definition: pcoderaw.hh:34
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:822
void freePlaceholderSlot(void)
Free the stack placeholder slot.
Definition: fspec.cc:1439
virtual AddrSpace * getSpacebase(void) const =0
Get the address space associated with any stack based parameters in this list.
int4 getParamshift(void) const
Get the parameter shift for this call site.
Definition: fspec.hh:1477
Datatype * getOutputType(void) const
Get the return value data-type.
Definition: fspec.hh:1339
virtual int4 getMaxDelay(void) const =0
Return the maximum heritage delay across all possible parameters.
Unordered parameter passing locations model.
Definition: fspec.hh:344
static uint4 lookupEffect(const vector< EffectRecord > &efflist, const Address &addr, int4 size)
Look up an effect from the given EffectRecord list.
Definition: fspec.cc:1857
bool hasThisPointer(void) const
Is this a prototype for a class method, taking a this pointer.
Definition: fspec.hh:1241
bool isDotdotdot(void) const
Return true if this takes a variable number of arguments.
Definition: fspec.hh:1343
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
int4 numModels(void) const
Get the number of constituent models.
Definition: fspec.hh:887
A parameter with a formal backing Symbol.
Definition: fspec.hh:1052
void setCondExeEffect(void)
Mark this trial as possibly affected by conditional execution.
Definition: fspec.hh:203
ProtoModel * getModel(int4 i) const
Get the i-th model.
Definition: fspec.hh:888
int4 characterizeAsInputParam(const Address &loc, int4 size) const
Characterize whether the given range overlaps parameter storage.
Definition: fspec.hh:717
Templates to define interval map containers.
int4 pointermax
If non-zero, maximum size of a data-type before converting to a pointer.
Definition: fspec.hh:495
const RangeList & getParamRange(void) const
Get the range of (possible) stack parameters.
Definition: fspec.hh:701
Datatype * type
The datatype of the parameter.
Definition: fspec.hh:296
virtual ~ProtoModelMerged(void)
Destructor.
Definition: fspec.hh:886
Address getAddress(void) const
Get the starting address of the affected range.
Definition: fspec.hh:323
int4 getSize(void) const
Get the type size.
Definition: type.hh:106
virtual bool isTypeLocked(void) const
Is the parameter data-type locked.
Definition: fspec.hh:976
Lowest level operation of the p-code language.
Definition: op.hh:58
Standard input parameter model.
Definition: fspec.hh:342
const RangeList & getLocalRange(void) const
Get the range of potential local stack variables.
Definition: fspec.hh:1340
bool hasMatchingModel(const FuncProto *op2) const
Does this have a matching model.
Definition: fspec.hh:1190
ParamEntry(int4 grp)
Constructor for use with restoreXml.
Definition: fspec.hh:78
void shrink(int4 i, const Address &addr, int4 sz)
Shrink the given trial to a new given range.
Definition: fspec.hh:270
bool isUnknownModel(void) const
Is prototype model officially "unknown".
Definition: fspec.hh:1198
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
bool isParamshiftApplied(void) const
Definition: fspec.hh:1174
Address addr
Storage address of the parameter.
Definition: fspec.hh:295
An unstructured model for passing input parameters to a function.
Definition: fspec.hh:561
void markUsed(void)
Mark the trial as a formal parameter.
Definition: fspec.hh:187
Prevents infinite loops.
Definition: varnode.hh:71
void setParamshift(int4 val)
Set a parameter shift for this call site.
Definition: fspec.hh:1476
bool hasThisPointer(void) const
Is this a model for (non-static) class methods.
Definition: fspec.hh:813
void finishPass(void)
Mark that an analysis pass has completed.
Definition: fspec.hh:250
bool isConstructor(void) const
Is this prototype for a class constructor method.
Definition: fspec.hh:1249
A contiguous range of memory that can be used to pass parameters.
Definition: fspec.hh:48
bool isIndCreateFormed(void) const
Is this trial formed by indirect creation.
Definition: fspec.hh:202
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
static FuncCallSpecs * getFspecFromConst(const Address &addr)
Convert FspecSpace addresses to the underlying FuncCallSpecs object.
Definition: fspec.hh:1520
Architecture * getArch(void) const
Get the Architecture owning this.
Definition: fspec.hh:1180
const ParamEntry * getEntry(void) const
Get the model entry associated with this trial.
Definition: fspec.hh:184
ParamListRegister(const ParamListRegister &op2)
Copy constructor.
Definition: fspec.hh:564
uintb offset
The offset within the space.
Definition: pcoderaw.hh:35
bool isOutputActive(void) const
Return true if return value recovery analysis is active.
Definition: fspec.hh:1490
virtual Address getAddress(void) const
Get the storage address for this parameter.
Definition: fspec.hh:974
The interface to a translation engine for a processor.
Definition: translate.hh:293
uint4 hasEffect(const Address &addr, int4 size) const
Determine side-effect of this on the given memory range.
Definition: fspec.cc:1888
vector< EffectRecord >::const_iterator effectBegin(void) const
Get an iterator to the first EffectRecord.
Definition: fspec.hh:702
Is this Varnode storing a pointer to the actual symbol.
Definition: varnode.hh:105
A standard model for passing back return values from a function.
Definition: fspec.hh:541
virtual bool getBiggestContainedParam(const Address &loc, int4 size, VarnodeData &res) const =0
Pass-back the biggest parameter contained within the given range.
void clearActiveInput(void)
Turn off analysis recovering input parameters.
Definition: fspec.hh:1486
ProtoParameter * getParam(int4 i) const
Get the i-th input parameter.
Definition: fspec.hh:1335
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
int4 getAlign(void) const
Get the alignment of this entry.
Definition: fspec.hh:84
bool isConstructor(void) const
Is this model for class constructors.
Definition: fspec.hh:814
void setStackPlaceholderSlot(int4 slot)
Set the slot of the stack-pointer placeholder.
Definition: fspec.hh:1480
virtual bool isMerged(void) const
Is this a merged prototype model.
Definition: fspec.hh:891
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:545
bool isChecked(void) const
Has this trial been checked.
Definition: fspec.hh:193
InitData inittype
Initialization data for a ScopeMapper.
Definition: fspec.hh:131
The lowest level error generated by the decompiler.
Definition: error.hh:44
Description of the indirect effect a sub-function has on a memory range.
Definition: fspec.hh:305
A record describing how logical values are split.
Definition: translate.hh:195
The Name of the Varnode is locked.
Definition: varnode.hh:83
bool hasInputErrors(void) const
Has this prototype been marked as having an incorrect input parameter descriptions.
Definition: fspec.hh:1265
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
void setExtraPop(int4 ep)
Set the general extrapop for this prototype.
Definition: fspec.hh:1281
int4 getMatchCallCount(void) const
Get the number of calls the caller makes to this sub-function.
Definition: fspec.hh:1478
ProtoParameter(void)
Constructor.
Definition: fspec.hh:905
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
void markFullyChecked(void)
Mark that all trials are checked.
Definition: fspec.hh:244
int4 getSlot(void) const
Get the slot associated with this trial.
Definition: fspec.hh:182
virtual Datatype * getType(void) const
Get the data-type associate with this.
Definition: fspec.hh:973
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:565
Class for storing ParamEntry objects in an interval range (rangemap)
Definition: fspec.hh:104
ProtoModel * model
(Optional) model on which prototype is based
Definition: fspec.hh:1128
virtual ~ProtoModel(void)
Destructor.
Definition: fspec.cc:1802
uint4 getComparableFlags(void) const
Get the comparable properties of this prototype.
Definition: fspec.hh:1411
bool possibleOutputParam(const Address &loc, int4 size) const
Does the given storage location make sense as a return value.
Definition: fspec.hh:736
bool isOutputLocked(void) const
Is the output data-type locked.
Definition: fspec.hh:1196
An XML element. A node in the DOM tree.
Definition: xml.hh:150
const RangeList & getParamRange(void) const
Get the range of potential stack parameters.
Definition: fspec.hh:1341
bool isExclusion(void) const
Return true if this holds a single parameter exclusively.
Definition: fspec.hh:86
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
int4 getReturnBytesConsumed(void) const
Get an estimate of the number of bytes consumed by callers of this prototype.
Definition: fspec.hh:1228
bool isBadJumpTable(void) const
Return true if this call site looked like an indirect jump.
Definition: fspec.hh:1492
vector< ParamEntryResolver * > resolverMap
Map from space id to resolver.
Definition: fspec.hh:499
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
uint4 flags
additional attributes of the parameter
Definition: fspec.hh:297
list< ParamEntry > entry
The ordered list of parameter entries.
Definition: fspec.hh:498
void setEntry(const ParamEntry *ent, int4 off)
Set the model entry for this trial.
Definition: fspec.hh:186
virtual int4 characterizeAsParam(const Address &loc, int4 size) const =0
Characterize whether the given range overlaps parameter storage.
int4 getInjectId(void) const
Get the injection id associated with this.
Definition: fspec.hh:1222
bool hasMatchingModel(const ProtoModel *op2) const
Does this use the given model.
Definition: fspec.hh:1191
void clearStackPlaceholderSlot(void)
Release the stack-pointer placeholder.
Definition: fspec.hh:1482
static bool compareByEntryAddress(const FuncCallSpecs *a, const FuncCallSpecs *b)
Compare FuncCallSpecs by function entry address.
Definition: fspec.hh:1527
Datatype * outtype
Return data-type.
Definition: fspec.hh:1130
Does this varnode point to the return value storage location.
Definition: varnode.hh:106
A light-weight class for analyzing pointers and aliasing on the stack.
Definition: varmap.hh:108
int4 getInjectUponReturn(void) const
Get the inject uponreturn id.
Definition: fspec.hh:647
bool thisbeforeret
Does a this parameter come before a hidden return parameter.
Definition: fspec.hh:496
bool isUsed(void) const
Is this trial as a formal parameter.
Definition: fspec.hh:196
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:515
int4 getSize(void) const
Get the size of the memory range in bytes.
Definition: fspec.hh:82
uint4 size
The number of bytes in the location.
Definition: pcoderaw.hh:36
int4 getMinSize(void) const
Get the minimum size of a logical value contained in this.
Definition: fspec.hh:83
A collection of parameter descriptions backed by Symbol information.
Definition: fspec.hh:1080
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
const string & getModelName(void) const
Get the prototype model name.
Definition: fspec.hh:1192
virtual bool isSizeTypeLocked(void) const
Is the size of the parameter locked.
Definition: fspec.hh:978
bool operator==(const ProtoParameter &op2) const
Compare storage location and data-type for equality.
Definition: fspec.hh:945
bool isStackGrowsNegative(void) const
Return true if the stack grows toward smaller addresses.
Definition: fspec.hh:812
bool isActive(void) const
Is this trial actively used in data-flow.
Definition: fspec.hh:194
virtual ProtoParameter * getOutput(void)=0
Get the return-value description.
An interval map container.
Definition: rangemap.hh:65
ParamTrial(const Address &ad, int4 sz, int4 sl)
Construct from components.
Definition: fspec.hh:179
virtual const string & getName(void) const
Get the name of the parameter ("" for return value)
Definition: fspec.hh:972
bool needsFinalCheck(void) const
Is a final check required.
Definition: fspec.hh:240
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:1370
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.
void finalize(void)
Fold-ins are finished, finalize this.
Definition: fspec.hh:583
ParamEntry * getParamEntry(void) const
Get pointer to actual ParamEntry.
Definition: fspec.hh:139
virtual bool isNameLocked(void) const
Is the parameter name locked.
Definition: fspec.hh:977
int4 getNumTrials(void) const
Get the number of trials in this container.
Definition: fspec.hh:236
EffectRecord(const EffectRecord &op2)
Copy constructor.
Definition: fspec.hh:318
uintb getFirst(void) const
Get the first address in the range.
Definition: fspec.hh:136
bool isStackGrowsNegative(void) const
Return true if the stack grows toward smaller addresses.
Definition: fspec.hh:1342
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 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.
int4 getInjectUponEntry(void) const
Get the inject uponentry id.
Definition: fspec.hh:646
A function prototype.
Definition: fspec.hh:1147
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
int4 getNumPasses(void) const
How many trial analysis passes were performed.
Definition: fspec.hh:247
virtual OpCode assumedExtension(const Address &addr, int4 size, VarnodeData &res) const =0
Get the type of extension and containing parameter for the given storage.
int4 getModelExtraPop(void) const
Get the extrapop of the prototype model.
Definition: fspec.hh:1193
void setAddress(const Address &ad, int4 sz)
Reset the memory range of this trial.
Definition: fspec.hh:206
void setExtraPop(int4 ep)
Set the stack-pointer extrapop.
Definition: fspec.hh:645
Architecture * getArch(void) const
Get the owning Architecture.
Definition: fspec.hh:642
int4 numLikelyTrash(void) const
Get the number of likelytrash locations.
Definition: fspec.hh:704
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
int4 getStackPlaceholderSlot(void) const
Get the slot of the stack-pointer placeholder.
Definition: fspec.hh:1479
void clearActiveOutput(void)
Turn off analysis recovering the return value.
Definition: fspec.hh:1488
Definition: fspec.hh:339
bool isInputActive(void) const
Return true if input parameter recovery analysis is active.
Definition: fspec.hh:1489
void markActive(void)
Mark that trial is actively used (in data-flow)
Definition: fspec.hh:188
bool isDestructor(void) const
Is this prototype for a class destructor method.
Definition: fspec.hh:1257
The base class for a symbol in a symbol table or scope.
Definition: database.hh:153
Reserved extrapop value meaning the function&#39;s extrapop is unknown.
Definition: fspec.hh:636
ParamActive * getActiveOutput(void)
Get the analysis object for return value recovery.
Definition: fspec.hh:1494
const string & getName(void) const
Get the name of the prototype model.
Definition: fspec.hh:641
A standard model for parameters as an ordered list of storage resources.
Definition: fspec.hh:491
void setSlot(int4 val)
Set the slot associated with this trial.
Definition: fspec.hh:183
virtual ~ProtoStore(void)
Constructor.
Definition: fspec.hh:997
ParamListMerged(void)
Constructor for use with restoreXml.
Definition: fspec.hh:580
void markNoUse(void)
Mark trial as definitely not a parameter.
Definition: fspec.hh:190
Container class for ParamTrial objects.
Definition: fspec.hh:223
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
string name
Identifier (function name) associated with prototype.
Definition: fspec.hh:1129
bool isDefinitelyNotUsed(void) const
Is this trial as definitely not a parameter.
Definition: fspec.hh:195
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.hh:588
ParamListMerged(const ParamListMerged &op2)
Copy constructor.
Definition: fspec.hh:581
virtual bool unjustifiedContainer(const Address &loc, int4 size, VarnodeData &res) const =0
Check if the given storage location looks like an unjustified parameter.
const list< ParamEntry > & getEntry(void) const
Get the list of parameter entries.
Definition: fspec.hh:514
const VarnodeData & getLikelyTrash(int4 i) const
Get the i-th likelytrashh location.
Definition: fspec.hh:705
The Dataype of the Varnode is locked.
Definition: varnode.hh:82
A stand-alone parameter with no backing symbol.
Definition: fspec.hh:964
const RangeList & getLocalRange(void) const
Get the range of (possible) local stack variables.
Definition: fspec.hh:700
uintb getLast(void) const
Get the last address in the range.
Definition: fspec.hh:137
A special space for encoding FuncCallSpecs.
Definition: fspec.hh:283
A register or memory register that may be used to pass a parameter or return value.
Definition: fspec.hh:157
int4 getInjectUponEntry(void) const
Get any upon-entry injection id (or -1)
Definition: fspec.hh:1282
void setInline(bool val)
Toggle the in-line setting for functions with this prototype.
Definition: fspec.hh:1216
ProtoModel(Architecture *g)
Constructor for use with restoreXml()
Definition: fspec.cc:1756
void setOverride(bool val)
Toggle whether this is a call site override.
Definition: fspec.hh:1346
bool isKilledByCall(void) const
Is this storage killed-by-call.
Definition: fspec.hh:198
bool isFullyChecked(void) const
Are all trials checked with no new trials expected.
Definition: fspec.hh:243
bool operator!=(const EffectRecord &op2) const
Inequality operator.
Definition: fspec.hh:1561
ParameterBasic(const string &nm, const Address &ad, Datatype *tp, uint4 fl)
Construct from components.
Definition: fspec.hh:970
const Address & getAddress(void) const
Get the starting address of this trial.
Definition: fspec.hh:180
A function parameter viewed as a name, data-type, and storage address.
Definition: fspec.hh:903
virtual void restoreXml(const Element *el)
Restore this model from an XML stream.
Definition: fspec.cc:2247
virtual ~ParamList(void)
Destructor.
Definition: fspec.hh:347
void setDestructor(bool val)
Toggle whether this prototype is a destructor method.
Definition: fspec.hh:1262
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:408
The PcodeOp and PcodeOpBank classes.
const Address & getEntryAddress(void) const
Get the entry address of the callee.
Definition: fspec.hh:1472
AddrSpace * getSpacebase(void) const
Get the stack space associated with this model.
Definition: fspec.hh:811
int4 getEffectiveExtraPop(void) const
Get the specific extrapop associate with this call site.
Definition: fspec.hh:1474
Basic elements of a parameter: address, data-type, properties.
Definition: fspec.hh:294
bool isNoReturn(void) const
Does a function with this prototype never return.
Definition: fspec.hh:1233
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
bool possibleInputParam(const Address &loc, int4 size) const
Does the given storage location make sense as an input parameter.
Definition: fspec.hh:727
void setAddress(const Address &addr)
Set (override) the callee&#39;s entry address.
Definition: fspec.hh:1466
void markNeedsFinalCheck(void)
Mark that a final check is required.
Definition: fspec.hh:241
A prototype model made by merging together other models.
Definition: fspec.hh:880
virtual bool isIndirectStorage(void) const
Is this really a pointer to the true parameter.
Definition: fspec.hh:979
ProtoParameter * getOutput(void) const
Get the return value.
Definition: fspec.hh:1338
int4 getSlot(const Address &addr, int4 skip) const
Calculate the slot occupied by a specific address.
Definition: fspec.cc:231
bool operator<(const EffectRecord &op2) const
Comparator for EffectRecords.
Definition: fspec.hh:1546
virtual ProtoParameter * getInput(int4 i)=0
Get the i-th input parameter (or NULL if it doesn&#39;t exist)
bool hasOutputErrors(void) const
Has this prototype been marked as having an incorrect return value description.
Definition: fspec.hh:1268
virtual int4 getNumInputs(void) const =0
Get the number of input parameters for this prototype.
virtual bool possibleParam(const Address &loc, int4 size) const =0
Does the given storage location make sense as a parameter.
bool isOverride(void) const
Return true if this is a call site override.
Definition: fspec.hh:1345
virtual int4 getSize(void) const
Get the number of bytes occupied by this parameter.
Definition: fspec.hh:975
A collection parameter descriptions making up a function prototype.
Definition: fspec.hh:995
void setEffectiveExtraPop(int4 epop)
Set the specific extrapop associate with this call site.
Definition: fspec.hh:1473
void setPlaceholderSlot(void)
Establish a stack placedholder slot.
Definition: fspec.hh:245
ParamTrial & getTrial(int4 i)
Get the i-th trial.
Definition: fspec.hh:237
bool isInline(void) const
Does this function get in-lined during decompilation.
Definition: fspec.hh:1210
vector< string > innames
Identifiers for input types.
Definition: fspec.hh:1132
ParamActive * getActiveInput(void)
Get the analysis object for input parameter recovery.
Definition: fspec.hh:1493
const string & getName(void) const
Get the function name associated with the callee.
Definition: fspec.hh:1471
bool operator==(const EffectRecord &op2) const
Equality operator.
Definition: fspec.hh:1554
Data defining a specific memory location.
Definition: pcoderaw.hh:33
Funcdata * getFuncdata(void) const
Get the Funcdata object associated with the called function.
Definition: fspec.hh:1468
void setOutputErrors(bool val)
Toggle the output error setting for this prototype.
Definition: fspec.hh:1278
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:413
int4 getSize(void) const
Get the size of the affected range.
Definition: fspec.hh:324
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:830
void setNoReturn(bool val)
Toggle the no-return setting for functions with this prototype.
Definition: fspec.hh:1238
bool hasModel(void) const
Does this prototype have a model.
Definition: fspec.hh:1188