Commit 5e1b9c14 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Add support for __ptr64 attribute in symbol demangling.

parent 6f5e5ec9
...@@ -1051,6 +1051,8 @@ static void test_demangle(void) ...@@ -1051,6 +1051,8 @@ static void test_demangle(void)
/* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"}, /* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
/* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"}, /* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"},
/* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"}, /* 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"},
}; };
int i, num_test = (sizeof(test)/sizeof(test[0])); int i, num_test = (sizeof(test)/sizeof(test[0]));
......
...@@ -416,11 +416,17 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t ...@@ -416,11 +416,17 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t
/****************************************************************** /******************************************************************
* get_modifier * get_modifier
* Parses the type modifier. Always returns a static string * Parses the type modifier. Always returns static strings.
*/ */
static BOOL get_modifier(char ch, const char** ret) static BOOL get_modifier(struct parsed_symbol *sym, const char **ret, const char **ptr_modif)
{ {
switch (ch) *ptr_modif = NULL;
if (*sym->current == 'E')
{
*ptr_modif = "__ptr64";
sym->current++;
}
switch (*sym->current++)
{ {
case 'A': *ret = NULL; break; case 'A': *ret = NULL; break;
case 'B': *ret = "const"; break; case 'B': *ret = "const"; break;
...@@ -436,20 +442,27 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym, ...@@ -436,20 +442,27 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
{ {
const char* modifier; const char* modifier;
const char* str_modif; const char* str_modif;
const char *ptr_modif = "";
if (*sym->current == 'E')
{
ptr_modif = " __ptr64";
sym->current++;
}
switch (modif) switch (modif)
{ {
case 'A': str_modif = " &"; break; case 'A': str_modif = str_printf(sym, " &%s", ptr_modif); break;
case 'B': str_modif = " & volatile"; break; case 'B': str_modif = str_printf(sym, " &%s volatile", ptr_modif); break;
case 'P': str_modif = " *"; break; case 'P': str_modif = str_printf(sym, " *%s", ptr_modif); break;
case 'Q': str_modif = " * const"; break; case 'Q': str_modif = str_printf(sym, " *%s const", ptr_modif); break;
case 'R': str_modif = " * volatile"; break; case 'R': str_modif = str_printf(sym, " *%s volatile", ptr_modif); break;
case 'S': str_modif = " * const volatile"; break; case 'S': str_modif = str_printf(sym, " *%s const volatile", ptr_modif); break;
case '?': str_modif = ""; break; case '?': str_modif = ""; break;
default: return FALSE; default: return FALSE;
} }
if (get_modifier(*sym->current++, &modifier)) if (get_modifier(sym, &modifier, &ptr_modif))
{ {
unsigned mark = sym->stack.num; unsigned mark = sym->stack.num;
struct datatype_t sub_ct; struct datatype_t sub_ct;
...@@ -924,10 +937,10 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, ...@@ -924,10 +937,10 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
case '$': case '$':
if (*sym->current == 'C') if (*sym->current == 'C')
{ {
const char* ptr; const char *ptr, *ptr_modif;
sym->current++; sym->current++;
if (!get_modifier(*sym->current++, &ptr)) goto done; if (!get_modifier(sym, &ptr, &ptr_modif)) goto done;
if (!demangle_datatype(sym, ct, pmt_ref, in_args)) goto done; if (!demangle_datatype(sym, ct, pmt_ref, in_args)) goto done;
ct->left = str_printf(sym, "%s %s", ct->left, ptr); ct->left = str_printf(sym, "%s %s", ct->left, ptr);
} }
...@@ -960,6 +973,7 @@ static BOOL handle_data(struct parsed_symbol* sym) ...@@ -960,6 +973,7 @@ static BOOL handle_data(struct parsed_symbol* sym)
const char* access = NULL; const char* access = NULL;
const char* member_type = NULL; const char* member_type = NULL;
const char* modifier = NULL; const char* modifier = NULL;
const char* ptr_modif;
struct datatype_t ct; struct datatype_t ct;
char* name = NULL; char* name = NULL;
BOOL ret = FALSE; BOOL ret = FALSE;
...@@ -1004,14 +1018,16 @@ static BOOL handle_data(struct parsed_symbol* sym) ...@@ -1004,14 +1018,16 @@ static BOOL handle_data(struct parsed_symbol* sym)
str_array_init(&pmt); str_array_init(&pmt);
if (!demangle_datatype(sym, &ct, &pmt, FALSE)) goto done; if (!demangle_datatype(sym, &ct, &pmt, FALSE)) goto done;
if (!get_modifier(*sym->current++, &modifier)) goto done; if (!get_modifier(sym, &modifier, &ptr_modif)) goto done;
if (modifier && ptr_modif) modifier = str_printf(sym, "%s %s", modifier, ptr_modif);
else if (!modifier) modifier = ptr_modif;
sym->stack.num = mark; sym->stack.num = mark;
} }
break; break;
case '6' : /* compiler generated static */ case '6' : /* compiler generated static */
case '7' : /* compiler generated static */ case '7' : /* compiler generated static */
ct.left = ct.right = NULL; ct.left = ct.right = NULL;
if (!get_modifier(*sym->current++, &modifier)) goto done; if (!get_modifier(sym, &modifier, &ptr_modif)) goto done;
if (*sym->current != '@') if (*sym->current != '@')
{ {
char* cls = NULL; char* cls = NULL;
...@@ -1123,10 +1139,11 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) ...@@ -1123,10 +1139,11 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op)
{ {
if (((accmem - 'A') % 8) != 2 && ((accmem - 'A') % 8) != 3) if (((accmem - 'A') % 8) != 2 && ((accmem - 'A') % 8) != 3)
{ {
const char *ptr_modif;
/* Implicit 'this' pointer */ /* Implicit 'this' pointer */
/* If there is an implicit this pointer, const modifier follows */ /* If there is an implicit this pointer, const modifier follows */
if (!get_modifier(*sym->current, &modifier)) goto done; if (!get_modifier(sym, &modifier, &ptr_modif)) goto done;
sym->current++; if (modifier || ptr_modif) modifier = str_printf(sym, "%s %s", modifier, ptr_modif);
} }
} }
...@@ -1164,12 +1181,11 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) ...@@ -1164,12 +1181,11 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op)
/* Note: '()' after 'Z' means 'throws', but we don't care here /* Note: '()' after 'Z' means 'throws', but we don't care here
* Yet!!! FIXME * Yet!!! FIXME
*/ */
sym->result = str_printf(sym, "%s%s%s%s%s%s%s%s%s%s%s%s", sym->result = str_printf(sym, "%s%s%s%s%s%s%s%s%s%s%s",
access, member_type, ct_ret.left, access, member_type, ct_ret.left,
(ct_ret.left && !ct_ret.right) ? " " : NULL, (ct_ret.left && !ct_ret.right) ? " " : NULL,
call_conv, call_conv ? " " : NULL, exported, call_conv, call_conv ? " " : NULL, exported,
name, args_str, modifier, name, args_str, modifier, ct_ret.right);
modifier ? " " : NULL, ct_ret.right);
ret = TRUE; ret = TRUE;
done: done:
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment