winedump: Dump calling convention attributes for CodeView.

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:48 +02:00 committed by Alexandre Julliard
parent 1d9c8846b9
commit a9c552fe7f
4 changed files with 60 additions and 15 deletions

View File

@ -1288,7 +1288,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
break;
case LF_PROCEDURE_V1:
symt = codeview_new_func_signature(ctp, existing, type->procedure_v1.call);
symt = codeview_new_func_signature(ctp, existing, type->procedure_v1.callconv);
if (details)
{
codeview_add_type(curr_type, symt);
@ -1299,7 +1299,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
}
break;
case LF_PROCEDURE_V2:
symt = codeview_new_func_signature(ctp, existing,type->procedure_v2.call);
symt = codeview_new_func_signature(ctp, existing,type->procedure_v2.callconv);
if (details)
{
codeview_add_type(curr_type, symt);
@ -1314,7 +1314,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
/* FIXME: for C++, this is plain wrong, but as we don't use arg types
* nor class information, this would just do for now
*/
symt = codeview_new_func_signature(ctp, existing, type->mfunction_v1.call);
symt = codeview_new_func_signature(ctp, existing, type->mfunction_v1.callconv);
if (details)
{
codeview_add_type(curr_type, symt);
@ -1328,7 +1328,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
/* FIXME: for C++, this is plain wrong, but as we don't use arg types
* nor class information, this would just do for now
*/
symt = codeview_new_func_signature(ctp, existing, type->mfunction_v2.call);
symt = codeview_new_func_signature(ctp, existing, type->mfunction_v2.callconv);
if (details)
{
codeview_add_type(curr_type, symt);

View File

@ -720,6 +720,9 @@ typedef enum CV_call_e
CV_CALL_TRICALL,
CV_CALL_SH5CALL,
CV_CALL_M32RCALL,
CV_CALL_CLRCALL,
CV_CALL_INLINE,
CV_CALL_NEAR_VECTOR,
CV_CALL_RESERVED,
} CV_call_e;

View File

@ -308,7 +308,7 @@ union codeview_type
unsigned short int len;
short int id;
unsigned short int rvtype;
unsigned char call;
unsigned char callconv;
unsigned char funcattr;
unsigned short int params;
unsigned short int arglist;
@ -319,7 +319,7 @@ union codeview_type
unsigned short int len;
short int id;
unsigned int rvtype;
unsigned char call;
unsigned char callconv;
unsigned char funcattr;
unsigned short int params;
unsigned int arglist;
@ -332,7 +332,7 @@ union codeview_type
unsigned short int rvtype;
unsigned short int class_type;
unsigned short int this_type;
unsigned char call;
unsigned char callconv;
unsigned char funcattr;
unsigned short int params;
unsigned short int arglist;
@ -346,7 +346,7 @@ union codeview_type
unsigned int rvtype;
unsigned int class_type;
unsigned this_type;
unsigned char call;
unsigned char callconv;
unsigned char funcattr;
unsigned short params;
unsigned int arglist;

View File

@ -410,6 +410,49 @@ static const char* get_language(unsigned l)
return lang;
}
static const char* get_callconv(unsigned cc)
{
const char* callconv;
switch (cc)
{
case CV_CALL_NEAR_C: callconv = "near C"; break;
case CV_CALL_FAR_C: callconv = "far C"; break;
case CV_CALL_NEAR_PASCAL: callconv = "near pascal"; break;
case CV_CALL_FAR_PASCAL: callconv = "far pascal"; break;
case CV_CALL_NEAR_FAST: callconv = "near fast"; break;
case CV_CALL_FAR_FAST: callconv = "far fast"; break;
case CV_CALL_SKIPPED: callconv = "skipped"; break;
case CV_CALL_NEAR_STD: callconv = "near std"; break;
case CV_CALL_FAR_STD: callconv = "far std"; break;
case CV_CALL_NEAR_SYS: callconv = "near sys"; break;
case CV_CALL_FAR_SYS: callconv = "far sys"; break;
case CV_CALL_THISCALL: callconv = "this call"; break;
case CV_CALL_MIPSCALL: callconv = "mips call"; break;
case CV_CALL_GENERIC: callconv = "generic"; break;
case CV_CALL_ALPHACALL: callconv = "alpha call"; break;
case CV_CALL_PPCCALL: callconv = "ppc call"; break;
case CV_CALL_SHCALL: callconv = "sh call"; break;
case CV_CALL_ARMCALL: callconv = "arm call"; break;
case CV_CALL_AM33CALL: callconv = "am33 call"; break;
case CV_CALL_TRICALL: callconv = "tri call"; break;
case CV_CALL_SH5CALL: callconv = "sh5 call"; break;
case CV_CALL_M32RCALL: callconv = "m32r call"; break;
case CV_CALL_CLRCALL: callconv = "clr call"; break;
case CV_CALL_INLINE: callconv = "inline"; break;
case CV_CALL_NEAR_VECTOR: callconv = "near vector"; break;
case CV_CALL_RESERVED: callconv = "reserved"; break;
default:
{
static char tmp[16];
sprintf(tmp, "callconv=%x", cc);
callconv = tmp;
}
break;
}
return callconv;
}
static void do_field(const unsigned char* start, const unsigned char* end)
{
/*
@ -883,26 +926,25 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
break;
case LF_PROCEDURE_V1:
/* FIXME: unknown could be the calling convention for the proc */
printf("\t%x => Procedure V1 ret_type:%x call:%x attr:%s (#%u args_type:%x)\n",
printf("\t%x => Procedure V1 ret_type:%x callconv:%s attr:%s (#%u args_type:%x)\n",
curr_type, type->procedure_v1.rvtype,
type->procedure_v1.call, get_funcattr(type->procedure_v1.funcattr),
get_callconv(type->procedure_v1.callconv), 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 attr:%s (#%u args_type:%x)\n",
printf("\t%x => Procedure V2 ret_type:%x callconv:%s attr:%s (#%u args_type:%x)\n",
curr_type, type->procedure_v2.rvtype,
type->procedure_v2.call, get_funcattr(type->procedure_v2.funcattr),
get_callconv(type->procedure_v2.callconv), get_funcattr(type->procedure_v1.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 attr:%s\n"
printf("\t%x => MFunction V2 ret-type:%x callconv:%s 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,
get_callconv(type->mfunction_v2.callconv),
type->mfunction_v2.class_type,
type->mfunction_v2.this_type,
get_funcattr(type->mfunction_v2.funcattr),