winedump: Display function attributes in function/methods codeview records.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-08-21 10:22:42 +02:00 committed by Alexandre Julliard
parent b5b2031078
commit 1d9c8846b9
2 changed files with 31 additions and 11 deletions

View File

@ -309,7 +309,7 @@ union codeview_type
short int id;
unsigned short int rvtype;
unsigned char call;
unsigned char reserved;
unsigned char funcattr;
unsigned short int params;
unsigned short int arglist;
} procedure_v1;
@ -320,7 +320,7 @@ union codeview_type
short int id;
unsigned int rvtype;
unsigned char call;
unsigned char reserved;
unsigned char funcattr;
unsigned short int params;
unsigned int arglist;
} procedure_v2;
@ -333,7 +333,7 @@ union codeview_type
unsigned short int class_type;
unsigned short int this_type;
unsigned char call;
unsigned char reserved;
unsigned char funcattr;
unsigned short int params;
unsigned short int arglist;
unsigned int this_adjust;
@ -347,7 +347,7 @@ union codeview_type
unsigned int class_type;
unsigned this_type;
unsigned char call;
unsigned char reserved;
unsigned char funcattr;
unsigned short params;
unsigned int arglist;
unsigned int this_adjust;

View File

@ -265,6 +265,25 @@ static const char* get_property(unsigned prop)
return tmp;
}
static const char* get_funcattr(unsigned attr)
{
static char tmp[1024];
unsigned pos = 0;
if (!attr) return "none";
#define X(s) {if (pos) tmp[pos++] = ';'; strcpy(tmp + pos, s); pos += strlen(s);}
if (attr & 0x0001) X("C++ReturnUDT");
if (attr & 0x0002) X("Ctor");
if (attr & 0x0004) X("Ctor-w/virtualbase");
if (attr & 0xfff8) pos += sprintf(tmp, "unk:%x", attr & 0xfff8);
#undef X
tmp[pos] = '\0';
assert(pos < sizeof(tmp));
return tmp;
}
static const char* get_machine(unsigned m)
{
const char* machine;
@ -865,27 +884,28 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_PROCEDURE_V1:
/* FIXME: unknown could be the calling convention for the proc */
printf("\t%x => Procedure V1 ret_type:%x call:%x (#%u args_type:%x)\n",
printf("\t%x => Procedure V1 ret_type:%x call:%x attr:%s (#%u args_type:%x)\n",
curr_type, type->procedure_v1.rvtype,
type->procedure_v1.call, type->procedure_v1.params,
type->procedure_v1.arglist);
type->procedure_v1.call, get_funcattr(type->procedure_v1.funcattr),
type->procedure_v1.params, type->procedure_v1.arglist);
break;
case LF_PROCEDURE_V2:
printf("\t%x => Procedure V2 ret_type:%x unk:%x (#%u args_type:%x)\n",
printf("\t%x => Procedure V2 ret_type:%x unk:%x attr:%s (#%u args_type:%x)\n",
curr_type, type->procedure_v2.rvtype,
type->procedure_v2.call, type->procedure_v2.params,
type->procedure_v2.arglist);
type->procedure_v2.call, get_funcattr(type->procedure_v2.funcattr),
type->procedure_v2.params, type->procedure_v2.arglist);
break;
case LF_MFUNCTION_V2:
printf("\t%x => MFunction V2 ret-type:%x call:%x class-type:%x this-type:%x\n"
printf("\t%x => MFunction V2 ret-type:%x call:%x class-type:%x this-type:%x attr:%s\n"
"\t\t#args:%x args-type:%x this_adjust:%x\n",
curr_type,
type->mfunction_v2.rvtype,
type->mfunction_v2.call,
type->mfunction_v2.class_type,
type->mfunction_v2.this_type,
get_funcattr(type->mfunction_v2.funcattr),
type->mfunction_v2.params,
type->mfunction_v2.arglist,
type->mfunction_v2.this_adjust);