本文整理汇总了C++中LocationVector::rbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ LocationVector::rbegin方法的具体用法?C++ LocationVector::rbegin怎么用?C++ LocationVector::rbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocationVector
的用法示例。
在下文中一共展示了LocationVector::rbegin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisassembleData
bool Disassembler::DisassembleData(LocationVector &LocationStack, istream &InputStream, uint64 &Address)
{
bool fRetVal = true;
unsigned int TempChar;
Data *pData;
while(InputStream.good() && Address < EndAddress)
{
//Get a byte of data from the stream.
TempChar = InputStream.get();
if(TempChar == -1) //EOF
break;
//Add the byte to the sequence
if((*TheProg.Segments.rbegin())->Sequence.empty())
{
//Create a new byte element.
pData = new Data(LocationStack, DATA1, Addressability, new IntegerNumber(LocationStack, TempChar));
(*TheProg.Segments.rbegin())->Sequence.push_back(pData);
pData->Address = Address;
}
else
{
//Add the byte to an existing array.
pData = reinterpret_cast<Data *>(*(*TheProg.Segments.rbegin())->Sequence.rbegin());
pData->vData.push_back(new IntegerNumber(LocationStack, TempChar));
pData->Length++;
pData->Size++;
}
Address++;
LocationStack.rbegin()->second++;
}
return fRetVal;
}
示例2: Disassemble
bool Disassembler::Disassemble(LocationVector &LocationStack, istream &InputStream, SymbolList &Symbols)
{
bool fRetVal = true;
unsigned int i, TempChar;
JMT::ByteData ByteData;
if(fRunOnce)
throw "Disassembler called twice on the same program!";
fRunOnce = true;
//First read starting address.
for(i = 0; i < sizeof(uint64); i++)
{
TempChar = InputStream.get();
if(TempChar == -1) //EOF
break;
//The address in the file is always little endian
#ifdef BIG_ENDIAN_BUILD
ByteData.Bytes[sizeof(uint64) - i - 1] = TempChar;
#else
ByteData.Bytes[i] = TempChar;
#endif
LocationStack.rbegin()->second++;
}
if(i < sizeof(uint64))
{
CallBack(Fatal, "Unexpected end of file.", LocationStack);
return false;
}
StartAddress = ByteData.UI64;
//Then read ending address
for(i = 0; i < sizeof(uint64); i++)
{
TempChar = InputStream.get();
if(TempChar == -1) //EOF
break;
//The address in the file is always little endian
#ifdef BIG_ENDIAN_BUILD
ByteData.Bytes[sizeof(uint64) - i - 1] = TempChar;
#else
ByteData.Bytes[i] = TempChar;
#endif
LocationStack.rbegin()->second++;
}
if(i < sizeof(uint64))
{
CallBack(Fatal, "Unexpected end of file.", LocationStack);
return false;
}
EndAddress = StartAddress + ByteData.UI64;
//Check addresses
if(EndAddress < StartAddress)
{
CallBack(Fatal, "Program end address is less than start address.", LocationStack);
return false;
}
//Create program origin
TheProg.fDynamicAddress = false;
TheProg.Address = StartAddress;
//Create program segment
TheProg.Segments.push_back(new Segment(LocationStack, Addressability, 0));
//Add the pre-existing symbols
for(SymbolList::iterator SymbolIter = Symbols.begin(); SymbolIter != Symbols.end(); SymbolIter++)
DisassembleSymbol(SymbolIter->first, SymbolIter->second, SymbolIter->third);
//Try to disassemble instructions. Instructions have highest priority.
uint64 Address = StartAddress;
if(ToLower(TheProg.sFileName.Ext) == "obj")
{
if(!DisassembleInstructions(LocationStack, InputStream, Address))
return false;
}
else //"bin"
{
if(!DisassembleData(LocationStack, InputStream, Address))
return false;
}
if(Address < EndAddress)
{
CallBack(Error, "Unexpected end of file.", LocationStack);
return false;
}
//Create labels
list<Element *>::iterator ElemIter = (*TheProg.Segments.begin())->Sequence.begin();
for(LabelMap::iterator LabelIter = Labels.begin(); LabelIter != Labels.end(); LabelIter++)
{
//Find the element this label points to
while(ElemIter != (*TheProg.Segments.begin())->Sequence.end() && (*ElemIter)->Address < LabelIter->first)
ElemIter++;
if(ElemIter == (*TheProg.Segments.begin())->Sequence.end())
{
ElemIter--;
//.........这里部分代码省略.........