本文整理汇总了C++中IDiaSymbol::get_relativeVirtualAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ IDiaSymbol::get_relativeVirtualAddress方法的具体用法?C++ IDiaSymbol::get_relativeVirtualAddress怎么用?C++ IDiaSymbol::get_relativeVirtualAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDiaSymbol
的用法示例。
在下文中一共展示了IDiaSymbol::get_relativeVirtualAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpSymbols
static void DumpSymbols(IDiaSession *session)
{
HRESULT hr;
IDiaEnumSymbolsByAddr * enumByAddr = NULL;
IDiaSymbol * symbol = NULL;
hr = session->getSymbolsByAddr(&enumByAddr);
if (!SUCCEEDED(hr))
goto Exit;
// get first symbol to get first RVA (argh)
hr = enumByAddr->symbolByAddr(1, 0, &symbol);
if (!SUCCEEDED(hr))
goto Exit;
DWORD rva;
hr = symbol->get_relativeVirtualAddress(&rva);
if (S_OK != hr)
goto Exit;
symbol->Release();
symbol = NULL;
// enumerate by rva
hr = enumByAddr->symbolByRVA(rva, &symbol);
if (!SUCCEEDED(hr))
goto Exit;
AddReportSepLine();
g_report.Append("Symbols:\n");
ULONG numFetched;
for (;;)
{
DumpSymbol(symbol);
symbol->Release();
symbol = NULL;
hr = enumByAddr->Next(1, &symbol, &numFetched);
if (FAILED(hr) || (numFetched != 1))
break;
}
Exit:
UnkReleaseSafe(symbol);
UnkReleaseSafe(enumByAddr);
}
示例2: ReadEverything
void PDBFileReader::ReadEverything(DebugInfo &to)
{
ULONG celt;
Contribs = 0;
nContribs = 0;
DanglingLengthStart = 0;
// read section table
IDiaEnumTables *enumTables;
if(Session->getEnumTables(&enumTables) == S_OK)
{
VARIANT vIndex;
vIndex.vt = VT_BSTR;
vIndex.bstrVal = SysAllocString(L"Sections");
IDiaTable *secTable;
if(enumTables->Item(vIndex,&secTable) == S_OK)
{
LONG count;
secTable->get_Count(&count);
Contribs = new SectionContrib[count];
nContribs = 0;
IDiaSectionContrib *item;
while(SUCCEEDED(secTable->Next(1,(IUnknown **)&item,&celt)) && celt == 1)
{
SectionContrib &contrib = Contribs[nContribs++];
item->get_addressOffset(&contrib.Offset);
item->get_addressSection(&contrib.Section);
item->get_length(&contrib.Length);
item->get_compilandId(&contrib.Compiland);
item->get_execute(&contrib.CodeFlag);
item->Release();
}
secTable->Release();
}
SysFreeString(vIndex.bstrVal);
enumTables->Release();
}
// enumerate symbols by (virtual) address
IDiaEnumSymbolsByAddr *enumByAddr;
if(SUCCEEDED(Session->getSymbolsByAddr(&enumByAddr)))
{
IDiaSymbol *symbol;
// get first symbol to get first RVA (argh)
if(SUCCEEDED(enumByAddr->symbolByAddr(1,0,&symbol)))
{
DWORD rva;
if(symbol->get_relativeVirtualAddress(&rva) == S_OK)
{
symbol->Release();
// now, enumerate by rva.
if(SUCCEEDED(enumByAddr->symbolByRVA(rva,&symbol)))
{
do
{
ProcessSymbol(symbol,to);
symbol->Release();
if(FAILED(enumByAddr->Next(1,&symbol,&celt)))
break;
}
while(celt == 1);
}
}
else
symbol->Release();
}
enumByAddr->Release();
}
// clean up
delete[] Contribs;
}
示例3: ReadEverything
void PDBFileReader::ReadEverything(DebugInfo &to)
{
ULONG celt;
Contribs = 0;
nContribs = 0;
// read section table
IDiaEnumTables *enumTables;
if(Session->getEnumTables(&enumTables) == S_OK)
{
VARIANT vIndex;
vIndex.vt = VT_BSTR;
vIndex.bstrVal = SysAllocString(L"Sections");
IDiaTable *secTable;
if(enumTables->Item(vIndex,&secTable) == S_OK)
{
LONG count;
secTable->get_Count(&count);
Contribs = new SectionContrib[count];
nContribs = 0;
IDiaSectionContrib *item;
while(SUCCEEDED(secTable->Next(1,(IUnknown **)&item,&celt)) && celt == 1)
{
SectionContrib &contrib = Contribs[nContribs++];
item->get_addressOffset(&contrib.Offset);
item->get_addressSection(&contrib.Section);
item->get_length(&contrib.Length);
item->get_compilandId(&contrib.Compiland);
BOOL code=FALSE,initData=FALSE,uninitData=FALSE;
item->get_code(&code);
item->get_initializedData(&initData);
item->get_uninitializedData(&uninitData);
if(code && !initData && !uninitData)
contrib.Type = DIC_CODE;
else if(!code && initData && !uninitData)
contrib.Type = DIC_DATA;
else if(!code && !initData && uninitData)
contrib.Type = DIC_BSS;
else
contrib.Type = DIC_UNKNOWN;
BSTR objFileName = 0;
IDiaSymbol *compiland = 0;
item->get_compiland(&compiland);
if(compiland)
{
compiland->get_name(&objFileName);
compiland->Release();
}
sChar *objFileStr = BStrToString(objFileName,"<noobjfile>");
contrib.ObjFile = to.GetFileByName(objFileStr);
delete[] objFileStr;
if(objFileName)
SysFreeString(objFileName);
item->Release();
}
secTable->Release();
}
SysFreeString(vIndex.bstrVal);
enumTables->Release();
}
// enumerate symbols by (virtual) address
IDiaEnumSymbolsByAddr *enumByAddr;
if(SUCCEEDED(Session->getSymbolsByAddr(&enumByAddr)))
{
IDiaSymbol *symbol;
// get first symbol to get first RVA (argh)
if(SUCCEEDED(enumByAddr->symbolByAddr(1,0,&symbol)))
{
DWORD rva;
if(symbol->get_relativeVirtualAddress(&rva) == S_OK)
{
symbol->Release();
// now, enumerate by rva.
if(SUCCEEDED(enumByAddr->symbolByRVA(rva,&symbol)))
{
do
{
ProcessSymbol(symbol,to);
symbol->Release();
if(FAILED(enumByAddr->Next(1,&symbol,&celt)))
break;
}
while(celt == 1);
//.........这里部分代码省略.........