From: Ulrich Weigand Date: Mon, 29 Jun 2009 17:33:32 +0000 (+0000) Subject: * ada-lang.h (ada_convert_actual): Add GDBARCH argument. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a399546aa148a7a7767dce7d17ef1a87906f47d;p=binutils-gdb.git * ada-lang.h (ada_convert_actual): Add GDBARCH argument. * ada-lang.c (convert_actual): Remove stale prototype. (ensure_lval, make_array_descriptor, ada_convert_actual): Add GDBARCH argument and pass through to subroutine calls. (ensure_lval): Use GDBARCH instead of current_gdbarch. * infcall.c (value_arg_coerce): Update ada_convert_actual call. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f29c3fc1ad5..18832c62905 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-06-29 Ulrich Weigand + + * ada-lang.h (ada_convert_actual): Add GDBARCH argument. + * ada-lang.c (convert_actual): Remove stale prototype. + (ensure_lval, make_array_descriptor, ada_convert_actual): + Add GDBARCH argument and pass through to subroutine calls. + (ensure_lval): Use GDBARCH instead of current_gdbarch. + * infcall.c (value_arg_coerce): Update ada_convert_actual call. + 2009-06-29 Ulrich Weigand * ada-lang.c (resolve): Use per-architecture void type instead diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9519ba82da9..520b4013630 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -101,13 +101,11 @@ static int ada_type_match (struct type *, struct type *, int); static int ada_args_match (struct symbol *, struct value **, int); -static struct value *ensure_lval (struct value *, CORE_ADDR *); - -static struct value *convert_actual (struct value *, struct type *, - CORE_ADDR *); +static struct value *ensure_lval (struct value *, + struct gdbarch *, CORE_ADDR *); static struct value *make_array_descriptor (struct type *, struct value *, - CORE_ADDR *); + struct gdbarch *, CORE_ADDR *); static void ada_add_block_symbols (struct obstack *, struct block *, const char *, @@ -3729,7 +3727,7 @@ parse_old_style_renaming (struct type *type, returning an lvalue whose value_address points to the copy. */ static struct value * -ensure_lval (struct value *val, CORE_ADDR *sp) +ensure_lval (struct value *val, struct gdbarch *gdbarch, CORE_ADDR *sp) { if (! VALUE_LVAL (val)) { @@ -3738,25 +3736,25 @@ ensure_lval (struct value *val, CORE_ADDR *sp) /* The following is taken from the structure-return code in call_function_by_hand. FIXME: Therefore, some refactoring seems indicated. */ - if (gdbarch_inner_than (current_gdbarch, 1, 2)) + if (gdbarch_inner_than (gdbarch, 1, 2)) { /* Stack grows downward. Align SP and value_address (val) after reserving sufficient space. */ *sp -= len; - if (gdbarch_frame_align_p (current_gdbarch)) - *sp = gdbarch_frame_align (current_gdbarch, *sp); + if (gdbarch_frame_align_p (gdbarch)) + *sp = gdbarch_frame_align (gdbarch, *sp); set_value_address (val, *sp); } else { /* Stack grows upward. Align the frame, allocate space, and then again, re-align the frame. */ - if (gdbarch_frame_align_p (current_gdbarch)) - *sp = gdbarch_frame_align (current_gdbarch, *sp); + if (gdbarch_frame_align_p (gdbarch)) + *sp = gdbarch_frame_align (gdbarch, *sp); set_value_address (val, *sp); *sp += len; - if (gdbarch_frame_align_p (current_gdbarch)) - *sp = gdbarch_frame_align (current_gdbarch, *sp); + if (gdbarch_frame_align_p (gdbarch)) + *sp = gdbarch_frame_align (gdbarch, *sp); } VALUE_LVAL (val) = lval_memory; @@ -3773,7 +3771,7 @@ ensure_lval (struct value *val, CORE_ADDR *sp) struct value * ada_convert_actual (struct value *actual, struct type *formal_type0, - CORE_ADDR *sp) + struct gdbarch *gdbarch, CORE_ADDR *sp) { struct type *actual_type = ada_check_typedef (value_type (actual)); struct type *formal_type = ada_check_typedef (formal_type0); @@ -3786,7 +3784,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0, if (ada_is_array_descriptor_type (formal_target) && TYPE_CODE (actual_target) == TYPE_CODE_ARRAY) - return make_array_descriptor (formal_type, actual, sp); + return make_array_descriptor (formal_type, actual, gdbarch, sp); else if (TYPE_CODE (formal_type) == TYPE_CODE_PTR || TYPE_CODE (formal_type) == TYPE_CODE_REF) { @@ -3804,7 +3802,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0, memcpy ((char *) value_contents_raw (val), (char *) value_contents (actual), TYPE_LENGTH (actual_type)); - actual = ensure_lval (val, sp); + actual = ensure_lval (val, gdbarch, sp); } result = value_addr (actual); } @@ -3826,7 +3824,8 @@ ada_convert_actual (struct value *actual, struct type *formal_type0, representing a pointer to this descriptor. */ static struct value * -make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp) +make_array_descriptor (struct type *type, struct value *arr, + struct gdbarch *gdbarch, CORE_ADDR *sp) { struct type *bounds_type = desc_bounds_type (type); struct type *desc_type = desc_base_type (type); @@ -3846,10 +3845,10 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp) desc_bound_bitsize (bounds_type, i, 1)); } - bounds = ensure_lval (bounds, sp); + bounds = ensure_lval (bounds, gdbarch, sp); modify_general_field (value_contents_writeable (descriptor), - value_address (ensure_lval (arr, sp)), + value_address (ensure_lval (arr, gdbarch, sp)), fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitsize (desc_type)); @@ -3858,7 +3857,7 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp) fat_pntr_bounds_bitpos (desc_type), fat_pntr_bounds_bitsize (desc_type)); - descriptor = ensure_lval (descriptor, sp); + descriptor = ensure_lval (descriptor, gdbarch, sp); if (TYPE_CODE (type) == TYPE_CODE_PTR) return value_addr (descriptor); diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index eebe062e086..c314867ba1a 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -265,6 +265,7 @@ extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *, struct value *ada_convert_actual (struct value *actual, struct type *formal_type0, + struct gdbarch *gdbarch, CORE_ADDR *sp); extern struct value *ada_value_subscript (struct value *, int, diff --git a/gdb/infcall.c b/gdb/infcall.c index 584fdeb0a06..e364f01da68 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -142,7 +142,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, /* Perform any Ada-specific coercion first. */ if (current_language->la_language == language_ada) - arg = ada_convert_actual (arg, type, sp); + arg = ada_convert_actual (arg, type, gdbarch, sp); /* Force the value to the target if we will need its address. At this point, we could allocate arguments on the stack instead of