From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6993 invoked by alias); 5 Nov 2007 12:23:26 -0000 Received: (qmail 6975 invoked by uid 22791); 5 Nov 2007 12:23:25 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 05 Nov 2007 12:23:20 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id lA5CNHaC202230 for ; Mon, 5 Nov 2007 12:23:17 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 v8.5) with ESMTP id lA5CNHCo2269228 for ; Mon, 5 Nov 2007 13:23:17 +0100 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 lA5CNHPc016698 for ; Mon, 5 Nov 2007 13:23:17 +0100 Received: from bbkeks.boeblingen.de.ibm.com (dyn-9-152-248-41.boeblingen.de.ibm.com [9.152.248.41]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id lA5CNFYJ016607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Nov 2007 13:23:17 +0100 Message-ID: <472F0AC9.7030700@de.ibm.com> Date: Mon, 05 Nov 2007 12:23:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: GDB Patches CC: Ulrich Weigand Subject: [rfc] [04/09] Get rid of current_gdbarch (SIZEOF_FRAME_SAVED_REGS macro) Content-Type: multipart/mixed; boundary="------------090209080500070202070208" 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: 2007-11/txt/msg00048.txt.bz2 This is a multi-part message in MIME format. --------------090209080500070202070208 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 520 Hi, this patch replaces SIZEOF_FRAME_SAVED_REGS macro by its expression. Tested by gdb_mbuild with alpha target. Is this ok to commit? ChangeLog: * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Replace SIZEOF_FRAME_SAVED_REGS by its expression. Use get_frame_arch to get at the current architecture by frame_info. * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Remove. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------090209080500070202070208 Content-Type: text/plain; name="diff-frame" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-frame" Content-length: 2873 diff -urpN src/gdb/alpha-mdebug-tdep.c dev2/gdb/alpha-mdebug-tdep.c --- src/gdb/alpha-mdebug-tdep.c 2007-10-17 15:36:43.000000000 +0200 +++ dev2/gdb/alpha-mdebug-tdep.c 2007-11-05 09:00:20.000000000 +0100 @@ -180,6 +180,7 @@ static struct alpha_mdebug_unwind_cache alpha_mdebug_frame_unwind_cache (struct frame_info *next_frame, void **this_prologue_cache) { + struct gdbarch *gdbarch = get_frame_arch (next_frame); struct alpha_mdebug_unwind_cache *info; struct mdebug_extra_func_info *proc_desc; ULONGEST vfp; @@ -201,7 +202,9 @@ alpha_mdebug_frame_unwind_cache (struct info->proc_desc = proc_desc; gdb_assert (proc_desc != NULL); - info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); + info->saved_regs = frame_obstack_zalloc (sizeof (CORE_ADDR) * + (gdbarch_num_regs (gdbarch) + + gdbarch_num_pseudo_regs (gdbarch))); /* The VFP of the frame is at FRAME_REG+FRAME_OFFSET. */ vfp = frame_unwind_register_unsigned (next_frame, PROC_FRAME_REG (proc_desc)); diff -urpN src/gdb/alpha-tdep.c dev2/gdb/alpha-tdep.c --- src/gdb/alpha-tdep.c 2007-11-05 05:32:21.000000000 +0100 +++ dev2/gdb/alpha-tdep.c 2007-11-05 09:01:50.000000000 +0100 @@ -999,6 +999,7 @@ alpha_heuristic_frame_unwind_cache (stru void **this_prologue_cache, CORE_ADDR start_pc) { + struct gdbarch *gdbarch = get_frame_arch (next_frame); struct alpha_heuristic_unwind_cache *info; ULONGEST val; CORE_ADDR limit_pc, cur_pc; @@ -1009,7 +1010,9 @@ alpha_heuristic_frame_unwind_cache (stru info = FRAME_OBSTACK_ZALLOC (struct alpha_heuristic_unwind_cache); *this_prologue_cache = info; - info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); + info->saved_regs = frame_obstack_zalloc (sizeof (CORE_ADDR) * + (gdbarch_num_regs (gdbarch) + + gdbarch_num_pseudo_regs (gdbarch))); limit_pc = frame_pc_unwind (next_frame); if (start_pc == 0) diff -urpN src/gdb/frame.h dev2/gdb/frame.h --- src/gdb/frame.h 2007-11-05 05:32:21.000000000 +0100 +++ dev2/gdb/frame.h 2007-11-05 09:02:29.000000000 +0100 @@ -569,18 +569,6 @@ enum print_what LOC_AND_ADDRESS }; -/* Allocate additional space for appendices to a struct frame_info. - NOTE: Much of GDB's code works on the assumption that the allocated - saved_regs[] array is the size specified below. If you try to make - that array smaller, GDB will happily walk off its end. */ - -#ifdef SIZEOF_FRAME_SAVED_REGS -#error "SIZEOF_FRAME_SAVED_REGS can not be re-defined" -#endif -#define SIZEOF_FRAME_SAVED_REGS \ - (sizeof (CORE_ADDR) * (gdbarch_num_regs (current_gdbarch)\ - + gdbarch_num_pseudo_regs (current_gdbarch))) - /* Allocate zero initialized memory from the frame cache obstack. Appendices to the frame info (such as the unwind cache) should allocate memory using this method. */ --------------090209080500070202070208--