// the result doesn't have to be free()d but is only valid until the next call to this function static const char *GetUndecoratedSymbolName(IDiaSymbol *symbol, const char *defName = "<noname>") { static str::Str<char> strTmp; BSTR name = NULL; #if 0 DWORD undecorateOptions = UNDNAME_COMPLETE; #else DWORD undecorateOptions = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_FUNCTION_RETURNS | UNDNAME_NO_ALLOCATION_MODEL | UNDNAME_NO_ALLOCATION_LANGUAGE | UNDNAME_NO_THISTYPE | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_THROW_SIGNATURES | UNDNAME_NO_MEMBER_TYPE | UNDNAME_NO_RETURN_UDT_MODEL | UNDNAME_NO_ECSU; #endif if (S_OK == symbol->get_undecoratedNameEx(undecorateOptions, &name)) { BStrToString(strTmp, name, "", true); if (str::Eq(strTmp.Get(), "`string'")) return "*str"; strTmp.Replace("(void)", "()"); // more ideas for undecoration: // http://google-breakpad.googlecode.com/svn/trunk/src/common/windows/pdb_source_line_writer.cc } else { // Unfortunately it does happen that get_undecoratedNameEx() fails // e.g. for RememberDefaultWindowPosition() in Sumatra code symbol->get_name(&name); BStrToString(strTmp, name, defName, true); } SysFreeStringSafe(name); return strTmp.Get(); }