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] [04/09] Get rid of current_gdbarch (SIZEOF_FRAME_SAVED_REGS macro)


Daniel Jacobowitz wrote:
> On Mon, Nov 05, 2007 at 02:43:29PM +0100, Mark Kettenis wrote:
> > > Date: Mon, 05 Nov 2007 13:21:29 +0100
> > > From: Markus Deuling <deuling@de.ibm.com>
> > > 
> > > Hi,
> > > 
> > > this patch replaces SIZEOF_FRAME_SAVED_REGS macro by its expression.
> > > 
> > > Tested by gdb_mbuild with alpha target. Is this ok to commit?
> > 
> > I'm not thrilled, since this replaces a #define that has a sensible
> > name with some sort of complicated expression, and therefore makes the
> > code much more difficult to read.
> 
> Ditto.  frame_zalloc_saved_regs (frame)?

As far as I can see SIZEOF_FRAME_SAVED_REGS is really just a remainder
of the old frame logic that happens to be still in local use on alpha
for some reason -- I do not think it makes sense to "generalize" it
like that, it should be removed from common code.

Note that the expression
#define SIZEOF_FRAME_SAVED_REGS \
        (sizeof (CORE_ADDR) * (gdbarch_num_regs (current_gdbarch)\
			       + gdbarch_num_pseudo_regs (current_gdbarch)))
would likely be incorrect on most other platforms anyway nowadays.

However, on the alpha, this is actually constant: num_regs is alway
ALPHA_NUM_REGS, pseudo registers are not used, and sizeof (CORE_ADDR)
should always be 8 in a gdb build targetting the alpha.

In fact, there exists already an alpha-specific macro that should
have just the correct value:

#define ALPHA_REGISTER_BYTES (ALPHA_NUM_REGS * 8)

Why not just replace SIZEOF_FRAME_SAVED_REGS with ALPHA_REGISTER_BYTES
in the alpha files and remove it from common code?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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