本文整理汇总了C++中Cfg::label方法的典型用法代码示例。如果您正苦于以下问题:C++ Cfg::label方法的具体用法?C++ Cfg::label怎么用?C++ Cfg::label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cfg
的用法示例。
在下文中一共展示了Cfg::label方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processProc
/*==============================================================================
* FUNCTION: FrontEnd::processProc
* OVERVIEW: Process a procedure, given a native (source machine) address.
* PARAMETERS: address - the address at which the procedure starts
* pProc - the procedure object
* frag - if true, this is just a fragment of a procedure
* spec - if true, this is a speculative decode
* os - the output stream for .rtl output
* NOTE: This is a sort of generic front end. For many processors, this will be overridden
* in the FrontEnd derived class, sometimes calling this function to do most of the work
* RETURNS: true for a good decode (no illegal instructions)
*============================================================================*/
bool FrontEnd::processProc(ADDRESS uAddr, UserProc* pProc, std::ofstream &os, bool frag /* = false */,
bool spec /* = false */) {
PBB pBB; // Pointer to the current basic block
std::cout<<"Entering Processing Proc\n";
// just in case you missed it
first_line = true;
if (AssProgram)
std::cout <<"Name Of Program : " << AssProgram->name << std::endl;
Boomerang::get()->alert_new(pProc);
// We have a set of CallStatement pointers. These may be disregarded if this is a speculative decode
// that fails (i.e. an illegal instruction is found). If not, this set will be used to add to the set of calls
// to be analysed in the cfg, and also to call newProc()
std::list<CallStatement*> callList;
// Indicates whether or not the next instruction to be decoded is the lexical successor of the current one.
// Will be true for all NCTs and for CTIs with a fall through branch.
bool sequentialDecode = true;
Cfg* pCfg = pProc->getCFG();
// If this is a speculative decode, the second time we decode the same address, we get no cfg. Else an error.
if (spec && (pCfg == 0))
return false;
assert(pCfg);
// Initialise the queue of control flow targets that have yet to be decoded.
targetQueue.initial(uAddr);
// Clear the pointer used by the caller prologue code to access the last call rtl of this procedure
//decoder.resetLastCall();
// ADDRESS initAddr = uAddr;
int nTotalBytes = 0;
ADDRESS startAddr = uAddr;
ADDRESS lastAddr = uAddr;
ADDRESS address = uAddr;
std::cout << "Start at address = " << uAddr << std::endl;
//------IMPORTANT------------------------------------------------------------------------
list<AssemblyLabel*>::iterator lbi;
list<AssemblyLine*>* temp_lines = new list<AssemblyLine*>();
if (AssProgram){
for(lbi = AssProgram->labelList->begin(); lbi != AssProgram->labelList->end(); ++lbi ){
if((*lbi)->address == uAddr){
temp_lines = (*lbi)->lineList;
std::cout << "***DECODE LABEL: " << (*lbi)->name << std::endl;
std::cout << "***AT ADDRESS: " << (*lbi)->address << std::endl;
std::cout << "***NUMBER OF INSTRUCTION: " << (*lbi)->lineList->size() << std::endl;
break;
}
}
}
list<AssemblyLine*>::iterator li;
if (temp_lines->size()>0)
li = temp_lines->begin();
//---------------------------------------------------------------------------------------
while ((uAddr = targetQueue.nextAddress(pCfg)) != NO_ADDRESS) {
// The list of RTLs for the current basic block
std::list<RTL*>* BB_rtls = new std::list<RTL*>();
// Keep decoding sequentially until a CTI without a fall through branch is decoded
//ADDRESS start = uAddr;
DecodeResult inst;
while (sequentialDecode) {
// Decode and classify the current source instruction
if (Boomerang::get()->traceDecoder)
LOG << "*" << uAddr << "\t";
// Decode the inst at uAddr.
if(ASS_FILE){
if(li != temp_lines->end()){
inst = decodeAssemblyInstruction(uAddr,"assemblySets.at(line)", (*li));
}
}
else
inst = decodeInstruction(uAddr);
// If invalid and we are speculating, just exit
if (spec && !inst.valid)
return false;
// Need to construct a new list of RTLs if a basic block has just been finished but decoding is
//.........这里部分代码省略.........