[RFA] Need post-processing of parameters for function calls in Ada

Daniel Jacobowitz drow@false.org
Tue Jan 8 15:37:00 GMT 2008


On Tue, Jan 08, 2008 at 07:29:00AM -0800, Joel Brobecker wrote:
> I don't think we'll need to move the argument coercion phase...
> 
> > This might allow a useful option, to avoid calling malloc when passing
> > strings to a C function.  We can not do that in general, since the
> > function might save the pointer, but there are some cases (like strcmp).
> 
> ... unless that is needed to allow calling malloc. But this can be
> discussed independently, if you prefer.

You're right.  I misread the code; sp is already properly set up by
this point.

> I agree. I propose the following:
> 
>   - Add a new la_value_arg_coerce method in the language vector.
>     The prototype would be identical to the current value_arg_coerce
>     but with the added SP.
> 
>   - rename value_arg_coerce c_value_arg_coerce. Possibly move it to
>     c-lang.
>   
>   - Make all languages use c_value_arg_coerce, except for Ada, which
>     would use our own coerce routine.
> 
> That should take care of everything (except maybe allowing malloc
> calls).
> 
> My only concern is that the Ada coerce might be relying on the C coerce
> routine to handle the simple cases. So I might need to call the C coerce
> routine at the end of the Ada coerce routine. I need to look deeper
> into this.

Does the existing routine do anything inappropriate for Ada?  I
suspect it is appropriate for all languages, and we can call a
language-specific routine in addition to it.  But if it does anything
you'd rather it didn't, then we should let Ada avoid it.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list