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]

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


Hello,

Currently, calling an Ada function that takes an array does not work.
Let's take an example that uses a String:

    (gdb) call call_me ("bonjour")
    Invalid cast.

The problem in our case is that there are many different possible
representations for an array, and the representation that is passed
during the function call does not match what the function expects.
So we try a conversion and kaboum!

Because the conversion is so Ada specific (conversion from one form
of array to another), the conversion needs to be performed by the
Ada language.  The attached patch adds a call to ada_convert_actuals()
inside call_function_by_hand when doing the call in Ada.  We need
to do the conversion there rather than ahead of calling call_function_
by_hand because some conversions need to allocate some memory in
the inferior, and we do it in the stack area that this function sets up.

2008-01-08  Joel Brobecker  <brobecker@adacore.com>

        * infcall.c: #include "ada-lang.h".
        (call_function_by_hand): Add post processing of function arguments
        for Ada function calls.
        * Makefile.in (infcall.o): Update dependencies.

I was able to write a testcase that reproduces the problem:

2008-01-08  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/arrayparam: New test program.
        * gdb.ada/arrayparam.exp: New testcase.

Tested on x86-linux, no regression.
OK to commit?

Thanks,
-- 
Joel

Attachment: arrayparam.diff
Description: Text document

Attachment: arrayparam-tc.diff
Description: Text document


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