我想按地址枚举符号,但是当我调用它时似乎IDiaEnumSymbolsByAddr::Next崩溃了。
文档没有说明任何额外的内容。要重现的最小代码:
int main()
{
IDiaDataSource *ds;
IDiaSession *session;
IDiaEnumSymbolsByAddr *symbolEnum;
IDiaSymbol *symbol;
HRESULT hr;
ULONG fetched;
CoInitialize(NULL);
hr = makeDiaDataSource(&ds);
assert(SUCCEEDED(hr));
hr = ds->loadDataForExe(L"readpdb.exe", NULL, NULL);
assert(SUCCEEDED(hr));
hr = ds->openSession(&session);
assert(SUCCEEDED(hr));
hr = session->getSymbolsByAddr(&symbolEnum);
assert(SUCCEEDED(hr));
hr = symbolEnum->Next(1, &symbol, &fetched); // crash at this line.
assert(SUCCEEDED(hr));
printf("All is OK.\n");
return 0;
}
这是DIA DSK中的错误吗?或者也许我不应该这样使用界面?