GT-3014 Recover PDB stack variables from recent Visual Studio

This commit is contained in:
ghizard 2019-07-18 16:22:05 -04:00
parent 4d31ed9db4
commit e9a8b63a23
2 changed files with 11 additions and 4 deletions

View file

@ -208,12 +208,19 @@ void iterateClasses(PDBApiContext& ctx) {
// This method still leaks memory--seemingly in the pEnum->Next() for
// certain symbol types (e.g., tag == 32 (inline))
void dumpFunctionStackVariables( PDBApiContext& ctx, DWORD rva )
void dumpFunctionStackVariables(IDiaSymbol* symbol, IDiaSession& session )
{
CComPtr<IDiaSymbol> pBlock;
if ( FAILED(ctx.Session().findSymbolByRVA( rva, SymTagBlock, &pBlock ) ) ) {
const DWORD address = getRVA(*symbol);
HRESULT hr = session.findSymbolByRVA( address, SymTagBlock, &pBlock );
if( hr == S_FALSE ) {
pBlock = symbol;
}
else if ( FAILED(hr) ){
fatal( "Failed to find symbols by RVA" );
}
for ( ; pBlock != NULL; ) {
CComPtr<IDiaEnumSymbols> pEnum;
// Local data search
@ -348,7 +355,7 @@ void iterateFunctions(PDBApiContext& ctx) {
printf("%S<function name=\"%S\" address=\"0x%x\" length=\"0x%I64x\">\n", indent(8).c_str(), findMangledName(ctx, *pSymbol).c_str(), address, getLength(*pSymbol));
dumpFunctionStackVariables(ctx, address);
dumpFunctionStackVariables(pSymbol, ctx.Session());
dumpFunctionLines(*pSymbol, ctx.Session());
printf("%S</function>\n", indent(8).c_str());

View file

@ -65,7 +65,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OutputFile>$(TargetPath)</OutputFile>
</Link>