From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6930 invoked by alias); 26 Jun 2009 15:54:23 -0000 Received: (qmail 6919 invoked by uid 22791); 26 Jun 2009 15:54:22 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.17.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Jun 2009 15:54:17 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id n5QFsFVc009706 for ; Fri, 26 Jun 2009 15:54:15 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n5QFsERq3665974 for ; Fri, 26 Jun 2009 17:54:14 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n5QFsEmb030630 for ; Fri, 26 Jun 2009 17:54:14 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n5QFsDgD030625; Fri, 26 Jun 2009 17:54:13 +0200 Message-Id: <200906261554.n5QFsDgD030625@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 26 Jun 2009 17:54:13 +0200 Subject: [rfa/Ada] Remove current_gdbarch from ensure_lval To: brobecker@adacore.com, gdb-patches@sourceware.org Date: Fri, 26 Jun 2009 15:54:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00721.txt.bz2 Hello Joel, this patch doesn't do anything with builtin types, but it removes references to current_gdbarch in ensure_lval. This routine allocates temporary space on the inferior's stack during inferior call argument setup. The patch simply passes the appropriate architecture to use though from infcall.c code, alongside the SP value that is already passed through. Tested on amd64-linux. OK for mainline? Bye, Ulrich ChangeLog: * 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. Index: gdb-head/gdb/ada-lang.c =================================================================== --- gdb-head.orig/gdb/ada-lang.c +++ gdb-head/gdb/ada-lang.c @@ -101,13 +101,11 @@ static int ada_type_match (struct type * 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 *, @@ -3726,7 +3724,7 @@ parse_old_style_renaming (struct type *t 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)) { @@ -3735,25 +3733,25 @@ ensure_lval (struct value *val, CORE_ADD /* 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; @@ -3770,7 +3768,7 @@ ensure_lval (struct value *val, CORE_ADD 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); @@ -3783,7 +3781,7 @@ ada_convert_actual (struct value *actual 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) { @@ -3801,7 +3799,7 @@ ada_convert_actual (struct value *actual 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); } @@ -3823,7 +3821,8 @@ ada_convert_actual (struct value *actual 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); @@ -3843,10 +3842,10 @@ make_array_descriptor (struct type *type 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)); @@ -3855,7 +3854,7 @@ make_array_descriptor (struct type *type 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); Index: gdb-head/gdb/ada-lang.h =================================================================== --- gdb-head.orig/gdb/ada-lang.h +++ gdb-head/gdb/ada-lang.h @@ -265,6 +265,7 @@ extern void ada_printstr (struct ui_file 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, Index: gdb-head/gdb/infcall.c =================================================================== --- gdb-head.orig/gdb/infcall.c +++ gdb-head/gdb/infcall.c @@ -142,7 +142,7 @@ value_arg_coerce (struct gdbarch *gdbarc /* 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 -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com