This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] [02/05] Get rid of current_gdbarch in hppa-linux-nat.c


Mark Kettenis schrieb:
Date: Wed, 07 Nov 2007 12:11:02 +0100
From: Markus Deuling <deuling@de.ibm.com>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]