My Project
|
A container for Varnode objects from a specific function. More...
#include <varnode.hh>
Public Member Functions | |
VarnodeBank (AddrSpaceManager *m, AddrSpace *uspace, uintm ubase) | |
Construct the container. More... | |
void | clear (void) |
Clear out all Varnodes and reset counters. | |
~VarnodeBank (void) | |
Destructor. | |
int4 | numVarnodes (void) const |
Get number of Varnodes this contains. | |
Varnode * | create (int4 s, const Address &m, Datatype *ct) |
Create a free Varnode object. More... | |
Varnode * | createDef (int4 s, const Address &m, Datatype *ct, PcodeOp *op) |
Create a Varnode as the output of a PcodeOp. More... | |
Varnode * | createUnique (int4 s, Datatype *ct) |
Create a temporary varnode. More... | |
Varnode * | createDefUnique (int4 s, Datatype *ct, PcodeOp *op) |
Create a temporary Varnode as output of a PcodeOp. More... | |
void | destroy (Varnode *vn) |
Remove a Varnode from the container. More... | |
Varnode * | setInput (Varnode *vn) |
Mark a Varnode as an input to the function. More... | |
Varnode * | setDef (Varnode *vn, PcodeOp *op) |
Change Varnode to be defined by the given PcodeOp. More... | |
void | makeFree (Varnode *vn) |
Convert a Varnode to be free. More... | |
void | replace (Varnode *oldvn, Varnode *newvn) |
Replace every read of one Varnode with another. More... | |
Varnode * | find (int4 s, const Address &loc, const Address &pc, uintm uniq=~((uintm) 0)) const |
Find a Varnode. More... | |
Varnode * | findInput (int4 s, const Address &loc) const |
Find an input Varnode. More... | |
Varnode * | findCoveredInput (int4 s, const Address &loc) const |
Find an input Varnode contained within this range. More... | |
Varnode * | findCoveringInput (int4 s, const Address &loc) const |
Find an input Varnode covering a range. More... | |
uint4 | getCreateIndex (void) const |
Get the next creation index to be assigned. | |
VarnodeLocSet::const_iterator | beginLoc (void) const |
Beginning of location list. | |
VarnodeLocSet::const_iterator | endLoc (void) const |
End of location list. | |
VarnodeLocSet::const_iterator | beginLoc (AddrSpace *spaceid) const |
Beginning of Varnodes in given address space sorted by location. More... | |
VarnodeLocSet::const_iterator | endLoc (AddrSpace *spaceid) const |
Ending of Varnodes in given address space sorted by location. More... | |
VarnodeLocSet::const_iterator | beginLoc (const Address &addr) const |
Beginning of Varnodes starting at a given address sorted by location. More... | |
VarnodeLocSet::const_iterator | endLoc (const Address &addr) const |
End of Varnodes starting at a given address sorted by location. More... | |
VarnodeLocSet::const_iterator | beginLoc (int4 s, const Address &addr) const |
Beginning of Varnodes of given size and starting address sorted by location. More... | |
VarnodeLocSet::const_iterator | endLoc (int4 s, const Address &addr) const |
End of Varnodes of given size and starting address sorted by location. More... | |
VarnodeLocSet::const_iterator | beginLoc (int4 s, const Address &addr, uint4 fl) const |
Beginning of Varnodes sorted by location. More... | |
VarnodeLocSet::const_iterator | endLoc (int4 s, const Address &addr, uint4 fl) const |
End of Varnodes sorted by location. More... | |
VarnodeLocSet::const_iterator | beginLoc (int4 s, const Address &addr, const Address &pc, uintm uniq) const |
Beginning of Varnodes sorted by location. More... | |
VarnodeLocSet::const_iterator | endLoc (int4 s, const Address &addr, const Address &pc, uintm uniq) const |
End of Varnodes sorted by location. More... | |
VarnodeDefSet::const_iterator | beginDef (void) const |
Beginning of Varnodes sorted by definition. | |
VarnodeDefSet::const_iterator | endDef (void) const |
End of Varnodes sorted by definition. | |
VarnodeDefSet::const_iterator | beginDef (uint4 fl) const |
Beginning of varnodes with set definition property. More... | |
VarnodeDefSet::const_iterator | endDef (uint4 fl) const |
End of varnodes with set definition property. More... | |
VarnodeDefSet::const_iterator | beginDef (uint4 fl, const Address &addr) const |
Beginning of varnodes starting at a given address with a set definition property. More... | |
VarnodeDefSet::const_iterator | endDef (uint4 fl, const Address &addr) const |
End of varnodes starting at a given address with a set definition property. More... | |
A container for Varnode objects from a specific function.
The API allows the creation, deletion, search, and iteration of Varnode objects from one function. The class maintains two ordering for efficiency:
VarnodeBank::VarnodeBank | ( | AddrSpaceManager * | m, |
AddrSpace * | uspace, | ||
uintm | ubase | ||
) |
Construct the container.
m | is the underlying address space manager |
uspace | is the unique space |
ubase | is the base offset for allocating temporaries |
VarnodeDefSet::const_iterator VarnodeBank::beginDef | ( | uint4 | fl | ) | const |
Beginning of varnodes with set definition property.
Get an iterator to Varnodes in definition order restricted with the following properties:
fl | is the property restriction |
VarnodeDefSet::const_iterator VarnodeBank::beginDef | ( | uint4 | fl, |
const Address & | addr | ||
) | const |
Beginning of varnodes starting at a given address with a set definition property.
Get an iterator to Varnodes in definition order. The starting address of the Varnodes must match the given address, and they are further restricted by the following properties:
fl | is the property restriction |
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::beginLoc | ( | AddrSpace * | spaceid | ) | const |
Beginning of Varnodes in given address space sorted by location.
spaceid | is the given address space |
VarnodeLocSet::const_iterator VarnodeBank::beginLoc | ( | const Address & | addr | ) | const |
Beginning of Varnodes starting at a given address sorted by location.
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::beginLoc | ( | int4 | s, |
const Address & | addr | ||
) | const |
Beginning of Varnodes of given size and starting address sorted by location.
s | is the given size |
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::beginLoc | ( | int4 | s, |
const Address & | addr, | ||
uint4 | fl | ||
) | const |
Beginning of Varnodes sorted by location.
Varnodes are restricted by a given size and location and by the property
s | is the given size |
addr | is the given starting address |
fl | is the property restriction |
VarnodeLocSet::const_iterator VarnodeBank::beginLoc | ( | int4 | s, |
const Address & | addr, | ||
const Address & | pc, | ||
uintm | uniq | ||
) | const |
Beginning of Varnodes sorted by location.
Varnodes are restricted by a given size and location and by the sequence number of the PcodeOp defining it
s | is the given size |
addr | is the given starting address |
pc | is the address of the PcodeOp defining the Varnode |
uniq | is the sequence number of the PcodeOp or -1 for now sequence number restriction |
Create a free Varnode object.
The Varnode is created and inserted into the maps as free: not defined as the output of a p-code op or the input to a function.
s | is the size of the Varnode in bytes |
m | is the starting address |
ct | is the data-type of the new varnode (must not be NULL) |
Create a Varnode as the output of a PcodeOp.
The new Varnode object will already be put in the definition list as if it were the output of the given PcodeOp. The Varnode must still be set as the output.
s | is the size in bytes |
m | is the starting address |
ct | is the data-type to associate |
op | is the given PcodeOp |
Create a temporary Varnode as output of a PcodeOp.
The new Varnode will be assigned from the unique space, and it will already be put in the definition list as if it were the output of the given PcodeOp. The Varnode must still be set as the output.
s | is the size in bytes |
ct | is the data-type to associate |
op | is the given PcodeOp |
void VarnodeBank::destroy | ( | Varnode * | vn | ) |
VarnodeDefSet::const_iterator VarnodeBank::endDef | ( | uint4 | fl | ) | const |
End of varnodes with set definition property.
Get an iterator to Varnodes in definition order restricted with the following properties:
fl | is the property restriction |
VarnodeDefSet::const_iterator VarnodeBank::endDef | ( | uint4 | fl, |
const Address & | addr | ||
) | const |
End of varnodes starting at a given address with a set definition property.
Get an iterator to Varnodes in definition order. The starting address of the Varnodes must match the given address, and they are further restricted by the following properties:
fl | is the property restriction |
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::endLoc | ( | AddrSpace * | spaceid | ) | const |
Ending of Varnodes in given address space sorted by location.
spaceid | is the given address space |
VarnodeLocSet::const_iterator VarnodeBank::endLoc | ( | const Address & | addr | ) | const |
End of Varnodes starting at a given address sorted by location.
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::endLoc | ( | int4 | s, |
const Address & | addr | ||
) | const |
End of Varnodes of given size and starting address sorted by location.
s | is the given size |
addr | is the given starting address |
VarnodeLocSet::const_iterator VarnodeBank::endLoc | ( | int4 | s, |
const Address & | addr, | ||
uint4 | fl | ||
) | const |
End of Varnodes sorted by location.
Varnodes are restricted by a given size and location and by the property
s | is the given size |
addr | is the given starting address |
fl | is the property restriction |
VarnodeLocSet::const_iterator VarnodeBank::endLoc | ( | int4 | s, |
const Address & | addr, | ||
const Address & | pc, | ||
uintm | uniq | ||
) | const |
End of Varnodes sorted by location.
Varnodes are restricted by a given size and location and by the sequence number of the PcodeOp defining it
s | is the given size |
addr | is the given starting address |
pc | is the address of the PcodeOp defining the Varnode |
uniq | is the sequence number of the PcodeOp or -1 for now sequence number restriction |
void VarnodeBank::makeFree | ( | Varnode * | vn | ) |
Change Varnode to be defined by the given PcodeOp.
The Varnode must initially be free. It will be removed from the cross-referencing lists and reinserted as if its were the output of the given PcodeOp. It still must be explicitly set as the output.