From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27256 invoked by alias); 15 Feb 2008 18:39:20 -0000 Received: (qmail 27248 invoked by uid 22791); 15 Feb 2008 18:39:20 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate1.de.ibm.com (HELO mtagate1.de.ibm.com) (195.212.29.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Feb 2008 18:38:52 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.8/8.13.8) with ESMTP id m1FIcniL246140 for ; Fri, 15 Feb 2008 18:38:49 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.7) with ESMTP id m1FIcnVh2056332 for ; Fri, 15 Feb 2008 19:38:49 +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 m1FIcnXr028618 for ; Fri, 15 Feb 2008 18:38:49 GMT 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 m1FIcnFC028614; Fri, 15 Feb 2008 18:38:49 GMT Message-Id: <200802151838.m1FIcnFC028614@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 15 Feb 2008 19:38:49 +0100 Subject: Re: [rfc]: Replace current_gdbarch in hppa To: deuling@de.ibm.com (Markus Deuling) Date: Fri, 15 Feb 2008 18:39:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (GDB Patches) In-Reply-To: <47B5354A.4090404@de.ibm.com> from "Markus Deuling" at Feb 15, 2008 07:46:34 AM X-Mailer: ELM [version 2.5 PL2] 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: 2008-02/txt/msg00260.txt.bz2 Markus Deuling wrote: > * hppa-tdep.h (find_global_pointer): Add gdbarch as parameter. > > * hppa-hpux-tdep.c (hppa32_hpux_find_global_pointer): Likewise. Replace > current_gdbarch by gdbarch. > (hppa64_hpux_find_global_pointer): Likewise. > * hppa-tdep.c (hppa_find_global_pointer): Likewise. > (hppa32_push_dummy_call, hppa64_push_dummy_call): Update call for > find_global_pointer. > > * hppabsd-tdep.c (hppabsd_find_global_pointer): Add gdbarch as > parameter. > * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. > > * hppa-linux-nat.c (hppa_linux_register_addr): Add gdbarch as parameter. > (fetch_register, store_register): Update call for > hppa_linux_register_addr. > > * hppa-hpux-tdep.c (hppa_hpux_sr_for_addr): Add gdbarch as parameter and > replace current_gdbarch by gdbarch. > (hppa_hpux_push_dummy_code): Update call for hppa_hpux_sr_for_addr. Most of these are OK, except: > diff -urpN src/gdb/hppa-linux-nat.c dev/gdb/hppa-linux-nat.c > --- src/gdb/hppa-linux-nat.c 2008-01-01 23:53:10.000000000 +0100 > +++ dev/gdb/hppa-linux-nat.c 2008-02-15 06:52:13.000000000 +0100 > @@ -149,11 +149,12 @@ static const int u_offsets[] = > }; > > static CORE_ADDR > -hppa_linux_register_addr (int regno, CORE_ADDR blockend) > +hppa_linux_register_addr (struct gdbarch *gdbarch, int regno, > + CORE_ADDR blockend) > { > CORE_ADDR addr; > > - if ((unsigned) regno >= gdbarch_num_regs (current_gdbarch)) > + if ((unsigned) regno >= gdbarch_num_regs (gdbarch)) > error (_("Invalid register number %d."), regno); > > if (u_offsets[regno] == -1) This is really the wrong check. It should really just verify that no out-of-bounds access to u_offsets happens, so the line should just be something like: if ((unsigned) regno >= ARRAY_SIZE (u_offsets)) Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com