I am printing out some debug information about the callstack. I can get the function name easily enough using SymFromAddr
void getFunctionInfo(FunctionInfo& funcInfo, uintptr_t address)
{
DWORD64 dwDisplacement; //not used
static char buffer[ sizeof(SYMBOL_INFO) + MAX_SYM_NAME ];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO) buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_SYM_NAME;
if ( SymFromAddr( m_process, address, &dwDisplacement, pSymbol) )
{
strcpy(funcInfo.funcName, pSymbol->Name, MAX_SYM_NAME);
}
//TODO get function arguments
}
However I want to reproduce the full signature of the function in order to disambiguate between overrides and basically reproduce what is shown in the visual studio callstack window. I am unable to find an api call to achieve this.
Is there one?
Thanks to @IInspectable for providing me with the answer: UnDecorateSymbolName
This is my modified code:
There is also a more complicated but more powerful way of getting function parameters and more besides by using SymGetTypeInfo. Details of this can be found at this excellent CodeProject article: Using PDB files and symbols to debug your application