aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-01-08 19:28:09 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-01-08 19:28:09 +0000
commita93c0eb6957e86a30b624c0fb097f9370ea56e9c (patch)
tree76f6e7f536cd5ca047d27674ab673b98520ac797
parent88e2547f139cd37f679460bac0e3ab94feef2533 (diff)
downloadgdb-a93c0eb6957e86a30b624c0fb097f9370ea56e9c.zip
gdb-a93c0eb6957e86a30b624c0fb097f9370ea56e9c.tar.gz
gdb-a93c0eb6957e86a30b624c0fb097f9370ea56e9c.tar.bz2
* ada-lang.c (ada_convert_actual): Renames convert_actual.
Make non-static. (ada_convert_actuals): Delete. * ada-lang.h (ada_convert_actual): Add declaration. (ada_convert_actuals): Remove declaration. * infcall.c: #include "ada-lang.h". (value_arg_coerce): Add new parameter sp. Update function documetnation. Add handling of Ada function call parameters. * Makefile.in (infcall.o): Update dependencies.
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/ada-lang.c30
-rw-r--r--gdb/ada-lang.h5
-rw-r--r--gdb/infcall.c15
5 files changed, 30 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b1a2c92..07344d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2008-01-08 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (ada_convert_actual): Renames convert_actual.
+ Make non-static.
+ (ada_convert_actuals): Delete.
+ * ada-lang.h (ada_convert_actual): Add declaration.
+ (ada_convert_actuals): Remove declaration.
+ * infcall.c: #include "ada-lang.h".
+ (value_arg_coerce): Add new parameter sp. Update function
+ documetnation. Add handling of Ada function call parameters.
+ * Makefile.in (infcall.o): Update dependencies.
+
2008-01-08 Paul Hilfinger <hilfinger@adacore.com>
* ada-lang.c (ensure_lval): Fix value lval kind.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45c3d29..3cdb41b 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2272,7 +2272,7 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \
$(inferior_h) $(gdb_assert_h) $(block_h) $(gdbcore_h) $(language_h) \
$(objfiles_h) $(gdbcmd_h) $(command_h) $(gdb_string_h) $(infcall_h) \
- $(dummy_frame_h)
+ $(dummy_frame_h) $(ada_lang_h)
inf-child.o: inf-child.c $(defs_h) $(regcache_h) $(memattr_h) $(symtab_h) \
$(target_h) $(inferior_h) $(gdb_string_h)
infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2d1ce2f..49da2ec 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3835,9 +3835,9 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
allocating any necessary descriptors (fat pointers), or copies of
values not residing in memory, updating it as needed. */
-static struct value *
-convert_actual (struct value *actual, struct type *formal_type0,
- CORE_ADDR *sp)
+struct value *
+ada_convert_actual (struct value *actual, struct type *formal_type0,
+ CORE_ADDR *sp)
{
struct type *actual_type = ada_check_typedef (value_type (actual));
struct type *formal_type = ada_check_typedef (formal_type0);
@@ -3929,30 +3929,6 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
else
return descriptor;
}
-
-
-/* Assuming a dummy frame has been established on the target, perform any
- conversions needed for calling function FUNC on the NARGS actual
- parameters in ARGS, other than standard C conversions. Does
- nothing if FUNC does not have Ada-style prototype data, or if NARGS
- does not match the number of arguments expected. Use *SP as a
- stack pointer for additional data that must be pushed, updating its
- value as needed. */
-
-void
-ada_convert_actuals (struct value *func, int nargs, struct value *args[],
- CORE_ADDR *sp)
-{
- int i;
-
- if (TYPE_NFIELDS (value_type (func)) == 0
- || nargs != TYPE_NFIELDS (value_type (func)))
- return;
-
- for (i = 0; i < nargs; i += 1)
- args[i] =
- convert_actual (args[i], TYPE_FIELD_TYPE (value_type (func), i), sp);
-}
/* Dummy definitions for an experimental caching module that is not
* used in the public sources. */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index ed56583..515f698 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -278,8 +278,9 @@ extern void ada_printchar (int, struct ui_file *);
extern void ada_printstr (struct ui_file *, const gdb_byte *,
unsigned int, int, int);
-extern void ada_convert_actuals (struct value *, int, struct value **,
- CORE_ADDR *);
+struct value *ada_convert_actual (struct value *actual,
+ struct type *formal_type0,
+ CORE_ADDR *sp);
extern struct value *ada_value_subscript (struct value *, int,
struct value **);
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 82130c6..9242c46 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -34,6 +34,7 @@
#include "gdb_string.h"
#include "infcall.h"
#include "dummy-frame.h"
+#include "ada-lang.h"
/* NOTE: cagney/2003-04-16: What's the future of this code?
@@ -91,19 +92,25 @@ Unwinding of stack if a signal is received while in a call dummy is %s.\n"),
/* Perform the standard coercions that are specified
- for arguments to be passed to C functions.
+ for arguments to be passed to C or Ada functions.
If PARAM_TYPE is non-NULL, it is the expected parameter type.
- IS_PROTOTYPED is non-zero if the function declaration is prototyped. */
+ IS_PROTOTYPED is non-zero if the function declaration is prototyped.
+ SP is the stack pointer were additional data can be pushed (updating
+ its value as needed). */
static struct value *
value_arg_coerce (struct value *arg, struct type *param_type,
- int is_prototyped)
+ int is_prototyped, CORE_ADDR *sp)
{
struct type *arg_type = check_typedef (value_type (arg));
struct type *type
= param_type ? check_typedef (param_type) : arg_type;
+ /* Perform any Ada-specific coercion first. */
+ if (current_language->la_language == language_ada)
+ arg = ada_convert_actual (arg, type, sp);
+
switch (TYPE_CODE (type))
{
case TYPE_CODE_REF:
@@ -577,7 +584,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
else
param_type = NULL;
- args[i] = value_arg_coerce (args[i], param_type, prototyped);
+ args[i] = value_arg_coerce (args[i], param_type, prototyped, &sp);
if (param_type != NULL && language_pass_by_reference (param_type))
args[i] = value_addr (args[i]);