This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Fortran function calls with arguments


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]