From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24352 invoked by alias); 31 Aug 2008 17:52:33 -0000 Received: (qmail 24078 invoked by uid 22791); 31 Aug 2008 17:52:29 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.29.155) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 31 Aug 2008 17:51:41 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpcC0331098 for ; Sun, 31 Aug 2008 17:51:38 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.0) with ESMTP id m7VHpbib3100770 for ; Sun, 31 Aug 2008 19:51:37 +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 m7VHpYUG020227 for ; Sun, 31 Aug 2008 19:51:34 +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 ESMTP id m7VHpYAi020224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 31 Aug 2008 19:51:34 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (localhost.localdomain [127.0.0.1]) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpYJA002968 for ; Sun, 31 Aug 2008 19:51:34 +0200 Received: (from uweigand@localhost) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8/Submit) id m7VHpYSQ002967 for gdb-patches@sourceware.org; Sun, 31 Aug 2008 19:51:34 +0200 Message-Id: <20080831175134.036862000@de.ibm.com> References: <20080831175045.128504000@de.ibm.com> User-Agent: quilt/0.46-1 Date: Sun, 31 Aug 2008 17:52:00 -0000 From: uweigand@de.ibm.com To: gdb-patches@sourceware.org Subject: [rfc][26/37] Eliminate builtin_type_ macros: Use per-frame architecture Content-Disposition: inline; filename=diff-type-frame 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: 2008-08/txt/msg00676.txt.bz2 Hello, a couple of places used builtin_type_ macros where we should be determining the types from the frame architecture. Bye, Ulrich ChangeLog: * stack.c (return_command): Use frame architecture to determine default integer return type. * f-valprint.c (f77_get_dynamic_lowerbound): Use frame architecture to determine pointer types. (f77_get_dynamic_upperbound): Likewise. * objc-lang.c (OBJC_FETCH_POINTER_ARGUMENT): Remove. (resolve_msgsend): Use architecture of current frame to determine pointer types. Inline OBJC_FETCH_POINTER_ARGUMENT. (resolve_msgsend_stret, resolve_msgsend_super, resolve_msgsend_super_stret): Likewise. Index: gdb-head/gdb/f-valprint.c =================================================================== --- gdb-head.orig/gdb/f-valprint.c +++ gdb-head/gdb/f-valprint.c @@ -99,10 +99,11 @@ f77_get_dynamic_lowerbound (struct type current_frame_addr = get_frame_base (frame); if (current_frame_addr > 0) { + struct gdbarch *arch = get_frame_arch (frame); ptr_to_lower_bound = read_memory_typed_address (current_frame_addr + TYPE_ARRAY_LOWER_BOUND_VALUE (type), - builtin_type_void_data_ptr); + builtin_type (arch)->builtin_data_ptr); *lower_bound = read_memory_integer (ptr_to_lower_bound, 4); } else @@ -165,10 +166,11 @@ f77_get_dynamic_upperbound (struct type current_frame_addr = get_frame_base (frame); if (current_frame_addr > 0) { + struct gdbarch *arch = get_frame_arch (frame); ptr_to_upper_bound = read_memory_typed_address (current_frame_addr + TYPE_ARRAY_UPPER_BOUND_VALUE (type), - builtin_type_void_data_ptr); + builtin_type (arch)->builtin_data_ptr); *upper_bound = read_memory_integer (ptr_to_upper_bound, 4); } else Index: gdb-head/gdb/objc-lang.c =================================================================== --- gdb-head.orig/gdb/objc-lang.c +++ gdb-head/gdb/objc-lang.c @@ -1679,19 +1679,19 @@ find_implementation (CORE_ADDR object, C return find_implementation_from_class (ostr.isa, sel); } -#define OBJC_FETCH_POINTER_ARGUMENT(argi) \ - gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \ - argi, builtin_type_void_func_ptr) - static int resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc) { + struct frame_info *frame = get_current_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); + struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr; + CORE_ADDR object; CORE_ADDR sel; CORE_ADDR res; - object = OBJC_FETCH_POINTER_ARGUMENT (0); - sel = OBJC_FETCH_POINTER_ARGUMENT (1); + object = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type); + sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); res = find_implementation (object, sel); if (new_pc != 0) @@ -1704,12 +1704,16 @@ resolve_msgsend (CORE_ADDR pc, CORE_ADDR static int resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc) { + struct frame_info *frame = get_current_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); + struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr; + CORE_ADDR object; CORE_ADDR sel; CORE_ADDR res; - object = OBJC_FETCH_POINTER_ARGUMENT (1); - sel = OBJC_FETCH_POINTER_ARGUMENT (2); + object = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); + sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type); res = find_implementation (object, sel); if (new_pc != 0) @@ -1722,14 +1726,18 @@ resolve_msgsend_stret (CORE_ADDR pc, COR static int resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc) { + struct frame_info *frame = get_current_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); + struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr; + struct objc_super sstr; CORE_ADDR super; CORE_ADDR sel; CORE_ADDR res; - super = OBJC_FETCH_POINTER_ARGUMENT (0); - sel = OBJC_FETCH_POINTER_ARGUMENT (1); + super = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type); + sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); read_objc_super (super, &sstr); if (sstr.class == 0) @@ -1746,14 +1754,18 @@ resolve_msgsend_super (CORE_ADDR pc, COR static int resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc) { + struct frame_info *frame = get_current_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); + struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr; + struct objc_super sstr; CORE_ADDR super; CORE_ADDR sel; CORE_ADDR res; - super = OBJC_FETCH_POINTER_ARGUMENT (1); - sel = OBJC_FETCH_POINTER_ARGUMENT (2); + super = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); + sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type); read_objc_super (super, &sstr); if (sstr.class == 0) Index: gdb-head/gdb/stack.c =================================================================== --- gdb-head.orig/gdb/stack.c +++ gdb-head/gdb/stack.c @@ -1780,11 +1780,13 @@ down_command (char *count_exp, int from_ void return_command (char *retval_exp, int from_tty) { + struct frame_info *thisframe; struct symbol *thisfun; struct value *return_value = NULL; const char *query_prefix = ""; - thisfun = get_frame_function (get_selected_frame ("No selected frame.")); + thisframe = get_selected_frame ("No selected frame."); + thisfun = get_frame_function (thisframe); /* Compute the return value. If the computation triggers an error, let it bail. If the return type can't be handled, set @@ -1803,7 +1805,7 @@ return_command (char *retval_exp, int fr if (thisfun != NULL) return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun)); if (return_type == NULL) - return_type = builtin_type_int; + return_type = builtin_type (get_frame_arch (thisframe))->builtin_int; CHECK_TYPEDEF (return_type); return_value = value_cast (return_type, return_value); -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com