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: [RFA] Need post-processing of parameters for function calls in Ada


Thanks muchly for the quick feedback!

> Is this an argument coercion?  The right place may be
> value_arg_coerce.

Indeed. It looks like the two functions are doing the same thing,
but for different languages.

> If the only problem is that you need the sp, we
> could supply it to that function and move the coercion after the stack
> frame setup.  I don't think this will be a problem even if we need a
> function call during argument coercion.

(funny that you're talking about function call during argument coercion,
that will be my next patch which I just finished ;-).

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.

> Really this sort of thing ought to go through the language vector, but
> I'm happy leaving that until a second language needs it.

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.

What do you think?

Thanks,
-- 
Joel


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