This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Fortran function calls with arguments
- From: Tom Tromey <tom at tromey dot com>
- To: Richard Bunt <Richard dot Bunt at arm dot com>
- Cc: "gdb-patches\@sourceware.org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Wed, 13 Feb 2019 14:24:22 -0700
- Subject: Re: [PATCH v2] Fortran function calls with arguments
- References: <57a95dca-d3cf-d1d3-eba1-7e58f73fa918@arm.com>
>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes:
Richard> It is possible to call Fortran functions, but memory must be allocated in
Richard> the inferior, so a pointer can be passed to the function, and the
Richard> language must be set to C to enable C-style casting. This is cumbersome
Richard> and not a pleasant debug experience.
Baking in the compiler ABI is unfortunate but I suppose nothing gdb
hasn't done before; and anyway I don't think there's a way to express
this "properly".
Richard> Since the GNU Fortran argument passing convention has been implemented,
Richard> there is no guarantee that this patch will work correctly, in all cases,
Richard> with other compilers.
Do you have any information at all on other compilers, or even whether
older versions of GNU Fortran differ?
Richard> + /* Arguments in Fortran are passed by address. Coerce the
Richard> + arguments here rather than in value_arg_coerce as otherwise
Richard> + the call to malloc to place the non-lvalue parameters in
Richard> + target memory is hit by this Fortran specific logic. This
Richard> + results in malloc being called with a pointer to an integer
Richard> + followed by an attempt to malloc the arguments to malloc in
Richard> + target memory. Infinite recursion ensues. */
Thanks for writing this comment.
Richard> +fortran_argument_convert (struct value *value, const bool is_artificial)
I think the "const" here and in the header can be removed.
It doesn't add much here, and doesn't add anything in the header.
The patch is ok with that change. Thanks for doing this.
Tom