本文整理汇总了C++中VarList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ VarList::size方法的具体用法?C++ VarList::size怎么用?C++ VarList::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarList
的用法示例。
在下文中一共展示了VarList::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Inst
InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked)
: Inst(Func, Inst::FakeKill, KilledRegs.size(), NULL), Linked(Linked) {
for (VarList::const_iterator I = KilledRegs.begin(), E = KilledRegs.end();
I != E; ++I) {
Variable *Var = *I;
addSource(Var);
}
}
示例2: organizeNewBss
void DataRewriter::organizeNewBss(Region* reg, unsigned char magic) {
/**
*
*/
fprintf(stderr, "BSS region starts at %p\n", reg->getRegionAddr());
VarList globals = filterVariables(reg);
unsigned int dataSize = 0;
unsigned int dataBase = 0;
unsigned int dataOffset = 0;
unsigned int rawIndex = 0;
unsigned int rawValue = 0;
unsigned int newRawIndex = 0;
dataSize = reg->getRegionSize();
dataBase = newDataBase + newDataSize;
fprintf(stderr, "BSS base = %p\n", (void*) dataBase);
unsigned int newBssSize = sizeof(unsigned char) * dataSize;
oldRawBss = (unsigned char*) reg->getPtrToRawData();
newRawBss = (unsigned char*) malloc (newBssSize);
memcpy(newRawBss, oldRawBss, dataSize);
for (int i = 0; i < globals.size(); i++) {
dataOffset = globals[i]->getOffset();
rawIndex = dataOffset - dataBase;
// Update the relocated address mapping
newLocs[dataOffset] = dataBase + newRawIndex;
newRawIndex += globals[i]->getSize();
}
for (AddrMapping::const_iterator iter = newLocs.begin();
iter != newLocs.end();
++iter) {
fprintf(stderr, "%p -> %p\n", iter->first, iter->second);
}
// Causes a segfault in the mutated binary
//
//if (!reg->setPtrToRawData(newRawBss, newDataSize)) {
// fprintf(stderr, "Unable to assign new data section.\n");
// exit(EXIT_FAILURE);
//}
}
示例3: organizeNewData
void DataRewriter::organizeNewData(Region* reg, unsigned char magic) {
/**
*
*/
VarList globals = filterVariables(reg);
unsigned int dataSize = 0;
unsigned int dataBase = 0;
unsigned int dataOffset = 0;
unsigned int rawIndex = 0;
unsigned int rawValue = 0;
unsigned int newRawIndex = 0;
dataSize = reg->getRegionSize();
dataBase = reg->getRegionAddr();
newDataBase = dataBase;
newDataSize = sizeof(unsigned char) * dataSize * 2;
oldRaw = (unsigned char*) reg->getPtrToRawData();
newRaw = (unsigned char*) malloc (newDataSize);
// The dso_handle bullshit
memcpy(newRaw, oldRaw, 4);
memset(newRaw + 4, magic, 4);
newRawIndex += 8;
// Pad the new data section with an extra 4 bytes between all 4 byte values.
for (int i = 0; i < globals.size(); i++) {
dataOffset = globals[i]->getOffset();
rawIndex = dataOffset - dataBase;
memcpy(newRaw + newRawIndex, oldRaw + rawIndex, 4);
// Sanity checks, write magic values into padding
memset(newRaw + newRawIndex + 4, magic, 4);
// Update the relocated address mapping
newLocs[dataOffset] = dataBase + newRawIndex;
newRawIndex += 8;
}
fprintf(stderr, "NEW DATA: %p through %p\n", newDataBase, newDataBase + newDataSize);
if (!reg->setPtrToRawData(newRaw, newDataSize)) {
fprintf(stderr, "Unable to assign new data section.\n");
exit(EXIT_FAILURE);
}
}
示例4: nvars
const size_t nvars( void ) const
{
return( m_vars.size() );
}