mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GT-3014 Recover PDB stack variables from recent Visual Studio
This commit is contained in:
parent
4d31ed9db4
commit
e9a8b63a23
2 changed files with 11 additions and 4 deletions
|
@ -208,12 +208,19 @@ void iterateClasses(PDBApiContext& ctx) {
|
||||||
|
|
||||||
// This method still leaks memory--seemingly in the pEnum->Next() for
|
// This method still leaks memory--seemingly in the pEnum->Next() for
|
||||||
// certain symbol types (e.g., tag == 32 (inline))
|
// certain symbol types (e.g., tag == 32 (inline))
|
||||||
void dumpFunctionStackVariables( PDBApiContext& ctx, DWORD rva )
|
void dumpFunctionStackVariables(IDiaSymbol* symbol, IDiaSession& session )
|
||||||
{
|
{
|
||||||
CComPtr<IDiaSymbol> pBlock;
|
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" );
|
fatal( "Failed to find symbols by RVA" );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; pBlock != NULL; ) {
|
for ( ; pBlock != NULL; ) {
|
||||||
CComPtr<IDiaEnumSymbols> pEnum;
|
CComPtr<IDiaEnumSymbols> pEnum;
|
||||||
// Local data search
|
// 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));
|
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());
|
dumpFunctionLines(*pSymbol, ctx.Session());
|
||||||
|
|
||||||
printf("%S</function>\n", indent(8).c_str());
|
printf("%S</function>\n", indent(8).c_str());
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<OutputFile>$(TargetPath)</OutputFile>
|
<OutputFile>$(TargetPath)</OutputFile>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue