1

我想按地址枚举符号,但是当我调用它时,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 SDK 中的错误吗?或者也许我不应该以这种方式使用界面?

4

0 回答 0