Alexandre Julliard : msvcrt: Add support for __ptr64 attribute in symbol demangling.
Alexandre Julliard
julliard at winehq.org
Mon May 16 11:36:45 CDT 2011
Module: wine
Branch: master
Commit: 5e1b9c149eb88ba87238e49e079824d89c9bd131
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e1b9c149eb88ba87238e49e079824d89c9bd131
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat May 14 14:11:50 2011 +0200
msvcrt: Add support for __ptr64 attribute in symbol demangling.
---
dlls/msvcrt/tests/cpp.c | 2 +
dlls/msvcrt/undname.c | 54 ++++++++++++++++++++++++++++++----------------
2 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c
index dfb2cd7..b4eb515 100644
--- a/dlls/msvcrt/tests/cpp.c
+++ b/dlls/msvcrt/tests/cpp.c
@@ -1051,6 +1051,8 @@ static void test_demangle(void)
/* 116 */ {"?vswprintf@@YAHPAGIPBGPAD at Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
/* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD at 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 *,...)"},
+/* 119 */ {"??Xstd@@YAAEAV?$complex at M@0 at AEAV10@AEBV10@@Z", "class std::complex<float> & __ptr64 __cdecl std::operator*=(class std::complex<float> & __ptr64,class std::complex<float> const & __ptr64)"},
+/* 120 */ {"?_Doraise at bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)const __ptr64"},
};
int i, num_test = (sizeof(test)/sizeof(test[0]));
diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c
index 920a763..8ed0757 100644
--- a/dlls/msvcrt/undname.c
+++ b/dlls/msvcrt/undname.c
@@ -416,11 +416,17 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t
/******************************************************************
* 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 'B': *ret = "const"; break;
@@ -436,20 +442,27 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
{
const char* modifier;
const char* str_modif;
+ const char *ptr_modif = "";
+
+ if (*sym->current == 'E')
+ {
+ ptr_modif = " __ptr64";
+ sym->current++;
+ }
switch (modif)
{
- case 'A': str_modif = " &"; break;
- case 'B': str_modif = " & volatile"; break;
- case 'P': str_modif = " *"; break;
- case 'Q': str_modif = " * const"; break;
- case 'R': str_modif = " * volatile"; break;
- case 'S': str_modif = " * const volatile"; break;
+ case 'A': str_modif = str_printf(sym, " &%s", ptr_modif); break;
+ case 'B': str_modif = str_printf(sym, " &%s volatile", ptr_modif); break;
+ case 'P': str_modif = str_printf(sym, " *%s", ptr_modif); break;
+ case 'Q': str_modif = str_printf(sym, " *%s const", ptr_modif); break;
+ case 'R': str_modif = str_printf(sym, " *%s volatile", ptr_modif); break;
+ case 'S': str_modif = str_printf(sym, " *%s const volatile", ptr_modif); break;
case '?': str_modif = ""; break;
default: return FALSE;
}
- if (get_modifier(*sym->current++, &modifier))
+ if (get_modifier(sym, &modifier, &ptr_modif))
{
unsigned mark = sym->stack.num;
struct datatype_t sub_ct;
@@ -924,10 +937,10 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
case '$':
if (*sym->current == 'C')
{
- const char* ptr;
+ const char *ptr, *ptr_modif;
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;
ct->left = str_printf(sym, "%s %s", ct->left, ptr);
}
@@ -960,6 +973,7 @@ static BOOL handle_data(struct parsed_symbol* sym)
const char* access = NULL;
const char* member_type = NULL;
const char* modifier = NULL;
+ const char* ptr_modif;
struct datatype_t ct;
char* name = NULL;
BOOL ret = FALSE;
@@ -1004,14 +1018,16 @@ static BOOL handle_data(struct parsed_symbol* sym)
str_array_init(&pmt);
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;
}
break;
case '6' : /* compiler generated static */
case '7' : /* compiler generated static */
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 != '@')
{
char* cls = NULL;
@@ -1123,10 +1139,11 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op)
{
if (((accmem - 'A') % 8) != 2 && ((accmem - 'A') % 8) != 3)
{
+ const char *ptr_modif;
/* Implicit 'this' pointer */
/* If there is an implicit this pointer, const modifier follows */
- if (!get_modifier(*sym->current, &modifier)) goto done;
- sym->current++;
+ if (!get_modifier(sym, &modifier, &ptr_modif)) goto done;
+ 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)
/* Note: '()' after 'Z' means 'throws', but we don't care here
* 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,
(ct_ret.left && !ct_ret.right) ? " " : NULL,
call_conv, call_conv ? " " : NULL, exported,
- name, args_str, modifier,
- modifier ? " " : NULL, ct_ret.right);
+ name, args_str, modifier, ct_ret.right);
ret = TRUE;
done:
return ret;
More information about the wine-cvs
mailing list