msvcrt: Add support for template operators in symbol demangling.

This commit is contained in:
Alexandre Julliard 2011-05-14 16:19:33 +02:00
parent 5e1b9c149e
commit 5d12e970ff
2 changed files with 21 additions and 1 deletions

View File

@ -1053,6 +1053,9 @@ static void test_demangle(void)
/* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"},
/* 119 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", "class std::complex<float> & __ptr64 __cdecl std::operator*=(class std::complex<float> & __ptr64,class std::complex<float> const & __ptr64)"},
/* 120 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)const __ptr64"},
/* 121 */ {"??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z",
"class std::complex<float> __cdecl std::operator*<float>(float const &,class std::complex<float> const &)",
"??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z"},
};
int i, num_test = (sizeof(test)/sizeof(test[0]));

View File

@ -1238,10 +1238,16 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
sym->current++;
/* Then function name or operator code */
if (*sym->current == '?' && sym->current[1] != '$')
if (*sym->current == '?' && (sym->current[1] != '$' || sym->current[2] == '?'))
{
const char* function_name = NULL;
if (sym->current[1] == '$')
{
do_after = 6;
sym->current += 2;
}
/* C++ operator code (one character, or two if the first is '_') */
switch (*++sym->current)
{
@ -1374,6 +1380,17 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
sym->result = (char*)function_name;
ret = TRUE;
goto done;
case 6:
{
char *args;
struct array array_pmt;
str_array_init(&array_pmt);
args = get_args(sym, &array_pmt, FALSE, '<', '>');
if (args != NULL) function_name = str_printf(sym, "%s%s", function_name, args);
sym->names.num = 0;
}
/* fall through */
default:
if (!str_array_push(sym, function_name, -1, &sym->stack))
return FALSE;