Ghidra Decompiler Analysis Engine
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 {
55 // is_big_endian = 16, ///< Set if this value should be treated as big endian
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(const inittype &data,uintb f,uintb l) {
134  first = f; last = l; position = data.position; entry = data.entry; }
135  uintb getFirst(void) const { return first; }
136  uintb getLast(void) const { return last; }
137  subsorttype getSubsort(void) const { return SubsortPosition(position); }
138  ParamEntry *getParamEntry(void) const { return entry; }
139 };
141 
156 class ParamTrial {
157 public:
158  enum {
159  checked = 1,
160  used = 2,
161  defnouse = 4,
162  active = 8,
163  unref = 16,
165  rem_formed = 64,
168  };
169 private:
170  uint4 flags;
171  Address addr;
172  int4 size;
173  int4 slot;
174  const ParamEntry *entry;
175  int4 offset;
176 public:
178  ParamTrial(const Address &ad,int4 sz,int4 sl) { addr = ad; size = sz; slot = sl; flags=0; entry=(ParamEntry *)0; offset=-1; }
179  const Address &getAddress(void) const { return addr; }
180  int4 getSize(void) const { return size; }
181  int4 getSlot(void) const { return slot; }
182  void setSlot(int4 val) { slot = val; }
183  const ParamEntry *getEntry(void) const { return entry; }
184  int4 getOffset(void) const { return offset; }
185  void setEntry(const ParamEntry *ent,int4 off) { entry=ent; offset=off; }
186  void markUsed(void) { flags |= used; }
187  void markActive(void) { flags |= (active|checked); }
188  void markInactive(void) { flags &= ~((uint4)active); flags |= checked; }
189  void markNoUse(void) { flags &= ~((uint4)(active|used)); flags |= (checked|defnouse); }
190  void markUnref(void) { flags |= (unref|checked); slot = -1; }
191  void markKilledByCall(void) { flags |= killedbycall; }
192  bool isChecked(void) const { return ((flags & checked)!=0); }
193  bool isActive(void) const { return ((flags & active)!=0); }
194  bool isDefinitelyNotUsed(void) const { return ((flags & defnouse)!=0); }
195  bool isUsed(void) const { return ((flags & used)!=0); }
196  bool isUnref(void) const { return ((flags & unref)!=0); }
197  bool isKilledByCall(void) const { return ((flags & killedbycall)!=0); }
198  void setRemFormed(void) { flags |= rem_formed; }
199  bool isRemFormed(void) const { return ((flags & rem_formed)!=0); }
200  void setIndCreateFormed(void) { flags |= indcreate_formed; }
201  bool isIndCreateFormed(void) const { return ((flags & indcreate_formed)!=0); }
202  void setCondExeEffect(void) { flags |= condexe_effect; }
203  bool hasCondExeEffect(void) const { return ((flags & condexe_effect)!=0); }
204  int4 slotGroup(void) const { return entry->getSlot(addr,size-1); }
205  void setAddress(const Address &ad,int4 sz) { addr=ad; size=sz; }
206  ParamTrial splitHi(int4 sz) const;
207  ParamTrial splitLo(int4 sz) const;
208  bool testShrink(const Address &newaddr,int4 sz) const;
209  bool operator<(const ParamTrial &b) const;
210 };
211 
222 class ParamActive {
223  vector<ParamTrial> trial;
224  int4 slotbase;
225  int4 stackplaceholder;
226  int4 numpasses;
227  int4 maxpass;
228  bool isfullychecked;
229  bool needsfinalcheck;
230  bool recoversubcall;
231 public:
232  ParamActive(bool recoversub);
233  void clear(void);
234  void registerTrial(const Address &addr,int4 sz);
235  int4 getNumTrials(void) const { return trial.size(); }
236  ParamTrial &getTrial(int4 i) { return trial[i]; }
237  const ParamTrial &getTrialForInputVarnode(int4 slot) const;
238  int4 whichTrial(const Address &addr,int4 sz) const;
239  bool needsFinalCheck(void) const { return needsfinalcheck; }
240  void markNeedsFinalCheck(void) { needsfinalcheck = true; }
241  bool isRecoverSubcall(void) const { return recoversubcall; }
242  bool isFullyChecked(void) const { return isfullychecked; }
243  void markFullyChecked(void) { isfullychecked = true; }
244  void setPlaceholderSlot(void) { stackplaceholder = slotbase; slotbase += 1; }
245  void freePlaceholderSlot(void);
246  int4 getNumPasses(void) const { return numpasses; }
247  int4 getMaxPass(void) const { return maxpass; }
248  void setMaxPass(int4 val) { maxpass = val; }
249  void finishPass(void) { numpasses += 1; }
250  void sortTrials(void) { sort(trial.begin(),trial.end()); }
251  void deleteUnusedTrials(void);
252  void splitTrial(int4 i,int4 sz);
253  void joinTrial(int4 slot,const Address &addr,int4 sz);
254  int4 getNumUsed(void) const;
255 
262  bool testShrink(int4 i,const Address &addr,int4 sz) const { return trial[i].testShrink(addr,sz); }
263 
269  void shrink(int4 i,const Address &addr,int4 sz) { trial[i].setAddress(addr,sz); }
270 };
271 
282 class FspecSpace : public AddrSpace {
283 public:
284  FspecSpace(AddrSpaceManager *m,const Translate *t,const string &nm,int4 ind);
285  virtual void saveXmlAttributes(ostream &s,uintb offset) const;
286  virtual void saveXmlAttributes(ostream &s,uintb offset,int4 size) const;
287  virtual void printRaw(ostream &s,uintb offset) const;
288  virtual void saveXml(ostream &s) const;
289  virtual void restoreXml(const Element *el);
290 };
291 
294  enum {
295  isthis = 1,
298  namelock = 8,
299  typelock = 16,
300  sizelock = 32
301  };
304  uint4 flags;
305 };
306 
313 public:
314  enum {
319  };
320 private:
321  VarnodeData address;
322  uint4 type;
323 public:
324  EffectRecord(void) {}
325  EffectRecord(const EffectRecord &op2) { address = op2.address; type = op2.type; }
326  EffectRecord(const Address &addr,int4 size);
327  EffectRecord(const ParamEntry &entry,uint4 t);
328  EffectRecord(const VarnodeData &addr,uint4 t);
329  uint4 getType(void) const { return type; }
330  Address getAddress(void) const { return Address(address.space,address.offset); }
331  int4 getSize(void) const { return address.size; }
332  bool operator<(const EffectRecord &op2) const;
333  bool operator==(const EffectRecord &op2) const;
334  bool operator!=(const EffectRecord &op2) const;
335  void saveXml(ostream &s) const;
336  void restoreXml(uint4 grouptype,const Element *el,const AddrSpaceManager *manage);
337 };
338 
346 class ParamList {
347 public:
348  enum {
353  };
354  virtual ~ParamList(void) {}
355  virtual uint4 getType(void) const=0;
356 
364  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
365  TypeFactory &typefactory,vector<ParameterPieces> &res) const=0;
366 
373  virtual void fillinMap(ParamActive *active) const=0;
374 
384  virtual bool checkJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const=0;
385 
394  virtual bool checkSplit(const Address &loc,int4 size,int4 splitpoint) const=0;
395 
406  virtual int4 characterizeAsParam(const Address &loc,int4 size) const=0;
407 
414  virtual bool possibleParam(const Address &loc,int4 size) const=0;
415 
425  virtual bool possibleParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const=0;
426 
433  virtual bool getBiggestContainedParam(const Address &loc,int4 size,VarnodeData &res) const=0;
434 
444  virtual bool unjustifiedContainer(const Address &loc,int4 size,VarnodeData &res) const=0;
445 
456  virtual OpCode assumedExtension(const Address &addr,int4 size,VarnodeData &res) const=0;
457 
461  virtual AddrSpace *getSpacebase(void) const=0;
462 
468  virtual void getRangeList(AddrSpace *spc,RangeList &res) const=0;
469 
476  virtual int4 getMaxDelay(void) const=0;
477 
484  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack)=0;
485 
486  virtual ParamList *clone(void) const=0;
487 };
488 
498 class ParamListStandard : public ParamList {
499 protected:
500  int4 numgroup;
501  int4 maxdelay;
502  int4 pointermax;
505  list<ParamEntry> entry;
506  vector<ParamEntryResolver *> resolverMap;
508  const ParamEntry *findEntry(const Address &loc,int4 size) const;
509  Address assignAddress(const Datatype *tp,vector<int4> &status) const;
510  void buildTrialMap(ParamActive *active) const;
511  void separateFloat(ParamActive *active,int4 &floatstart,int4 &floatstop,int4 &start,int4 &stop) const;
512  void forceExclusionGroup(ParamActive *active) const;
513  void forceNoUse(ParamActive *active,int4 start,int4 stop) const;
514  void forceInactiveChain(ParamActive *active,int4 maxchain,int4 start,int4 stop) const;
515  void calcDelay(void);
516  void populateResolver(void);
517 public:
518  ParamListStandard(void) {}
520  virtual ~ParamListStandard(void);
521  const list<ParamEntry> &getEntry(void) const { return entry; }
522  virtual uint4 getType(void) const { return p_standard; }
523  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
524  TypeFactory &typefactory,vector<ParameterPieces> &res) const;
525  virtual void fillinMap(ParamActive *active) const;
526  virtual bool checkJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const;
527  virtual bool checkSplit(const Address &loc,int4 size,int4 splitpoint) const;
528  virtual int4 characterizeAsParam(const Address &loc,int4 size) const;
529  virtual bool possibleParam(const Address &loc,int4 size) const;
530  virtual bool possibleParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const;
531  virtual bool getBiggestContainedParam(const Address &loc,int4 size,VarnodeData &res) const;
532  virtual bool unjustifiedContainer(const Address &loc,int4 size,VarnodeData &res) const;
533  virtual OpCode assumedExtension(const Address &addr,int4 size,VarnodeData &res) const;
534  virtual AddrSpace *getSpacebase(void) const { return spacebase; }
535  virtual void getRangeList(AddrSpace *spc,RangeList &res) const;
536  virtual int4 getMaxDelay(void) const { return maxdelay; }
537  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack);
538  virtual ParamList *clone(void) const;
539 };
540 
549 public:
552  virtual uint4 getType(void) const { return p_standard_out; }
553  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
554  TypeFactory &typefactory,vector<ParameterPieces> &res) const;
555  virtual void fillinMap(ParamActive *active) const;
556  virtual bool possibleParam(const Address &loc,int4 size) const;
557  virtual void restoreXml(const Element *el,const AddrSpaceManager *manage,vector<EffectRecord> &effectlist,bool normalstack);
558  virtual ParamList *clone(void) const;
559 };
560 
569 public:
572  virtual uint4 getType(void) const { return p_register; }
573  virtual void fillinMap(ParamActive *active) const;
574  virtual ParamList *clone(void) const;
575 };
576 
586 public:
587  ParamListMerged(void) : ParamListStandard() {}
588  ParamListMerged(const ParamListMerged &op2) : ParamListStandard(op2) {}
589  void foldIn(const ParamListStandard &op2);
590  void finalize(void) { populateResolver(); }
591  virtual uint4 getType(void) const { return p_merged; }
592  virtual void assignMap(const vector<Datatype *> &proto,bool isinput,
593  TypeFactory &typefactory,vector<ParameterPieces> &res) const {
594  throw LowlevelError("Cannot assign prototype before model has been resolved"); }
595  virtual void fillinMap(ParamActive *active) const {
596  throw LowlevelError("Cannot determine prototype before model has been resolved"); }
597  virtual ParamList *clone(void) const;
598 };
599 
622 class ProtoModel {
623  friend class ProtoModelMerged;
624  Architecture *glb;
625  string name;
626  int4 extrapop;
627  ParamList *input;
628  ParamList *output;
629  const ProtoModel *compatModel;
630  vector<EffectRecord> effectlist;
631  vector<VarnodeData> likelytrash;
632  int4 injectUponEntry;
633  int4 injectUponReturn;
634  RangeList localrange;
635  RangeList paramrange;
636  bool stackgrowsnegative;
637  bool hasThis;
638  bool isConstruct;
639  void defaultLocalRange(void);
640  void defaultParamRange(void);
641  void buildParamList(const string &strategy);
642 public:
643  enum {
645  };
647  ProtoModel(const string &nm,const ProtoModel &op2);
648  virtual ~ProtoModel(void);
649  const string &getName(void) const { return name; }
650  Architecture *getArch(void) const { return glb; }
651  uint4 hasEffect(const Address &addr,int4 size) const;
652  int4 getExtraPop(void) const { return extrapop; }
653  void setExtraPop(int4 ep) { extrapop = ep; }
654  int4 getInjectUponEntry(void) const { return injectUponEntry; }
655  int4 getInjectUponReturn(void) const { return injectUponReturn; }
656  bool isCompatible(const ProtoModel *op2) const;
657 
662  void deriveInputMap(ParamActive *active) const {
663  input->fillinMap(active); }
664 
669  void deriveOutputMap(ParamActive *active) const {
670  output->fillinMap(active); }
671 
672  void assignParameterStorage(const vector<Datatype *> &typelist,vector<ParameterPieces> &res,bool ignoreOutputError);
673 
683  bool checkInputJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const {
684  return input->checkJoin(hiaddr,hisize,loaddr,losize); }
685 
695  bool checkOutputJoin(const Address &hiaddr,int4 hisize,const Address &loaddr,int4 losize) const {
696  return output->checkJoin(hiaddr,hisize,loaddr,losize); }
697 
706  bool checkInputSplit(const Address &loc,int4 size,int4 splitpoint) const {
707  return input->checkSplit(loc,size,splitpoint); }
708 
709  const RangeList &getLocalRange(void) const { return localrange; }
710  const RangeList &getParamRange(void) const { return paramrange; }
711  vector<EffectRecord>::const_iterator effectBegin(void) const { return effectlist.begin(); }
712  vector<EffectRecord>::const_iterator effectEnd(void) const { return effectlist.end(); }
713  int4 numLikelyTrash(void) const { return likelytrash.size(); }
714  const VarnodeData &getLikelyTrash(int4 i) const { return likelytrash[i]; }
715 
726  int4 characterizeAsInputParam(const Address &loc,int4 size) const {
727  return input->characterizeAsParam(loc, size);
728  }
729 
736  bool possibleInputParam(const Address &loc,int4 size) const {
737  return input->possibleParam(loc,size); }
738 
745  bool possibleOutputParam(const Address &loc,int4 size) const {
746  return output->possibleParam(loc,size); }
747 
757  bool possibleInputParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const {
758  return input->possibleParamWithSlot(loc,size,slot,slotsize); }
759 
769  bool possibleOutputParamWithSlot(const Address &loc,int4 size,int4 &slot,int4 &slotsize) const {
770  return output->possibleParamWithSlot(loc,size,slot,slotsize); }
771 
781  bool unjustifiedInputParam(const Address &loc,int4 size,VarnodeData &res) const {
782  return input->unjustifiedContainer(loc,size,res); }
783 
794  OpCode assumedInputExtension(const Address &addr,int4 size,VarnodeData &res) const {
795  return input->assumedExtension(addr,size,res); }
796 
807  OpCode assumedOutputExtension(const Address &addr,int4 size,VarnodeData &res) const {
808  return output->assumedExtension(addr,size,res); }
809 
816  bool getBiggestContainedInputParam(const Address &loc,int4 size,VarnodeData &res) const {
817  return input->getBiggestContainedParam(loc, size, res);
818  }
819 
820  AddrSpace *getSpacebase(void) const { return input->getSpacebase(); }
821  bool isStackGrowsNegative(void) const { return stackgrowsnegative; }
822  bool hasThisPointer(void) const { return hasThis; }
823  bool isConstructor(void) const { return isConstruct; }
824 
831  int4 getMaxInputDelay(void) const { return input->getMaxDelay(); }
832 
839  int4 getMaxOutputDelay(void) const { return output->getMaxDelay(); }
840 
841  virtual bool isMerged(void) const { return false; }
842  virtual void restoreXml(const Element *el);
843  static uint4 lookupEffect(const vector<EffectRecord> &efflist,const Address &addr,int4 size);
844 };
845 
854  class PEntry {
855  public:
856  int4 origIndex;
857  int4 slot;
858  int4 size;
859  bool operator<(const PEntry &op2) const { return (slot < op2.slot); }
864  };
865  bool isinputscore;
866  vector<PEntry> entry;
867  const ProtoModel *model;
868  int4 finalscore;
869  int4 mismatch;
870 public:
871  ScoreProtoModel(bool isinput,const ProtoModel *mod,int4 numparam);
872  void addParameter(const Address &addr,int4 sz);
873  void doScore(void);
874  int4 getScore(void) const { return finalscore; }
875  int4 getNumMismatch(void) const { return mismatch; }
876 };
877 
889 class ProtoModelMerged : public ProtoModel {
890  vector<ProtoModel *> modellist;
891  void intersectEffects(const vector<EffectRecord> &efflist);
892  void intersectLikelyTrash(const vector<VarnodeData> &trashlist);
893 public:
895  virtual ~ProtoModelMerged(void) {}
896  int4 numModels(void) const { return modellist.size(); }
897  ProtoModel *getModel(int4 i) const { return modellist[i]; }
898  void foldIn(ProtoModel *model);
899  ProtoModel *selectModel(ParamActive *active) const;
900  virtual bool isMerged(void) const { return true; }
901  virtual void restoreXml(const Element *el);
902 };
903 
904 class Symbol;
905 class AliasChecker;
906 
913 public:
914  ProtoParameter(void) {}
915  virtual ~ProtoParameter(void) {}
916  virtual const string &getName(void) const=0;
917  virtual Datatype *getType(void) const=0;
918  virtual Address getAddress(void) const=0;
919  virtual int4 getSize(void) const=0;
920  virtual bool isTypeLocked(void) const=0;
921  virtual bool isNameLocked(void) const=0;
922  virtual bool isSizeTypeLocked(void) const=0;
923  virtual bool isThisPointer(void) const=0;
924  virtual bool isIndirectStorage(void) const=0;
925  virtual bool isHiddenReturn(void) const=0;
926  virtual bool isNameUndefined(void) const=0;
927  virtual void setTypeLock(bool val)=0;
928  virtual void setNameLock(bool val)=0;
929  virtual void setThisPointer(bool val)=0;
930 
936  virtual void overrideSizeLockType(Datatype *ct)=0;
937 
942  virtual void resetSizeLockType(TypeFactory *factory)=0;
943 
944  virtual ProtoParameter *clone(void) const=0;
945 
950  virtual Symbol *getSymbol(void) const=0;
951 
956  bool operator==(const ProtoParameter &op2) const {
957  if (getAddress() != op2.getAddress()) return false;
958  if (getType() != op2.getType()) return false;
959  return true;
960  }
961 
966  bool operator!=(const ProtoParameter &op2) const {
967  return !(*this==op2); }
968 };
969 
976  string name;
977  Address addr;
978  Datatype *type;
979  uint4 flags;
980 public:
981  ParameterBasic(const string &nm,const Address &ad,Datatype *tp,uint4 fl) {
982  name = nm; addr = ad; type = tp; flags=fl; }
983  ParameterBasic(Datatype *tp) {
984  type = tp; flags = 0; }
985  virtual const string &getName(void) const { return name; }
986  virtual Datatype *getType(void) const { return type; }
987  virtual Address getAddress(void) const { return addr; }
988  virtual int4 getSize(void) const { return type->getSize(); }
989  virtual bool isTypeLocked(void) const { return ((flags&ParameterPieces::typelock)!=0); }
990  virtual bool isNameLocked(void) const { return ((flags&ParameterPieces::namelock)!=0); }
991  virtual bool isSizeTypeLocked(void) const { return ((flags&ParameterPieces::sizelock)!=0); }
992  virtual bool isThisPointer(void) const { return ((flags&ParameterPieces::isthis)!=0); }
993  virtual bool isIndirectStorage(void) const { return ((flags&ParameterPieces::indirectstorage)!=0); }
994  virtual bool isHiddenReturn(void) const { return ((flags&ParameterPieces::hiddenretparm)!=0); }
995  virtual bool isNameUndefined(void) const { return (name.size()==0); }
996  virtual void setTypeLock(bool val);
997  virtual void setNameLock(bool val);
998  virtual void setThisPointer(bool val);
999  virtual void overrideSizeLockType(Datatype *ct);
1000  virtual void resetSizeLockType(TypeFactory *factory);
1001  virtual ProtoParameter *clone(void) const;
1002  virtual Symbol *getSymbol(void) const { throw LowlevelError("Parameter is not a real symbol"); }
1003 };
1004 
1010 class ProtoStore {
1011 public:
1012  virtual ~ProtoStore(void) {}
1013 
1023  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces)=0;
1024 
1030  virtual void clearInput(int4 i)=0;
1031 
1032  virtual void clearAllInputs(void)=0;
1033  virtual int4 getNumInputs(void) const=0;
1034  virtual ProtoParameter *getInput(int4 i)=0;
1035 
1042  virtual ProtoParameter *setOutput(const ParameterPieces &piece)=0;
1043 
1044  virtual void clearOutput(void)=0;
1045  virtual ProtoParameter *getOutput(void)=0;
1046  virtual ProtoStore *clone(void) const=0;
1047 
1053  virtual void saveXml(ostream &s) const=0;
1054 
1059  virtual void restoreXml(const Element *el,ProtoModel *model)=0;
1060 };
1061 
1068  friend class ProtoStoreSymbol;
1069  Symbol *sym;
1070 public:
1071  ParameterSymbol(void) { sym = (Symbol *)0; }
1072  virtual const string &getName(void) const;
1073  virtual Datatype *getType(void) const;
1074  virtual Address getAddress(void) const;
1075  virtual int4 getSize(void) const;
1076  virtual bool isTypeLocked(void) const;
1077  virtual bool isNameLocked(void) const;
1078  virtual bool isSizeTypeLocked(void) const;
1079  virtual bool isThisPointer(void) const;
1080  virtual bool isIndirectStorage(void) const;
1081  virtual bool isHiddenReturn(void) const;
1082  virtual bool isNameUndefined(void) const;
1083  virtual void setTypeLock(bool val);
1084  virtual void setNameLock(bool val);
1085  virtual void setThisPointer(bool val);
1086  virtual void overrideSizeLockType(Datatype *ct);
1087  virtual void resetSizeLockType(TypeFactory *factory);
1088  virtual ProtoParameter *clone(void) const;
1089  virtual Symbol *getSymbol(void) const;
1090 };
1091 
1098  Scope *scope;
1099  Address restricted_usepoint;
1100  vector<ProtoParameter *> inparam;
1101  ProtoParameter *outparam;
1102  ParameterSymbol *getSymbolBacked(int4 i);
1103 public:
1104  ProtoStoreSymbol(Scope *sc,const Address &usepoint);
1105  virtual ~ProtoStoreSymbol(void);
1106  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces);
1107  virtual void clearInput(int4 i);
1108  virtual void clearAllInputs(void);
1109  virtual int4 getNumInputs(void) const;
1110  virtual ProtoParameter *getInput(int4 i);
1111  virtual ProtoParameter *setOutput(const ParameterPieces &piece);
1112  virtual void clearOutput(void);
1113  virtual ProtoParameter *getOutput(void);
1114  virtual ProtoStore *clone(void) const;
1115  virtual void saveXml(ostream &s) const;
1116  virtual void restoreXml(const Element *el,ProtoModel *model);
1117 };
1118 
1124  Datatype *voidtype;
1125  vector<ProtoParameter *> inparam;
1126  ProtoParameter *outparam;
1127 public:
1129  virtual ~ProtoStoreInternal(void);
1130  virtual ProtoParameter *setInput(int4 i,const string &nm,const ParameterPieces &pieces);
1131  virtual void clearInput(int4 i);
1132  virtual void clearAllInputs(void);
1133  virtual int4 getNumInputs(void) const;
1134  virtual ProtoParameter *getInput(int4 i);
1135  virtual ProtoParameter *setOutput(const ParameterPieces &piece);
1136  virtual void clearOutput(void);
1137  virtual ProtoParameter *getOutput(void);
1138  virtual ProtoStore *clone(void) const;
1139  virtual void saveXml(ostream &s) const;
1140  virtual void restoreXml(const Element *el,ProtoModel *model);
1141 };
1142 
1146  string name;
1148  vector<Datatype *> intypes;
1149  vector<string> innames;
1150  bool dotdotdot;
1151 };
1152 
1164 class FuncProto {
1165  enum {
1166  dotdotdot = 1,
1167  voidinputlock = 2,
1168  modellock = 4,
1169  is_inline = 8,
1170  no_return = 16,
1171  paramshift_applied = 32,
1172  error_inputparam = 64,
1173  error_outputparam = 128,
1174  custom_storage = 256,
1175  unknown_model = 512,
1176  is_constructor = 0x400,
1177  is_destructor = 0x800,
1178  has_thisptr= 0x1000,
1179  is_override = 0x2000
1180  };
1181  ProtoModel *model;
1182  ProtoStore *store;
1183  int4 extrapop;
1184  uint4 flags;
1185  vector<EffectRecord> effectlist;
1186  vector<VarnodeData> likelytrash;
1187  int4 injectid;
1188  int4 returnBytesConsumed;
1189  void updateThisPointer(void);
1190 protected:
1191  void paramShift(int4 paramshift);
1192  bool isParamshiftApplied(void) const { return ((flags&paramshift_applied)!=0); }
1193  void setParamshiftApplied(bool val) { flags = val ? (flags|paramshift_applied) : (flags & ~((uint4)paramshift_applied)); }
1195 public:
1196  FuncProto(void);
1197  ~FuncProto(void);
1198  Architecture *getArch(void) const { return model->getArch(); }
1199  void copy(const FuncProto &op2);
1200  void copyFlowEffects(const FuncProto &op2);
1201  void getPieces(PrototypePieces &pieces) const;
1202  void setPieces(const PrototypePieces &pieces);
1203  void setScope(Scope *s,const Address &startpoint);
1204  void setInternal(ProtoModel *m,Datatype *vt);
1205  void setModel(ProtoModel *m);
1206  bool hasModel(void) const { return (model != (ProtoModel *)0); }
1207 
1208  bool hasMatchingModel(const FuncProto *op2) const { return (model == op2->model); }
1209  bool hasMatchingModel(const ProtoModel *op2) const { return (model == op2); }
1210  const string &getModelName(void) const { return model->getName(); }
1211  int4 getModelExtraPop(void) const { return model->getExtraPop(); }
1212 
1213  bool isInputLocked(void) const;
1214  bool isOutputLocked(void) const { return store->getOutput()->isTypeLocked(); }
1215  bool isModelLocked(void) const { return ((flags&modellock)!=0); }
1216  bool isUnknownModel(void) const { return ((flags&unknown_model)!=0); }
1217  bool hasCustomStorage(void) const { return ((flags&custom_storage)!=0); }
1218  void setInputLock(bool val);
1219  void setOutputLock(bool val);
1220 
1226  void setModelLock(bool val) { flags = val ? (flags|modellock) : (flags & ~((uint4)modellock)); }
1227 
1228  bool isInline(void) const { return ((flags & is_inline)!=0); }
1229 
1234  void setInline(bool val) { flags = val ? (flags|is_inline) : (flags & ~((uint4)is_inline)); }
1235 
1240  int4 getInjectId(void) const { return injectid; }
1241 
1246  int4 getReturnBytesConsumed(void) const { return returnBytesConsumed; }
1247 
1248  bool setReturnBytesConsumed(int4 val);
1249 
1251  bool isNoReturn(void) const { return ((flags & no_return)!=0); }
1252 
1256  void setNoReturn(bool val) { flags = val ? (flags|no_return) : (flags & ~((uint4)no_return)); }
1257 
1259  bool hasThisPointer(void) const { return ((flags & has_thisptr)!=0); }
1260 
1262  bool isConstructor(void) const { return ((flags & is_constructor)!=0); }
1263 
1267  void setConstructor(bool val) { flags = val ? (flags|is_constructor) : (flags & ~((uint4)is_constructor)); }
1268 
1270  bool isDestructor(void) const { return ((flags & is_destructor)!=0); }
1271 
1275  void setDestructor(bool val) { flags = val ? (flags|is_destructor) : (flags & ~((uint4)is_destructor)); }
1276 
1278  bool hasInputErrors(void) const { return ((flags&error_inputparam)!=0); }
1279 
1281  bool hasOutputErrors(void) const { return ((flags&error_outputparam)!=0); }
1282 
1286  void setInputErrors(bool val) { flags = val ? (flags|error_inputparam) : (flags & ~((uint4)error_inputparam)); }
1287 
1291  void setOutputErrors(bool val) { flags = val ? (flags|error_outputparam) : (flags & ~((uint4)error_outputparam)); }
1292 
1293  int4 getExtraPop(void) const { return extrapop; }
1294  void setExtraPop(int4 ep) { extrapop = ep; }
1295  int4 getInjectUponEntry(void) const { return model->getInjectUponEntry(); }
1296  int4 getInjectUponReturn(void) const { return model->getInjectUponReturn(); }
1297  void resolveExtraPop(void);
1298 
1299  void clearUnlockedInput(void);
1300  void clearUnlockedOutput(void);
1301  void clearInput(void);
1302  void cancelInjectId(void);
1303 
1304  void resolveModel(ParamActive *active);
1305 
1310  void deriveInputMap(ParamActive *active) const {
1311  model->deriveInputMap(active); }
1312 
1317  void deriveOutputMap(ParamActive *active) const {
1318  model->deriveOutputMap(active); }
1319 
1329  bool checkInputJoin(const Address &hiaddr,int4 hisz,const Address &loaddr,int4 losz) const {
1330  return model->checkInputJoin(hiaddr,hisz,loaddr,losz); }
1331 
1340  bool checkInputSplit(const Address &loc,int4 size,int4 splitpoint) const {
1341  return model->checkInputSplit(loc,size,splitpoint); }
1342 
1343  void updateInputTypes(Funcdata &data,const vector<Varnode *> &triallist,ParamActive *activeinput);
1344  void updateInputNoTypes(Funcdata &data,const vector<Varnode *> &triallist,ParamActive *activeinput);
1345  void updateOutputTypes(const vector<Varnode *> &triallist);
1346  void updateOutputNoTypes(const vector<Varnode *> &triallist,TypeFactory *factory);
1347  void updateAllTypes(const vector<string> &namelist,const vector<Datatype *> &typelist,bool dtdtdt);
1348  ProtoParameter *getParam(int4 i) const { return store->getInput(i); }
1349  void removeParam(int4 i) { store->clearInput(i); }
1350  int4 numParams(void) const { return store->getNumInputs(); }
1351  ProtoParameter *getOutput(void) const { return store->getOutput(); }
1352  Datatype *getOutputType(void) const { return store->getOutput()->getType(); }
1353  const RangeList &getLocalRange(void) const { return model->getLocalRange(); }
1354  const RangeList &getParamRange(void) const { return model->getParamRange(); }
1355  bool isStackGrowsNegative(void) const { return model->isStackGrowsNegative(); }
1356  bool isDotdotdot(void) const { return ((flags&dotdotdot)!=0); }
1357  void setDotdotdot(bool val) { flags = val ? (flags|dotdotdot) : (flags & ~((uint4)dotdotdot)); }
1358  bool isOverride(void) const { return ((flags&is_override)!=0); }
1359  void setOverride(bool val) { flags = val ? (flags|is_override) : (flags & ~((uint4)is_override)); }
1360  uint4 hasEffect(const Address &addr,int4 size) const;
1361  vector<EffectRecord>::const_iterator effectBegin(void) const;
1362  vector<EffectRecord>::const_iterator effectEnd(void) const;
1363  int4 numLikelyTrash(void) const;
1364  const VarnodeData &getLikelyTrash(int4 i) const;
1365  int4 characterizeAsInputParam(const Address &addr,int4 size) const;
1366  bool possibleInputParam(const Address &addr,int4 size) const;
1367  bool possibleOutputParam(const Address &addr,int4 size) const;
1368 
1375  int4 getMaxInputDelay(void) const { return model->getMaxInputDelay(); }
1376 
1383  int4 getMaxOutputDelay(void) const { return model->getMaxOutputDelay(); }
1384 
1385  bool unjustifiedInputParam(const Address &addr,int4 size,VarnodeData &res) const;
1386 
1397  OpCode assumedInputExtension(const Address &addr,int4 size,VarnodeData &res) const {
1398  return model->assumedInputExtension(addr,size,res); }
1399 
1410  OpCode assumedOutputExtension(const Address &addr,int4 size,VarnodeData &res) const {
1411  return model->assumedOutputExtension(addr,size,res); }
1412 
1414  bool getBiggestContainedInputParam(const Address &loc,int4 size,VarnodeData &res) const;
1415 
1416  bool isCompatible(const FuncProto &op2) const;
1417  AddrSpace *getSpacebase(void) const { return model->getSpacebase(); }
1418  void printRaw(const string &funcname,ostream &s) const;
1419 
1424  uint4 getComparableFlags(void) const { return (flags & (dotdotdot | is_constructor | is_destructor | has_thisptr )); }
1425 
1426  void saveXml(ostream &s) const;
1427  void restoreXml(const Element *el,Architecture *glb);
1428 };
1429 
1430 class Funcdata;
1431 
1449 class FuncCallSpecs : public FuncProto {
1450  PcodeOp *op;
1451  string name;
1452  Address entryaddress;
1453  Funcdata *fd;
1454  int4 effective_extrapop;
1455  uintb stackoffset;
1456  int4 stackPlaceholderSlot;
1457  int4 paramshift;
1458  int4 matchCallCount;
1459  ParamActive activeinput;
1460  ParamActive activeoutput;
1461  mutable vector<int4> inputConsume;
1462  bool isinputactive;
1463  bool isoutputactive;
1464  bool isbadjumptable;
1465  Varnode *getSpacebaseRelative(void) const;
1466  Varnode *buildParam(Funcdata &data,Varnode *vn,ProtoParameter *param,Varnode *stackref);
1467  int4 transferLockedInputParam(ProtoParameter *param);
1468  PcodeOp *transferLockedOutputParam(ProtoParameter *param);
1469  bool transferLockedInput(vector<Varnode *> &newinput);
1470  bool transferLockedOutput(Varnode *&newoutput);
1471  void commitNewInputs(Funcdata &data,vector<Varnode *> &newinput);
1472  void commitNewOutputs(Funcdata &data,Varnode *newout);
1473  void collectOutputTrialVarnodes(vector<Varnode *> &trialvn);
1474 public:
1475  enum {
1476  offset_unknown = 0xBADBEEF
1477  };
1478  FuncCallSpecs(PcodeOp *call_op);
1479  void setAddress(const Address &addr) { entryaddress = addr; }
1480  PcodeOp *getOp(void) const { return op; }
1481  Funcdata *getFuncdata(void) const { return fd; }
1482  void setFuncdata(Funcdata *f);
1483  FuncCallSpecs *clone(PcodeOp *newop) const;
1484  const string &getName(void) const { return name; }
1485  const Address &getEntryAddress(void) const { return entryaddress; }
1486  void setEffectiveExtraPop(int4 epop) { effective_extrapop = epop; }
1487  int4 getEffectiveExtraPop(void) const { return effective_extrapop; }
1488  uintb getSpacebaseOffset(void) const { return stackoffset; }
1489  void setParamshift(int4 val) { paramshift = val; }
1490  int4 getParamshift(void) const { return paramshift; }
1491  int4 getMatchCallCount(void) const { return matchCallCount; }
1492  int4 getStackPlaceholderSlot(void) const { return stackPlaceholderSlot; }
1493  void setStackPlaceholderSlot(int4 slot) { stackPlaceholderSlot = slot;
1494  if (isinputactive) activeinput.setPlaceholderSlot(); }
1495  void clearStackPlaceholderSlot(void) {
1496  stackPlaceholderSlot = -1; if (isinputactive) activeinput.freePlaceholderSlot(); }
1497 
1498  void initActiveInput(void);
1499  void clearActiveInput(void) { isinputactive = false; }
1500  void initActiveOutput(void) { isoutputactive = true; }
1501  void clearActiveOutput(void) { isoutputactive = false; }
1502  bool isInputActive(void) const { return isinputactive; }
1503  bool isOutputActive(void) const { return isoutputactive; }
1504  void setBadJumpTable(bool val) { isbadjumptable = val; }
1505  bool isBadJumpTable(void) const { return isbadjumptable; }
1506  ParamActive *getActiveInput(void) { return &activeinput; }
1507  ParamActive *getActiveOutput(void) { return &activeoutput; }
1508 
1509  bool checkInputJoin(int4 slot1,bool ishislot,Varnode *vn1,Varnode *vn2) const;
1510  void doInputJoin(int4 slot1,bool ishislot);
1511  bool lateRestriction(const FuncProto &restrictedProto,vector<Varnode *> &newinput,Varnode *&newoutput);
1512  void deindirect(Funcdata &data,Funcdata *newfd);
1513  void forceSet(Funcdata &data,const FuncProto &fp);
1514  void insertPcode(Funcdata &data);
1515  void resolveSpacebaseRelative(Funcdata &data,Varnode *phvn);
1516  void abortSpacebaseRelative(Funcdata &data);
1517  void finalInputCheck(void);
1518  void checkInputTrialUse(Funcdata &data,AliasChecker &aliascheck);
1519  void checkOutputTrialUse(Funcdata &data,vector<Varnode *> &trialvn);
1520  void buildInputFromTrials(Funcdata &data);
1521  void buildOutputFromTrials(Funcdata &data,vector<Varnode *> &trialvn);
1522  int4 getInputBytesConsumed(int4 slot) const;
1523  bool setInputBytesConsumed(int4 slot,int4 val) const;
1524  void paramshiftModifyStart(void);
1525  bool paramshiftModifyStop(Funcdata &data);
1526  uint4 hasEffectTranslate(const Address &addr,int4 size) const;
1527  static Varnode *findPreexistingWhole(Varnode *vn1,Varnode *vn2);
1528 
1533  static FuncCallSpecs *getFspecFromConst(const Address &addr) { return (FuncCallSpecs *)(uintp)addr.getOffset(); }
1534 
1540  static bool compareByEntryAddress(const FuncCallSpecs *a,const FuncCallSpecs *b) { return a->entryaddress < b->entryaddress; }
1541  static void countMatchingCalls(const vector<FuncCallSpecs *> &qlst);
1542 };
1543 
1549 inline const ParamTrial &ParamActive::getTrialForInputVarnode(int4 slot) const
1550 
1551 {
1552  slot -= ((stackplaceholder<0)||(slot<stackplaceholder)) ? 1 : 2;
1553  return trial[slot];
1554 }
1555 
1559 inline bool EffectRecord::operator<(const EffectRecord &op2) const
1560 
1561 {
1562  if (address < op2.address) return true;
1563  if (address != op2.address) return false;
1564  return (type < op2.type);
1565 }
1566 
1567 inline bool EffectRecord::operator==(const EffectRecord &op2) const
1568 
1569 {
1570  if (address != op2.address) return false;
1571  return (type == op2.type);
1572 }
1573 
1574 inline bool EffectRecord::operator!=(const EffectRecord &op2) const
1575 
1576 {
1577  if (address != op2.address) return true;
1578  return (type != op2.type);
1579 }
1580 
1581 #endif
FuncCallSpecs::lateRestriction
bool lateRestriction(const FuncProto &restrictedProto, vector< Varnode * > &newinput, Varnode *&newoutput)
Update this prototype to match a given (more specialized) prototype.
Definition: fspec.cc:4535
PrototypePieces::outtype
Datatype * outtype
Return data-type.
Definition: fspec.hh:1147
ParameterPieces::hiddenretparm
@ hiddenretparm
Parameter is hidden pointer to return value, mirrors Varnode::hiddenretparm.
Definition: fspec.hh:296
ParameterPieces::typelock
@ typelock
Parameter's data-type is locked, mirrors Varnode::typelock.
Definition: fspec.hh:299
ProtoStore::saveXml
virtual void saveXml(ostream &s) const =0
Save any parameters that are not backed by symbols to an XML stream.
ProtoParameter::getName
virtual const string & getName(void) const =0
Get the name of the parameter ("" for return value)
ParameterBasic::resetSizeLockType
virtual void resetSizeLockType(TypeFactory *factory)
Clear this parameter's data-type preserving any size-lock.
Definition: fspec.cc:2324
ParamList::assumedExtension
virtual OpCode assumedExtension(const Address &addr, int4 size, VarnodeData &res) const =0
Get the type of extension and containing parameter for the given storage.
ParamUnassignedError
Exception thrown when a prototype can't be modeled properly.
Definition: fspec.hh:28
ProtoStore
A collection parameter descriptions making up a function prototype.
Definition: fspec.hh:1010
ProtoModel::getMaxOutputDelay
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:839
ParamListStandard::checkJoin
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
ProtoModel::lookupEffect
static uint4 lookupEffect(const vector< EffectRecord > &efflist, const Address &addr, int4 size)
Look up an effect from the given EffectRecord list.
Definition: fspec.cc:1874
ParameterBasic::setTypeLock
virtual void setTypeLock(bool val)
Toggle the lock on the data-type.
Definition: fspec.cc:2282
ProtoParameter::overrideSizeLockType
virtual void overrideSizeLockType(Datatype *ct)=0
Change (override) the data-type of a size-locked parameter.
ProtoModel::possibleInputParam
bool possibleInputParam(const Address &loc, int4 size) const
Does the given storage location make sense as an input parameter.
Definition: fspec.hh:736
ParamEntry::smallsize_inttype
@ smallsize_inttype
Assume values that are below the max size are sign OR zero extended based on integer type.
Definition: fspec.hh:56
ProtoStore::clone
virtual ProtoStore * clone(void) const =0
Clone the entire collection of parameter descriptions.
PrototypePieces::model
ProtoModel * model
(Optional) model on which prototype is based
Definition: fspec.hh:1145
ProtoStore::setInput
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)=0
Establish name, data-type, storage of a specific input parameter.
ParamEntry::smallsize_floatext
@ smallsize_floatext
Assume values smaller than max size are floating-point extended to full size.
Definition: fspec.hh:57
ParamTrial::ParamTrial
ParamTrial(const Address &ad, int4 sz, int4 sl)
Construct from components.
Definition: fspec.hh:178
ParamTrial::active
@ active
Trial looks active (hint that it is used)
Definition: fspec.hh:162
ParamTrial
A register or memory register that may be used to pass a parameter or return value.
Definition: fspec.hh:156
FuncCallSpecs::setFuncdata
void setFuncdata(Funcdata *f)
Set the Funcdata object associated with the called function.
Definition: fspec.cc:4108
FuncProto::clearInput
void clearInput(void)
Clear all input parameters regardless of lock.
Definition: fspec.cc:3240
ProtoParameter::isNameLocked
virtual bool isNameLocked(void) const =0
Is the parameter name locked.
ProtoStore::clearInput
virtual void clearInput(int4 i)=0
Clear the input parameter at the specified slot.
AddrSpace
A region where processor data is stored.
Definition: space.hh:73
ProtoModel::assignParameterStorage
void assignParameterStorage(const vector< Datatype * > &typelist, vector< ParameterPieces > &res, bool ignoreOutputError)
Calculate input and output storage locations given a function prototype.
Definition: fspec.cc:1845
ParamListStandard::nonfloatgroup
int4 nonfloatgroup
Group of first entry which is not marked float.
Definition: fspec.hh:504
VarnodeData::space
AddrSpace * space
The address space.
Definition: pcoderaw.hh:34
ParamEntry::getAddrBySlot
Address getAddrBySlot(int4 &slot, int4 sz) const
Calculate the storage address assigned when allocating a parameter of a given size.
Definition: fspec.cc:257
EffectRecord::unknown_effect
@ unknown_effect
An unknown effect (indicates the absence of an EffectRecord)
Definition: fspec.hh:318
ProtoStore::clearAllInputs
virtual void clearAllInputs(void)=0
Clear all input parameters (and any backing symbols)
ParamListStandardOut
A standard model for passing back return values from a function.
Definition: fspec.hh:548
ParameterBasic::setThisPointer
virtual void setThisPointer(bool val)
Toggle whether this is the "this" pointer for a class method.
Definition: fspec.cc:2303
FuncProto::saveXml
void saveXml(ostream &s) const
Save this to an XML stream as a <prototype> tag.
Definition: fspec.cc:3738
ParamList::getRangeList
virtual void getRangeList(AddrSpace *spc, RangeList &res) const =0
For a given address space, collect all the parameter locations within that space.
ProtoModel::deriveInputMap
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely input prototype.
Definition: fspec.hh:662
ProtoStoreInternal::getNumInputs
virtual int4 getNumInputs(void) const
Get the number of input parameters for this prototype.
Definition: fspec.cc:2706
FuncProto::deriveOutputMap
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely return value for this prototype.
Definition: fspec.hh:1317
ProtoParameter::setTypeLock
virtual void setTypeLock(bool val)=0
Toggle the lock on the data-type.
LowlevelError
The lowest level error generated by the decompiler.
Definition: error.hh:44
ParamListStandard::numgroup
int4 numgroup
Number of groups in this parameter convention.
Definition: fspec.hh:500
ParamActive::getTrialForInputVarnode
const ParamTrial & getTrialForInputVarnode(int4 slot) const
Get trial corresponding to the given input Varnode.
Definition: fspec.hh:1549
ParamEntry::ParamEntry
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
ProtoStoreInternal::ProtoStoreInternal
ProtoStoreInternal(Datatype *vt)
Constructor.
Definition: fspec.cc:2646
ParameterBasic::overrideSizeLockType
virtual void overrideSizeLockType(Datatype *ct)
Change (override) the data-type of a size-locked parameter.
Definition: fspec.cc:2312
FuncProto::setInputErrors
void setInputErrors(bool val)
Toggle the input error setting for this prototype.
Definition: fspec.hh:1286
ProtoStoreSymbol::getInput
virtual ProtoParameter * getInput(int4 i)
Get the i-th input parameter (or NULL if it doesn't exist)
Definition: fspec.cc:2585
FuncCallSpecs::paramshiftModifyStop
bool paramshiftModifyStop(Funcdata &data)
Throw out any paramshift parameters.
Definition: fspec.cc:5016
ParamListMerged::getType
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:591
ParamListStandard::forceExclusionGroup
void forceExclusionGroup(ParamActive *active) const
Enforce exclusion rules for the given set of parameter trials.
Definition: fspec.cc:711
ProtoParameter::getSize
virtual int4 getSize(void) const =0
Get the number of bytes occupied by this parameter.
ProtoModelMerged
A prototype model made by merging together other models.
Definition: fspec.hh:889
ProtoStoreSymbol::saveXml
virtual void saveXml(ostream &s) const
Save any parameters that are not backed by symbols to an XML stream.
Definition: fspec.cc:2633
ParamEntry::contains
bool contains(const ParamEntry &op2) const
Does this contain the indicated entry.
Definition: fspec.cc:63
ProtoModelMerged::selectModel
ProtoModel * selectModel(ParamActive *active) const
Select the best model given a set of trials.
Definition: fspec.cc:2237
ParamListStandard::forceInactiveChain
void forceInactiveChain(ParamActive *active, int4 maxchain, int4 start, int4 stop) const
Enforce rules about chains of inactive slots.
Definition: fspec.cc:778
ParameterSymbol::getType
virtual Datatype * getType(void) const
Get the data-type associate with this.
Definition: fspec.cc:2345
ParamTrial::checked
@ checked
Trial has been checked.
Definition: fspec.hh:159
ParamListRegister
An unstructured model for passing input parameters to a function.
Definition: fspec.hh:568
ParamEntry::justifiedContain
int4 justifiedContain(const Address &addr, int4 sz) const
Calculate endian aware containment.
Definition: fspec.cc:94
ParamListMerged::assignMap
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:592
ProtoStoreInternal
A collection of parameter descriptions without backing symbols.
Definition: fspec.hh:1123
ParamList::checkJoin
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.
ParamList::unjustifiedContainer
virtual bool unjustifiedContainer(const Address &loc, int4 size, VarnodeData &res) const =0
Check if the given storage location looks like an unjustified parameter.
FuncCallSpecs::countMatchingCalls
static void countMatchingCalls(const vector< FuncCallSpecs * > &qlst)
Calculate the number of times an individual sub-function is called.
Definition: fspec.cc:5055
ParamListStandard::maxdelay
int4 maxdelay
Maximum heritage delay across all parameters.
Definition: fspec.hh:501
ProtoModel::deriveOutputMap
void deriveOutputMap(ParamActive *active) const
Given a list of output trials, derive the most likely output prototype.
Definition: fspec.hh:669
ParameterSymbol::getSymbol
virtual Symbol * getSymbol(void) const
Retrieve the formal Symbol associated with this parameter.
Definition: fspec.cc:2453
ProtoParameter::setThisPointer
virtual void setThisPointer(bool val)=0
Toggle whether this is the "this" pointer for a class method.
ParameterBasic::clone
virtual ProtoParameter * clone(void) const
Clone the parameter.
Definition: fspec.cc:2332
FuncCallSpecs::getFspecFromConst
static FuncCallSpecs * getFspecFromConst(const Address &addr)
Convert FspecSpace addresses to the underlying FuncCallSpecs object.
Definition: fspec.hh:1533
JoinRecord
A record describing how logical values are split.
Definition: translate.hh:195
FuncProto::setOutputLock
void setOutputLock(bool val)
Toggle the data-type lock on the return value.
Definition: fspec.cc:3169
ParamListStandard::getMaxDelay
virtual int4 getMaxDelay(void) const
Return the maximum heritage delay across all possible parameters.
Definition: fspec.hh:536
FuncProto::deriveInputMap
void deriveInputMap(ParamActive *active) const
Given a list of input trials, derive the most likely inputs for this prototype.
Definition: fspec.hh:1310
ParamActive::ParamActive
ParamActive(bool recoversub)
Constructor an empty container.
Definition: fspec.cc:1382
ParameterBasic::isHiddenReturn
virtual bool isHiddenReturn(void) const
Is this a pointer to storage for a return value.
Definition: fspec.hh:994
ProtoStore::getInput
virtual ProtoParameter * getInput(int4 i)=0
Get the i-th input parameter (or NULL if it doesn't exist)
ParamEntry::getContainer
bool getContainer(const Address &addr, int4 sz, VarnodeData &res) const
Calculate the containing memory range.
Definition: fspec.cc:141
ProtoStore::getNumInputs
virtual int4 getNumInputs(void) const =0
Get the number of input parameters for this prototype.
ParamEntry::smallsize_zext
@ smallsize_zext
Assume values that are below the max size are zero extended into this container.
Definition: fspec.hh:53
ProtoModelMerged::restoreXml
virtual void restoreXml(const Element *el)
Restore this model from an XML stream.
Definition: fspec.cc:2264
ParamListStandard::spacebase
AddrSpace * spacebase
Address space containing relative offset parameters.
Definition: fspec.hh:507
FuncCallSpecs::doInputJoin
void doInputJoin(int4 slot1, bool ishislot)
Join two parameter trials.
Definition: fspec.cc:4503
FuncProto::hasOutputErrors
bool hasOutputErrors(void) const
Has this prototype been marked as having an incorrect return value description.
Definition: fspec.hh:1281
EffectRecord::saveXml
void saveXml(ostream &s) const
Save the record to an XML stream.
Definition: fspec.cc:1659
rangemap
An interval map container.
Definition: rangemap.hh:64
FuncCallSpecs::initActiveInput
void initActiveInput(void)
Turn on analysis recovering input parameters.
Definition: fspec.cc:4458
FuncCallSpecs::offset_unknown
@ offset_unknown
"Magic" stack offset indicating the offset is unknown
Definition: fspec.hh:1476
ParamListStandard::calcDelay
void calcDelay(void)
Calculate the maximum heritage delay for any potential parameter in this list.
Definition: fspec.cc:823
ParamEntryRange::inittype
InitData inittype
Initialization data for a ScopeMapper.
Definition: fspec.hh:131
ParamActive::splitTrial
void splitTrial(int4 i, int4 sz)
Split the given trial in two.
Definition: fspec.cc:1477
ParameterBasic::isNameUndefined
virtual bool isNameUndefined(void) const
Is the name of this parameter undefined.
Definition: fspec.hh:995
FuncProto::isInputLocked
bool isInputLocked(void) const
Are input data-types locked.
Definition: fspec.cc:3133
ParameterBasic
A stand-alone parameter with no backing symbol.
Definition: fspec.hh:975
FuncProto::copy
void copy(const FuncProto &op2)
Copy another function prototype.
Definition: fspec.cc:3009
FuncCallSpecs::checkInputTrialUse
void checkInputTrialUse(Funcdata &data, AliasChecker &aliascheck)
Mark if input trials are being actively used.
Definition: fspec.cc:4705
ParamListStandard::clone
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1079
ParamListStandard::getSpacebase
virtual AddrSpace * getSpacebase(void) const
Get the address space associated with any stack based parameters in this list.
Definition: fspec.hh:534
ParamEntryResolver
rangemap< ParamEntryRange > ParamEntryResolver
A map from offset to ParamEntry.
Definition: fspec.hh:140
ParameterSymbol::setThisPointer
virtual void setThisPointer(bool val)
Toggle whether this is the "this" pointer for a class method.
Definition: fspec.cc:2428
ParameterBasic::getSymbol
virtual Symbol * getSymbol(void) const
Retrieve the formal Symbol associated with this parameter.
Definition: fspec.hh:1002
ParameterBasic::isIndirectStorage
virtual bool isIndirectStorage(void) const
Is this really a pointer to the true parameter.
Definition: fspec.hh:993
ParameterSymbol::clone
virtual ProtoParameter * clone(void) const
Clone the parameter.
Definition: fspec.cc:2447
ParamTrial::indcreate_formed
@ indcreate_formed
The trial is built out of an indirect creation.
Definition: fspec.hh:166
ParameterBasic::isTypeLocked
virtual bool isTypeLocked(void) const
Is the parameter data-type locked.
Definition: fspec.hh:989
EffectRecord::operator!=
bool operator!=(const EffectRecord &op2) const
Inequality operator.
Definition: fspec.hh:1574
ParamListStandardOut::assignMap
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:1086
FuncProto::getInjectId
int4 getInjectId(void) const
Get the injection id associated with this.
Definition: fspec.hh:1240
FspecSpace::saveXml
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: fspec.cc:1613
ProtoModel::ProtoModel
ProtoModel(Architecture *g)
Constructor for use with restoreXml()
Definition: fspec.cc:1756
FuncProto::characterizeAsInputParam
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:3502
Scope
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:402
ProtoParameter::setNameLock
virtual void setNameLock(bool val)=0
Toggle the lock on the name.
ProtoParameter::isNameUndefined
virtual bool isNameUndefined(void) const =0
Is the name of this parameter undefined.
FuncProto::assumedOutputExtension
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:1410
ParamListStandard::getRangeList
virtual void getRangeList(AddrSpace *spc, RangeList &res) const
For a given address space, collect all the parameter locations within that space.
Definition: fspec.cc:1011
ParamActive::freePlaceholderSlot
void freePlaceholderSlot(void)
Free the stack placeholder slot.
Definition: fspec.cc:1439
ProtoParameter
A function parameter viewed as a name, data-type, and storage address.
Definition: fspec.hh:912
Address::getOffset
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
ParameterSymbol::resetSizeLockType
virtual void resetSizeLockType(TypeFactory *factory)
Clear this parameter's data-type preserving any size-lock.
Definition: fspec.cc:2441
ProtoModel::restoreXml
virtual void restoreXml(const Element *el)
Restore this model from an XML stream.
Definition: fspec.cc:1913
ParamTrial::testShrink
bool testShrink(const Address &newaddr, int4 sz) const
Test if this trial can be made smaller.
Definition: fspec.cc:1336
ParameterBasic::getSize
virtual int4 getSize(void) const
Get the number of bytes occupied by this parameter.
Definition: fspec.hh:988
FuncProto::getMaxOutputDelay
int4 getMaxOutputDelay(void) const
Return the maximum heritage delay across all possible return values.
Definition: fspec.hh:1383
FuncProto::checkInputSplit
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:1340
FuncProto::isConstructor
bool isConstructor(void) const
Is this prototype for a class constructor method.
Definition: fspec.hh:1262
ParamList::assignMap
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.
ParamEntry::containedBy
bool containedBy(const Address &addr, int4 sz) const
Is this entry contained by the given range.
Definition: fspec.cc:77
ParamList::restoreXml
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)=0
Restore the model from an XML stream.
ParameterBasic::isThisPointer
virtual bool isThisPointer(void) const
Is this the "this" pointer for a class method.
Definition: fspec.hh:992
ProtoParameter::operator==
bool operator==(const ProtoParameter &op2) const
Compare storage location and data-type for equality.
Definition: fspec.hh:956
ParamListStandard::characterizeAsParam
virtual int4 characterizeAsParam(const Address &loc, int4 size) const
Characterize whether the given range overlaps parameter storage.
Definition: fspec.cc:469
ParameterBasic::getType
virtual Datatype * getType(void) const
Get the data-type associate with this.
Definition: fspec.hh:986
FuncCallSpecs
A class for analyzing parameters to a sub-function call.
Definition: fspec.hh:1449
FuncProto::getPieces
void getPieces(PrototypePieces &pieces) const
Get the raw pieces of the prototype.
Definition: fspec.cc:3084
ProtoModel::hasEffect
uint4 hasEffect(const Address &addr, int4 size) const
Determine side-effect of this on the given memory range.
Definition: fspec.cc:1905
FuncCallSpecs::compareByEntryAddress
static bool compareByEntryAddress(const FuncCallSpecs *a, const FuncCallSpecs *b)
Compare FuncCallSpecs by function entry address.
Definition: fspec.hh:1540
Element
An XML element. A node in the DOM tree.
Definition: xml.hh:150
FuncCallSpecs::deindirect
void deindirect(Funcdata &data, Funcdata *newfd)
Convert this call site from an indirect to a direct function call.
Definition: fspec.cc:4568
ProtoParameter::getSymbol
virtual Symbol * getSymbol(void) const =0
Retrieve the formal Symbol associated with this parameter.
ParamList::possibleParam
virtual bool possibleParam(const Address &loc, int4 size) const =0
Does the given storage location make sense as a parameter.
ProtoParameter::getType
virtual Datatype * getType(void) const =0
Get the data-type associate with this.
PcodeOp
Lowest level operation of the p-code language.
Definition: op.hh:58
ProtoStoreInternal::getInput
virtual ProtoParameter * getInput(int4 i)
Get the i-th input parameter (or NULL if it doesn't exist)
Definition: fspec.cc:2712
ProtoStoreSymbol::restoreXml
virtual void restoreXml(const Element *el, ProtoModel *model)
Restore any internal parameter descriptions from an XML stream.
Definition: fspec.cc:2639
ParameterPieces::type
Datatype * type
The datatype of the parameter.
Definition: fspec.hh:303
ParameterSymbol::setNameLock
virtual void setNameLock(bool val)
Toggle the lock on the name.
Definition: fspec.cc:2418
Architecture
Manager for all the major decompiler subsystems.
Definition: architecture.hh:119
FuncCallSpecs::finalInputCheck
void finalInputCheck(void)
Make final activity check on trials that might have been affected by conditional execution.
Definition: fspec.cc:4684
FuncProto::setConstructor
void setConstructor(bool val)
Toggle whether this prototype is a constructor method.
Definition: fspec.hh:1267
ParamList::getType
virtual uint4 getType(void) const =0
Get the type of parameter list.
ParamList::p_standard_out
@ p_standard_out
Standard output (return value) model.
Definition: fspec.hh:350
ParameterPieces::addr
Address addr
Storage address of the parameter.
Definition: fspec.hh:302
ParamTrial::operator<
bool operator<(const ParamTrial &b) const
Sort trials in formal parameter order.
Definition: fspec.cc:1358
ParameterSymbol
A parameter with a formal backing Symbol.
Definition: fspec.hh:1067
ParamListStandardOut::clone
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1221
FspecSpace::FspecSpace
FspecSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Constructor.
Definition: fspec.cc:1559
ProtoStoreInternal::setInput
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)
Establish name, data-type, storage of a specific input parameter.
Definition: fspec.cc:2669
FuncProto::checkInputJoin
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:1329
FuncProto::FuncProto
FuncProto(void)
Constructor.
Definition: fspec.cc:2998
FuncProto::effectEnd
vector< EffectRecord >::const_iterator effectEnd(void) const
Get iterator to end of EffectRecord list.
Definition: fspec.cc:3464
ProtoParameter::isHiddenReturn
virtual bool isHiddenReturn(void) const =0
Is this a pointer to storage for a return value.
FuncCallSpecs::paramshiftModifyStart
void paramshiftModifyStart(void)
Prepend any extra parameters if a paramshift is required.
Definition: fspec.cc:5006
ParamActive::shrink
void shrink(int4 i, const Address &addr, int4 sz)
Shrink the given trial to a new given range.
Definition: fspec.hh:269
FuncCallSpecs::setInputBytesConsumed
bool setInputBytesConsumed(int4 slot, int4 val) const
Set the estimated number of bytes within the given parameter that are consumed.
Definition: fspec.cc:4994
ParamListRegister::fillinMap
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:1228
EffectRecord
Description of the indirect effect a sub-function has on a memory range.
Definition: fspec.hh:312
ParamListStandard::possibleParamWithSlot
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
ParamActive::registerTrial
void registerTrial(const Address &addr, int4 sz)
Add a new trial to the container.
Definition: fspec.cc:1407
ProtoStoreSymbol
A collection of parameter descriptions backed by Symbol information.
Definition: fspec.hh:1097
ParamActive::clear
void clear(void)
Reset to an empty container.
Definition: fspec.cc:1394
ProtoModel
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:622
ProtoStore::clearOutput
virtual void clearOutput(void)=0
Clear the return value to TYPE_VOID.
FuncProto::resolveExtraPop
void resolveExtraPop(void)
Assuming this prototype is locked, calculate the extrapop.
Definition: fspec.cc:3195
PrototypePieces::innames
vector< string > innames
Identifiers for input types.
Definition: fspec.hh:1149
ParamListStandard::unjustifiedContainer
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:983
FuncProto::getComparableFlags
uint4 getComparableFlags(void) const
Get the comparable properties of this prototype.
Definition: fspec.hh:1424
ProtoParameter::isTypeLocked
virtual bool isTypeLocked(void) const =0
Is the parameter data-type locked.
ProtoModel::assumedOutputExtension
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:807
ParameterSymbol::getAddress
virtual Address getAddress(void) const
Get the storage address for this parameter.
Definition: fspec.cc:2351
ParamList::characterizeAsParam
virtual int4 characterizeAsParam(const Address &loc, int4 size) const =0
Characterize whether the given range overlaps parameter storage.
ParamActive::testShrink
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:262
ParamEntry::extraChecks
void extraChecks(list< ParamEntry > &entry)
Check if this entry represents a joined parameter and requires extra scrutiny.
Definition: fspec.cc:399
ParamEntryRange
Class for storing ParamEntry objects in an interval range (rangemap)
Definition: fspec.hh:104
VarnodeData::offset
uintb offset
The offset within the space.
Definition: pcoderaw.hh:35
VarnodeData::size
uint4 size
The number of bytes in the location.
Definition: pcoderaw.hh:36
ProtoStoreInternal::setOutput
virtual ProtoParameter * setOutput(const ParameterPieces &piece)
Establish the data-type and storage of the return value.
Definition: fspec.cc:2720
ParamTrial::condexe_effect
@ condexe_effect
This trial may be affected by conditional execution.
Definition: fspec.hh:167
PrototypePieces::name
string name
Identifier (function name) associated with prototype.
Definition: fspec.hh:1146
FuncProto::hasInputErrors
bool hasInputErrors(void) const
Has this prototype been marked as having an incorrect input parameter descriptions.
Definition: fspec.hh:1278
FuncProto::setInternal
void setInternal(ProtoModel *m, Datatype *vt)
Set internal backing storage for this.
Definition: fspec.cc:3118
FuncProto::cancelInjectId
void cancelInjectId(void)
Turn-off any in-lining for this function.
Definition: fspec.cc:3247
ScoreProtoModel::ScoreProtoModel
ScoreProtoModel(bool isinput, const ProtoModel *mod, int4 numparam)
Constructor.
Definition: fspec.cc:2068
FuncProto::unjustifiedInputParam
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:3597
Varnode
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
RangeList
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
ProtoModelMerged::foldIn
void foldIn(ProtoModel *model)
Fold-in an additional prototype model.
Definition: fspec.cc:2195
ParamListStandard::resolverMap
vector< ParamEntryResolver * > resolverMap
Map from space id to resolver.
Definition: fspec.hh:506
ParamEntry::getSlot
int4 getSlot(const Address &addr, int4 skip) const
Calculate the slot occupied by a specific address.
Definition: fspec.cc:231
ParamEntry::reverse_stack
@ reverse_stack
Slots (for non-exlusion entries) are allocated in reverse order.
Definition: fspec.hh:52
ParamListStandard::entry
list< ParamEntry > entry
The ordered list of parameter entries.
Definition: fspec.hh:505
FuncCallSpecs::hasEffectTranslate
uint4 hasEffectTranslate(const Address &addr, int4 size) const
Calculate type of side-effect for a given storage location (with caller translation)
Definition: fspec.cc:5039
ProtoModel::getMaxInputDelay
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:831
ParamActive
Container class for ParamTrial objects.
Definition: fspec.hh:222
FuncProto::possibleInputParam
bool possibleInputParam(const Address &addr, int4 size) const
Decide whether a given storage location could be an input parameter.
Definition: fspec.cc:3537
ProtoStoreSymbol::clearOutput
virtual void clearOutput(void)
Clear the return value to TYPE_VOID.
Definition: fspec.cc:2605
ProtoParameter::operator!=
bool operator!=(const ProtoParameter &op2) const
Compare storage location and data-type for inequality.
Definition: fspec.hh:966
ParamEntryRange::subsorttype
SubsortPosition subsorttype
The sub-sort object for a rangemap.
Definition: fspec.hh:130
ParamListMerged
A union of other input parameter passing models.
Definition: fspec.hh:585
ParameterSymbol::isHiddenReturn
virtual bool isHiddenReturn(void) const
Is this a pointer to storage for a return value.
Definition: fspec.cc:2393
EffectRecord::killedbycall
@ killedbycall
The memory is changed and is completely unrelated to its original value.
Definition: fspec.hh:316
FuncProto::updateAllTypes
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:3407
ScoreProtoModel
Class for calculating "goodness of fit" of parameter trials against a prototype model.
Definition: fspec.hh:852
ParamListStandard::ParamListStandard
ParamListStandard(const ParamListStandard &op2)
Copy constructor.
Definition: fspec.cc:421
ProtoParameter::resetSizeLockType
virtual void resetSizeLockType(TypeFactory *factory)=0
Clear this parameter's data-type preserving any size-lock.
FuncCallSpecs::insertPcode
void insertPcode(Funcdata &data)
Inject any upon-return p-code at this call site.
Definition: fspec.cc:4637
FuncProto::setScope
void setScope(Scope *s, const Address &startpoint)
Set a backing symbol Scope for this.
Definition: fspec.cc:3106
FuncProto::updateInputTypes
void updateInputTypes(Funcdata &data, const vector< Varnode * > &triallist, ParamActive *activeinput)
Update input parameters based on Varnode trials.
Definition: fspec.cc:3263
ProtoModel::unjustifiedInputParam
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:781
ParamList::p_register
@ p_register
Unordered parameter passing locations model.
Definition: fspec.hh:351
ParamList::checkSplit
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.
FuncProto::assumedInputExtension
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:1397
ProtoStoreInternal::clearInput
virtual void clearInput(int4 i)
Clear the input parameter at the specified slot.
Definition: fspec.cc:2680
FuncProto::paramShift
void paramShift(int4 paramshift)
Add parameters to the front of the input parameter list.
Definition: fspec.cc:2925
ParameterSymbol::isIndirectStorage
virtual bool isIndirectStorage(void) const
Is this really a pointer to the true parameter.
Definition: fspec.cc:2387
ParamTrial::splitLo
ParamTrial splitLo(int4 sz) const
Create a trial representing the last part of this.
Definition: fspec.cc:1321
FuncProto::resolveModel
void resolveModel(ParamActive *active)
If this has a merged model, pick the most likely model (from the merged set)
Definition: fspec.cc:2987
ParamEntry::smallsize_sext
@ smallsize_sext
Assume values that are below the max size are sign extended into this container.
Definition: fspec.hh:54
ParamListStandard::buildTrialMap
void buildTrialMap(ParamActive *active) const
Build map from parameter trials to model ParamEntrys.
Definition: fspec.cc:586
FuncProto::hasEffect
uint4 hasEffect(const Address &addr, int4 size) const
Calculate the effect this has an a given storage location.
Definition: fspec.cc:3447
ProtoModel::checkOutputJoin
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:695
FspecSpace::saveXmlAttributes
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: fspec.cc:1567
ProtoModel::characterizeAsInputParam
int4 characterizeAsInputParam(const Address &loc, int4 size) const
Characterize whether the given range overlaps parameter storage.
Definition: fspec.hh:726
ProtoModel::possibleInputParamWithSlot
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:757
ProtoModel::isCompatible
bool isCompatible(const ProtoModel *op2) const
Return true if other given model can be substituted for this.
Definition: fspec.cc:1820
ProtoParameter::isSizeTypeLocked
virtual bool isSizeTypeLocked(void) const =0
Is the size of the parameter locked.
EffectRecord::EffectRecord
EffectRecord(const Address &addr, int4 size)
Construct a memory range with an unknown effect.
Definition: fspec.cc:1628
PrototypePieces::dotdotdot
bool dotdotdot
True if prototype takes variable arguments.
Definition: fspec.hh:1150
FuncProto::numLikelyTrash
int4 numLikelyTrash(void) const
Get the number of likely-trash locations.
Definition: fspec.cc:3473
EffectRecord::operator==
bool operator==(const EffectRecord &op2) const
Equality operator.
Definition: fspec.hh:1567
FuncCallSpecs::buildInputFromTrials
void buildInputFromTrials(Funcdata &data)
Set the final input Varnodes to this CALL based on ParamActive analysis.
Definition: fspec.cc:4805
ParameterBasic::isSizeTypeLocked
virtual bool isSizeTypeLocked(void) const
Is the size of the parameter locked.
Definition: fspec.hh:991
FuncProto::printRaw
void printRaw(const string &funcname, ostream &s) const
Print this prototype as a single line of text.
Definition: fspec.cc:3709
ParamListStandard::findEntry
const ParamEntry * findEntry(const Address &loc, int4 size) const
Given storage location find matching ParamEntry.
Definition: fspec.cc:448
ProtoStoreSymbol::ProtoStoreSymbol
ProtoStoreSymbol(Scope *sc, const Address &usepoint)
Constructor.
Definition: fspec.cc:2461
ParamEntry::extracheck_high
@ extracheck_high
Perform extra checks during parameter recovery on most sig portion of the double.
Definition: fspec.hh:58
Address
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
PrototypePieces::intypes
vector< Datatype * > intypes
Input data-types.
Definition: fspec.hh:1148
ParamListStandard::pointermax
int4 pointermax
If non-zero, maximum size of a data-type before converting to a pointer.
Definition: fspec.hh:502
FuncProto::clearUnlockedInput
void clearUnlockedInput(void)
Clear input parameters that have not been locked.
Definition: fspec.cc:3218
ParamList::getMaxDelay
virtual int4 getMaxDelay(void) const =0
Return the maximum heritage delay across all possible parameters.
FuncProto::setParamshiftApplied
void setParamshiftApplied(bool val)
Toggle whether a parameter shift has been applied.
Definition: fspec.hh:1194
ParameterPieces
Basic elements of a parameter: address, data-type, properties.
Definition: fspec.hh:293
PrototypePieces
Raw components of a function prototype (obtained from parsing source code)
Definition: fspec.hh:1144
ProtoStoreSymbol::clearInput
virtual void clearInput(int4 i)
Clear the input parameter at the specified slot.
Definition: fspec.cc:2556
ParamActive::getNumUsed
int4 getNumUsed(void) const
Get number of trials marked as formal parameters.
Definition: fspec.cc:1541
ParamListStandard::restoreXml
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)
Restore the model from an XML stream.
Definition: fspec.cc:1023
ParamListStandard::possibleParam
virtual bool possibleParam(const Address &loc, int4 size) const
Does the given storage location make sense as a parameter.
Definition: fspec.cc:926
ParameterBasic::isNameLocked
virtual bool isNameLocked(void) const
Is the parameter name locked.
Definition: fspec.hh:990
FuncProto::updateOutputNoTypes
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:3383
Funcdata
Container for data structures associated with a single function.
Definition: funcdata.hh:45
Datatype
The base datatype class for the decompiler.
Definition: type.hh:62
ProtoStore::restoreXml
virtual void restoreXml(const Element *el, ProtoModel *model)=0
Restore any internal parameter descriptions from an XML stream.
ProtoModel::possibleOutputParamWithSlot
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:769
ParamListStandard::getType
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:522
ParamListStandardOut::getType
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:552
ParameterPieces::namelock
@ namelock
Parameter's name is locked, mirrors Varnode::namelock.
Definition: fspec.hh:298
TypeFactory
Container class for all Datatype objects in an Architecture.
Definition: type.hh:396
LowlevelError::LowlevelError
LowlevelError(const string &s)
Initialize the error with an explanatory string.
Definition: error.hh:47
FuncProto::~FuncProto
~FuncProto(void)
Destructor.
Definition: fspec.cc:3126
ParamTrial::used
@ used
Trial is definitely used (final verdict)
Definition: fspec.hh:160
ParameterBasic::setNameLock
virtual void setNameLock(bool val)
Toggle the lock on the name.
Definition: fspec.cc:2294
ParamEntry
A contiguous range of memory that can be used to pass parameters.
Definition: fspec.hh:48
ProtoModel::extrapop_unknown
@ extrapop_unknown
Reserved extrapop value meaning the function's extrapop is unknown.
Definition: fspec.hh:644
FspecSpace
A special space for encoding FuncCallSpecs.
Definition: fspec.hh:282
FuncProto::copyFlowEffects
void copyFlowEffects(const FuncProto &op2)
Copy properties that affect data-flow.
Definition: fspec.cc:3026
ParameterSymbol::isNameUndefined
virtual bool isNameUndefined(void) const
Is the name of this parameter undefined.
Definition: fspec.cc:2399
ParameterSymbol::getName
virtual const string & getName(void) const
Get the name of the parameter ("" for return value)
Definition: fspec.cc:2339
ParamListStandard::forceNoUse
void forceNoUse(ParamActive *active, int4 start, int4 stop) const
Mark every trial above the first "definitely not used" as inactive.
Definition: fspec.cc:739
FuncCallSpecs::buildOutputFromTrials
void buildOutputFromTrials(Funcdata &data, vector< Varnode * > &trialvn)
Set the final output Varnode of this CALL based on ParamActive analysis of trials.
Definition: fspec.cc:4884
FuncProto::setDestructor
void setDestructor(bool val)
Toggle whether this prototype is a destructor method.
Definition: fspec.hh:1275
ParamListMerged::clone
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1300
ParamList::fillinMap
virtual void fillinMap(ParamActive *active) const =0
Given an unordered list of storage locations, calculate a function prototype.
ParameterSymbol::isTypeLocked
virtual bool isTypeLocked(void) const
Is the parameter data-type locked.
Definition: fspec.cc:2363
Translate
The interface to a translation engine for a processor.
Definition: translate.hh:294
ParameterBasic::getAddress
virtual Address getAddress(void) const
Get the storage address for this parameter.
Definition: fspec.hh:987
ParamTrial::killedbycall
@ killedbycall
Data in this location is unlikely to flow thru a func and still be a param.
Definition: fspec.hh:164
ParamListStandard::populateResolver
void populateResolver(void)
Build the ParamEntry resolver maps.
Definition: fspec.cc:836
ParamListStandard
A standard model for parameters as an ordered list of storage resources.
Definition: fspec.hh:498
ScoreProtoModel::doScore
void doScore(void)
Compute the fitness score.
Definition: fspec.cc:2101
op.hh
The PcodeOp and PcodeOpBank classes.
ProtoStoreInternal::clearAllInputs
virtual void clearAllInputs(void)
Clear all input parameters (and any backing symbols)
Definition: fspec.cc:2696
ParamListMerged::foldIn
void foldIn(const ParamListStandard &op2)
Add another model to the union.
Definition: fspec.cc:1259
FuncProto::hasThisPointer
bool hasThisPointer(void) const
Is this a prototype for a class method, taking a this pointer.
Definition: fspec.hh:1259
ProtoStoreSymbol::getNumInputs
virtual int4 getNumInputs(void) const
Get the number of input parameters for this prototype.
Definition: fspec.cc:2579
ParamListRegister::clone
virtual ParamList * clone(void) const
Clone this parameter list model.
Definition: fspec.cc:1248
OpCode
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
FuncProto::possibleOutputParam
bool possibleOutputParam(const Address &addr, int4 size) const
Decide whether a given storage location could be a return value.
Definition: fspec.cc:3569
FuncProto::setInline
void setInline(bool val)
Toggle the in-line setting for functions with this prototype.
Definition: fspec.hh:1234
ProtoStoreInternal::clone
virtual ProtoStore * clone(void) const
Clone the entire collection of parameter descriptions.
Definition: fspec.cc:2743
ParameterSymbol::isNameLocked
virtual bool isNameLocked(void) const
Is the parameter name locked.
Definition: fspec.cc:2369
ParamListStandardOut::fillinMap
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:1119
FuncProto::getLikelyTrash
const VarnodeData & getLikelyTrash(int4 i) const
Get the i-th likely-trash location.
Definition: fspec.cc:3483
FuncCallSpecs::FuncCallSpecs
FuncCallSpecs(PcodeOp *call_op)
Construct based on CALL or CALLIND.
Definition: fspec.cc:4084
ParamListRegister::getType
virtual uint4 getType(void) const
Get the type of parameter list.
Definition: fspec.hh:572
ParamTrial::defnouse
@ defnouse
Trial is definitely not used.
Definition: fspec.hh:161
ParamEntry::assumedExtension
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
ProtoStoreSymbol::setOutput
virtual ProtoParameter * setOutput(const ParameterPieces &piece)
Establish the data-type and storage of the return value.
Definition: fspec.cc:2596
FuncProto::updateInputNoTypes
void updateInputNoTypes(Funcdata &data, const vector< Varnode * > &triallist, ParamActive *activeinput)
Update input parameters based on Varnode trials, but do not store the data-type.
Definition: fspec.cc:3308
ProtoStoreSymbol::clearAllInputs
virtual void clearAllInputs(void)
Clear all input parameters (and any backing symbols)
Definition: fspec.cc:2573
ProtoStore::setOutput
virtual ProtoParameter * setOutput(const ParameterPieces &piece)=0
Establish the data-type and storage of the return value.
ParamListStandard::fillinMap
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.cc:864
FuncProto::setModel
void setModel(ProtoModel *m)
Set the prototype model for this.
Definition: fspec.cc:3038
AddrSpace::isBigEndian
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:417
ProtoModel::getBiggestContainedInputParam
bool getBiggestContainedInputParam(const Address &loc, int4 size, VarnodeData &res) const
Pass-back the biggest input parameter contained within the given range.
Definition: fspec.hh:816
ParamEntryRange::linetype
uintb linetype
The linear element for a rangemap.
Definition: fspec.hh:129
ProtoModel::checkInputSplit
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:706
ProtoModel::assumedInputExtension
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:794
EffectRecord::unaffected
@ unaffected
The sub-function does not change the value at all.
Definition: fspec.hh:315
FuncProto::updateOutputTypes
void updateOutputTypes(const vector< Varnode * > &triallist)
Update the return value based on Varnode trials.
Definition: fspec.cc:3347
ProtoParameter::clone
virtual ProtoParameter * clone(void) const =0
Clone the parameter.
ParamListMerged::fillinMap
virtual void fillinMap(ParamActive *active) const
Given an unordered list of storage locations, calculate a function prototype.
Definition: fspec.hh:595
FuncProto::setInputLock
void setInputLock(bool val)
Toggle the data-type lock on input parameters.
Definition: fspec.cc:3148
ProtoStoreInternal::clearOutput
virtual void clearOutput(void)
Clear the return value to TYPE_VOID.
Definition: fspec.cc:2729
ParamActive::joinTrial
void joinTrial(int4 slot, const Address &addr, int4 sz)
Join adjacent parameter trials.
Definition: fspec.cc:1507
ParameterPieces::indirectstorage
@ indirectstorage
Parameter is indirect pointer to true parameter, mirrors Varnode::indirectstorage.
Definition: fspec.hh:297
FuncCallSpecs::abortSpacebaseRelative
void abortSpacebaseRelative(Funcdata &data)
Abort the attempt to recover the relative stack offset for this function.
Definition: fspec.cc:4074
ParamEntry::force_left_justify
@ force_left_justify
Big endian values are left justified within their slot.
Definition: fspec.hh:51
ParameterPieces::isthis
@ isthis
Parameter is "this" pointer.
Definition: fspec.hh:295
ParamListStandardOut::restoreXml
virtual void restoreXml(const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)
Restore the model from an XML stream.
Definition: fspec.cc:1211
ParamList::getBiggestContainedParam
virtual bool getBiggestContainedParam(const Address &loc, int4 size, VarnodeData &res) const =0
Pass-back the biggest parameter contained within the given range.
FuncCallSpecs::forceSet
void forceSet(Funcdata &data, const FuncProto &fp)
Force a more restrictive prototype on this call site.
Definition: fspec.cc:4608
ParameterPieces::sizelock
@ sizelock
Size of the parameter is locked (but not the data-type)
Definition: fspec.hh:300
FuncProto::effectBegin
vector< EffectRecord >::const_iterator effectBegin(void) const
Get iterator to front of EffectRecord list.
Definition: fspec.cc:3456
ParameterPieces::flags
uint4 flags
additional attributes of the parameter
Definition: fspec.hh:304
ParamList::getSpacebase
virtual AddrSpace * getSpacebase(void) const =0
Get the address space associated with any stack based parameters in this list.
ProtoStoreSymbol::clone
virtual ProtoStore * clone(void) const
Clone the entire collection of parameter descriptions.
Definition: fspec.cc:2620
ParameterSymbol::isSizeTypeLocked
virtual bool isSizeTypeLocked(void) const
Is the size of the parameter locked.
Definition: fspec.cc:2375
ParameterSymbol::getSize
virtual int4 getSize(void) const
Get the number of bytes occupied by this parameter.
Definition: fspec.cc:2357
ParamListStandard::thisbeforeret
bool thisbeforeret
Does a this parameter come before a hidden return parameter.
Definition: fspec.hh:503
FuncProto::setPieces
void setPieces(const PrototypePieces &pieces)
Set this prototype based on raw pieces.
Definition: fspec.cc:3062
ProtoStoreInternal::getOutput
virtual ProtoParameter * getOutput(void)
Get the return-value description.
Definition: fspec.cc:2737
FuncCallSpecs::clone
FuncCallSpecs * clone(PcodeOp *newop) const
Clone this given the mirrored p-code CALL.
Definition: fspec.cc:4123
ParameterSymbol::setTypeLock
virtual void setTypeLock(bool val)
Toggle the lock on the data-type.
Definition: fspec.cc:2405
ParamList::p_standard
@ p_standard
Standard input parameter model.
Definition: fspec.hh:349
VarnodeData
Data defining a specific memory location.
Definition: pcoderaw.hh:33
FuncProto::getReturnBytesConsumed
int4 getReturnBytesConsumed(void) const
Get an estimate of the number of bytes consumed by callers of this prototype.
Definition: fspec.hh:1246
ScoreProtoModel::addParameter
void addParameter(const Address &addr, int4 sz)
Register a trial to be scored.
Definition: fspec.cc:2080
ParamActive::whichTrial
int4 whichTrial(const Address &addr, int4 sz) const
Get the trial overlapping with the given memory range.
Definition: fspec.cc:1426
ProtoModel::~ProtoModel
virtual ~ProtoModel(void)
Destructor.
Definition: fspec.cc:1806
ProtoParameter::isIndirectStorage
virtual bool isIndirectStorage(void) const =0
Is this really a pointer to the true parameter.
ProtoModel::checkInputJoin
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:683
ParamListStandard::separateFloat
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
FuncProto::clearUnlockedOutput
void clearUnlockedOutput(void)
Clear the return value if it has not been locked.
Definition: fspec.cc:3225
EffectRecord::operator<
bool operator<(const EffectRecord &op2) const
Comparator for EffectRecords.
Definition: fspec.hh:1559
ProtoModel::possibleOutputParam
bool possibleOutputParam(const Address &loc, int4 size) const
Does the given storage location make sense as a return value.
Definition: fspec.hh:745
ParamList::p_merged
@ p_merged
A merged model (multiple models merged together)
Definition: fspec.hh:352
ProtoStoreSymbol::setInput
virtual ProtoParameter * setInput(int4 i, const string &nm, const ParameterPieces &pieces)
Establish name, data-type, storage of a specific input parameter.
Definition: fspec.cc:2505
AddrSpaceManager
A manager for different address spaces.
Definition: translate.hh:218
FuncCallSpecs::resolveSpacebaseRelative
void resolveSpacebaseRelative(Funcdata &data, Varnode *phvn)
Calculate the stack offset of this call site.
Definition: fspec.cc:4033
FuncCallSpecs::getInputBytesConsumed
int4 getInputBytesConsumed(int4 slot) const
Get the estimated number of bytes within the given parameter that are consumed.
Definition: fspec.cc:4977
ParamList::clone
virtual ParamList * clone(void) const =0
Clone this parameter list model.
ParamListStandardOut::possibleParam
virtual bool possibleParam(const Address &loc, int4 size) const
Does the given storage location make sense as a parameter.
Definition: fspec.cc:1200
FuncCallSpecs::checkOutputTrialUse
void checkOutputTrialUse(Funcdata &data, vector< Varnode * > &trialvn)
Mark if output trials are being actively used.
Definition: fspec.cc:4781
FuncProto::restoreXml
void restoreXml(const Element *el, Architecture *glb)
Restore this from an XML stream.
Definition: fspec.cc:3837
FuncProto
A function prototype.
Definition: fspec.hh:1164
FuncProto::getBiggestContainedInputParam
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:3632
ProtoParameter::isThisPointer
virtual bool isThisPointer(void) const =0
Is this the "this" pointer for a class method.
FuncCallSpecs::findPreexistingWhole
static Varnode * findPreexistingWhole(Varnode *vn1, Varnode *vn2)
Check if given two Varnodes are merged into a whole.
Definition: fspec.cc:4864
FuncProto::setModelLock
void setModelLock(bool val)
Toggle the lock on the prototype model for this.
Definition: fspec.hh:1226
ProtoStoreSymbol::getOutput
virtual ProtoParameter * getOutput(void)
Get the return-value description.
Definition: fspec.cc:2614
AliasChecker
A light-weight class for analyzing pointers and aliasing on the stack.
Definition: varmap.hh:122
ParamListStandard::getBiggestContainedParam
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
ParamList
Definition: fspec.hh:346
ParamTrial::splitHi
ParamTrial splitHi(int4 sz) const
Create a trial representing the first part of this.
Definition: fspec.cc:1310
type_metatype
type_metatype
Definition: type.hh:33
EffectRecord::return_address
@ return_address
The memory is being used to pass back a return value from the sub-function.
Definition: fspec.hh:317
ParamListStandard::assignMap
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
ParamListStandard::assignAddress
Address assignAddress(const Datatype *tp, vector< int4 > &status) const
Assign storage for given parameter data-type.
Definition: fspec.cc:510
ParamListStandard::checkSplit
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
ParamTrial::rem_formed
@ rem_formed
The trial is built out of a remainder operation.
Definition: fspec.hh:165
Symbol
The base class for a symbol in a symbol table or scope.
Definition: database.hh:152
ProtoParameter::getAddress
virtual Address getAddress(void) const =0
Get the storage address for this parameter.
ParamTrial::unref
@ unref
There is no direct reference to this parameter trial.
Definition: fspec.hh:163
ParameterBasic::getName
virtual const string & getName(void) const
Get the name of the parameter ("" for return value)
Definition: fspec.hh:985
ProtoStore::getOutput
virtual ProtoParameter * getOutput(void)=0
Get the return-value description.
FuncProto::setOutputErrors
void setOutputErrors(bool val)
Toggle the output error setting for this prototype.
Definition: fspec.hh:1291
ParamActive::deleteUnusedTrials
void deleteUnusedTrials(void)
Remove trials that were found not to be parameters.
Definition: fspec.cc:1457
ParamEntry::restoreXml
void restoreXml(const Element *el, const AddrSpaceManager *manage, bool normalstack)
Restore the entry from an XML stream.
Definition: fspec.cc:302
FspecSpace::restoreXml
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: fspec.cc:1619
FuncCallSpecs::checkInputJoin
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:4476
ParamList::possibleParamWithSlot
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.
rangemap.hh
Templates to define interval map containers.
ProtoStoreInternal::restoreXml
virtual void restoreXml(const Element *el, ProtoModel *model)
Restore any internal parameter descriptions from an XML stream.
Definition: fspec.cc:2801
ParamEntry::extracheck_low
@ extracheck_low
Perform extra checks during parameter recovery on least sig portion of the double.
Definition: fspec.hh:59
FuncProto::setNoReturn
void setNoReturn(bool val)
Toggle the no-return setting for functions with this prototype.
Definition: fspec.hh:1256
ParamListStandard::assumedExtension
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:998
ProtoStoreInternal::saveXml
virtual void saveXml(ostream &s) const
Save any parameters that are not backed by symbols to an XML stream.
Definition: fspec.cc:2761
FspecSpace::printRaw
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: fspec.cc:1600
FuncProto::isNoReturn
bool isNoReturn(void) const
Does a function with this prototype never return.
Definition: fspec.hh:1251
ParameterSymbol::overrideSizeLockType
virtual void overrideSizeLockType(Datatype *ct)
Change (override) the data-type of a size-locked parameter.
Definition: fspec.cc:2435
FuncProto::isDestructor
bool isDestructor(void) const
Is this prototype for a class destructor method.
Definition: fspec.hh:1270
FuncProto::setReturnBytesConsumed
bool setReturnBytesConsumed(int4 val)
Set the number of bytes consumed by callers of this.
Definition: fspec.cc:3181
FuncProto::getMaxInputDelay
int4 getMaxInputDelay(void) const
Return the maximum heritage delay across all possible input parameters.
Definition: fspec.hh:1375
EffectRecord::restoreXml
void restoreXml(uint4 grouptype, const Element *el, const AddrSpaceManager *manage)
Restore the record from an XML stream.
Definition: fspec.cc:1673
FuncProto::isCompatible
bool isCompatible(const FuncProto &op2) const
Decide if this can be safely restricted to match another prototype.
Definition: fspec.cc:3668
ParameterSymbol::isThisPointer
virtual bool isThisPointer(void) const
Is this the "this" pointer for a class method.
Definition: fspec.cc:2381