In dlls/dbghelp/dwarf.c, there is this snippet of code which appears to hard-code the calling convention to CALL_FAR_C. Does Wine not support reporting a function's calling convention correctly then? Is it a limitation of DWARF or just that it is not implemented? I can see that DWARF has a DW_AT_calling_convention field but when I examine a Wine DLL with objdump, it does not show this field in use.
/* FIXME: assuming C source code */ sig_type = symt_new_function_signature(ctx->module, ret_type, CV_CALL_FAR_C);
Thanks Roger
that's a limitation of dwarf format (IIRC, from the specs, you have either the default CC for your programming language/ABI, or a specific one without defining it further) FYII, the codeview format reports correctly this information note also that winedbg doesn't support calling functions in the debuggee, so this information is actually not used in winedbg A+
2012/6/6, Roger Cruz roger_r_cruz@yahoo.com:
In dlls/dbghelp/dwarf.c, there is this snippet of code which appears to hard-code the calling convention to CALL_FAR_C. Does Wine not support reporting a function's calling convention correctly then? Is it a limitation of DWARF or just that it is not implemented? I can see that DWARF has a DW_AT_calling_convention field but when I examine a Wine DLL with objdump, it does not show this field in use.
/* FIXME: assuming C source code */ sig_type = symt_new_function_signature(ctx->module, ret_type,
CV_CALL_FAR_C);
Thanks Roger
Hi Eric,
Thanks for replying. I saw that in the DWARF spec and I was afraid that DWARF may not provide detailed Info. But I also read in the spec that the compilers use a DWARF extension feature to convey additional info such as calling convention for each routine. Is there a way to coax GCC to output that information? Maybe thru a target plugin?
Thanks Roger
On Jun 6, 2012, at 3:06 AM, Eric Pouech eric.pouech@orange.fr wrote:
that's a limitation of dwarf format (IIRC, from the specs, you have either the default CC for your programming language/ABI, or a specific one without defining it further) FYII, the codeview format reports correctly this information note also that winedbg doesn't support calling functions in the debuggee, so this information is actually not used in winedbg A+
2012/6/6, Roger Cruz roger_r_cruz@yahoo.com:
In dlls/dbghelp/dwarf.c, there is this snippet of code which appears to hard-code the calling convention to CALL_FAR_C. Does Wine not support reporting a function's calling convention correctly then? Is it a limitation of DWARF or just that it is not implemented? I can see that DWARF has a DW_AT_calling_convention field but when I examine a Wine DLL with objdump, it does not show this field in use.
/* FIXME: assuming C source code */ sig_type = symt_new_function_signature(ctx->module, ret_type, CV_CALL_FAR_C);
Thanks Roger
--
Eric Pouech
dwarf4 allows each compiler vendor to add its own range of CC values in the DW_AT_calling_convention field. this means that the vendor must create its own table for mapping each used CC to a given value. from a wine standpoint, the list should be rather small (stdcall, fastcall...) (on top of cdecl of course) (assuming old 16bit code is out of the game)
AFAIK, gcc only uses those extensions for very dedicated usage (pascal compiler...). I don't see any reason why one couldn't extend gcc to do it, but I cannot tell how complex it will be (and if plugins provide the relevant interface to do so). HTH A+
2012/6/6, Roger Cruz roger_r_cruz@yahoo.com:
Hi Eric,
Thanks for replying. I saw that in the DWARF spec and I was afraid that DWARF may not provide detailed Info. But I also read in the spec that the compilers use a DWARF extension feature to convey additional info such as calling convention for each routine. Is there a way to coax GCC to output that information? Maybe thru a target plugin?
A previous google search did show up someone modifying GCC to add that level of CC info for another architecture so I'm sure it is something that we can do for x86. I don't know how complex it would be either. I was hoping it was already done and it was just a matter of a compiler flag. I guess one more research task for me :-) Regards, Roger
________________________________ From: Eric Pouech eric.pouech@orange.fr To: Roger Cruz roger_r_cruz@yahoo.com Cc: Wine Devel wine-devel@winehq.org Sent: Wednesday, June 6, 2012 8:12 AM Subject: Re: Wine's support for reporting calling conventions
dwarf4 allows each compiler vendor to add its own range of CC values in the DW_AT_calling_convention field. this means that the vendor must create its own table for mapping each used CC to a given value. from a wine standpoint, the list should be rather small (stdcall, fastcall...) (on top of cdecl of course) (assuming old 16bit code is out of the game)
AFAIK, gcc only uses those extensions for very dedicated usage (pascal compiler...). I don't see any reason why one couldn't extend gcc to do it, but I cannot tell how complex it will be (and if plugins provide the relevant interface to do so). HTH A+
2012/6/6, Roger Cruz roger_r_cruz@yahoo.com:
Hi Eric,
Thanks for replying. I saw that in the DWARF spec and I was afraid that DWARF may not provide detailed Info. But I also read in the spec that the compilers use a DWARF extension feature to convey additional info such as calling convention for each routine. Is there a way to coax GCC to output that information? Maybe thru a target plugin?
On 06 Jun 2012, at 09:06, Eric Pouech wrote:
that's a limitation of dwarf format (IIRC, from the specs, you have either the default CC for your programming language/ABI, or a specific one without defining it further)
Yes and no: * the DWARF standard itself does not specify any calling conventions other than DW_CC_normal (ABI default), DW_CC_program (Fortran-specific) and DW_CC_nocall (e.g. for interrupt handlers) * however, the DWARF standard allows implementation-defined specific calling conventions to be added. I'm not aware of many that have been defined like that already, but a couple of them have been. E.g., search for DW_CC_ in http://gcc.gnu.org/svn/gcc/trunk/include/dwarf2.h . You need tool chain support (usually compiler support) to be able to generate such custom attributes though.
Jonas