From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1851 invoked by alias); 7 Nov 2007 11:51:15 -0000 Received: (qmail 1840 invoked by uid 22791); 7 Nov 2007 11:51:15 -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; Wed, 07 Nov 2007 11:51:13 +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 lA7BpBoA158822 for ; Wed, 7 Nov 2007 11:51:11 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.6) with ESMTP id lA7BpAHF2330758 for ; Wed, 7 Nov 2007 12:51:10 +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 lA7BpAhV007451 for ; Wed, 7 Nov 2007 12:51:10 +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 lA7Bp8Ns007428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Nov 2007 12:51:10 +0100 Message-ID: <4731A642.6080402@de.ibm.com> Date: Wed, 07 Nov 2007 11:51:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: Mark Kettenis CC: gdb-patches@sourceware.org, uweigand@de.ibm.com Subject: Re: [rfc] [02/05] Get rid of current_gdbarch in hppa-linux-nat.c References: <47319D46.8080904@de.ibm.com> <200711071130.lA7BUDaD014732@brahms.sibelius.xs4all.nl> In-Reply-To: <200711071130.lA7BUDaD014732@brahms.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-15; format=flowed 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: 2007-11/txt/msg00123.txt.bz2 Mark Kettenis schrieb: >> Date: Wed, 07 Nov 2007 12:11:02 +0100 >> From: Markus Deuling >> >> Hi, >> >> this patch adds gdbarch as a parameter to hppa_linux_register_addr. >> >> Tested with gdb_mbuild. Ok to commit ? > > Actually, this is getting a bit silly. That gdbarch is only needed > for a sanaity check, and obviously the gdbarch_num_regs call can just > be replaced with an appropriate bounds check on the u_offsets array. > > if (regno < 0 || regno >= ARRAY_SIZE(u_offsets)) > > should do the trick. Sure it would. But what for do we have gdbarch_num_regs? I dont think its a good idea to either use gdbarch_num_regs or ARRAY_SIZE(whatever) at will. This is redundant and error-prone. Btw, there are two further uses of gdbarch_num_regs in that file. For my opinion gdbarch should be used to describe an architecture. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com