From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8084 invoked by alias); 5 Nov 2007 12:23:39 -0000 Received: (qmail 8001 invoked by uid 22791); 5 Nov 2007 12:23:37 -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; Mon, 05 Nov 2007 12:23:33 +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 lA5CNUqu248716 for ; Mon, 5 Nov 2007 12:23:30 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 lA5CNUUd2027718 for ; Mon, 5 Nov 2007 13:23:30 +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 lA5CNUnR016928 for ; Mon, 5 Nov 2007 13:23:30 +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 lA5CNTpo016909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Nov 2007 13:23:30 +0100 Message-ID: <472F0AD7.1000508@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] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) Content-Type: multipart/mixed; boundary="------------070903070800060001080007" 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/msg00053.txt.bz2 This is a multi-part message in MIME format. --------------070903070800060001080007 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 489 Hi, this patchs adds gdbarch parameter to legacy_virtual_frame_pointer and updates its sole implementation in arch-utils. Tested by building and running testsuite on x86. Ok to commit? ChangeLog: * gdbarch.sh (legacy_virtual_frame_pointer): Add gdbarch parameter. * gdbarch.{c,h}: Regenerate. * arch-utils.c (legacy_virtual_frame_pointer): Add gdbarch parameter. Replace current_gdbarch by gdbarch. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------070903070800060001080007 Content-Type: text/plain; name="diff-frame-ptr" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-frame-ptr" Content-length: 4244 diff -urpN src/gdb/arch-utils.c dev3/gdb/arch-utils.c --- src/gdb/arch-utils.c 2007-10-13 02:06:52.000000000 +0200 +++ dev3/gdb/arch-utils.c 2007-11-05 11:42:54.000000000 +0100 @@ -135,7 +135,8 @@ cannot_register_not (int regnum) raw. */ void -legacy_virtual_frame_pointer (CORE_ADDR pc, +legacy_virtual_frame_pointer (struct gdbarch *gdbarch, + CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { @@ -144,14 +145,14 @@ legacy_virtual_frame_pointer (CORE_ADDR register and an offset can determine this. I think it should instead generate a byte code expression as that would work better with things like Dwarf2's CFI. */ - if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0 - && gdbarch_deprecated_fp_regnum (current_gdbarch) - < gdbarch_num_regs (current_gdbarch)) - *frame_regnum = gdbarch_deprecated_fp_regnum (current_gdbarch); - else if (gdbarch_sp_regnum (current_gdbarch) >= 0 - && gdbarch_sp_regnum (current_gdbarch) - < gdbarch_num_regs (current_gdbarch)) - *frame_regnum = gdbarch_sp_regnum (current_gdbarch); + if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0 + && gdbarch_deprecated_fp_regnum (gdbarch) + < gdbarch_num_regs (gdbarch)) + *frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch); + else if (gdbarch_sp_regnum (gdbarch) >= 0 + && gdbarch_sp_regnum (gdbarch) + < gdbarch_num_regs (gdbarch)) + *frame_regnum = gdbarch_sp_regnum (gdbarch); else /* Should this be an internal error? I guess so, it is reflecting an architectural limitation in the current design. */ diff -urpN src/gdb/gdbarch.c dev3/gdb/gdbarch.c --- src/gdb/gdbarch.c 2007-11-05 05:32:21.000000000 +0100 +++ dev3/gdb/gdbarch.c 2007-11-05 11:39:57.000000000 +0100 @@ -266,7 +266,7 @@ struct gdbarch startup_gdbarch = 1, /* char_signed */ 0, /* read_pc */ 0, /* write_pc */ - 0, /* virtual_frame_pointer */ + legacy_virtual_frame_pointer, /* virtual_frame_pointer */ 0, /* pseudo_register_read */ 0, /* pseudo_register_write */ 0, /* num_regs */ @@ -1366,7 +1366,7 @@ gdbarch_virtual_frame_pointer (struct gd gdb_assert (gdbarch->virtual_frame_pointer != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n"); - gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset); + gdbarch->virtual_frame_pointer (gdbarch, pc, frame_regnum, frame_offset); } void diff -urpN src/gdb/gdbarch.h dev3/gdb/gdbarch.h --- src/gdb/gdbarch.h 2007-11-05 05:32:21.000000000 +0100 +++ dev3/gdb/gdbarch.h 2007-11-05 11:39:16.000000000 +0100 @@ -160,7 +160,7 @@ extern void set_gdbarch_write_pc (struct whole scheme for dealing with "frames" and "frame pointers" needs a serious shakedown. */ -typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); +typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer); diff -urpN src/gdb/gdbarch.sh dev3/gdb/gdbarch.sh --- src/gdb/gdbarch.sh 2007-11-05 05:32:21.000000000 +0100 +++ dev3/gdb/gdbarch.sh 2007-11-05 11:38:50.000000000 +0100 @@ -392,7 +392,7 @@ F:void:write_pc:struct regcache *regcach # Function for getting target's idea of a frame pointer. FIXME: GDB's # whole scheme for dealing with "frames" and "frame pointers" needs a # serious shakedown. -f:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0 +m:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0 # M:void:pseudo_register_read:struct regcache *regcache, int cookednum, gdb_byte *buf:regcache, cookednum, buf M:void:pseudo_register_write:struct regcache *regcache, int cookednum, const gdb_byte *buf:regcache, cookednum, buf --------------070903070800060001080007--