Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: fnf@intrinsity.com (Fred Fish)
To: gdb-patches@sources.redhat.com
Cc: fnf@intrinsity.com (Fred Fish)
Subject: [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init
Date: Fri, 27 Jun 2003 17:28:00 -0000	[thread overview]
Message-ID: <20030627172833.430618B5FD@bletchley.vert.intrinsity.com> (raw)

It seems wrong to hard code the number of registers in
mips_gdbarch_init.  Here is one way to fix it, for the case
"num_regs=90", and possibly for the "num_regs=71" case also.

However using sizeof(mips_generic_reg_names) is somewhat of a
misleading way to find the number of strings in MIPS_REGISTER_NAMES
and I'm not too thrilled about using a hard coded 32 instead of
something like "sizeof(mips_gpr_names)/sizeof(char*)".

-Fred



2003-06-25  Fred Fish  <fnf@intrinsity.com>

	* mips-tdep.c (mips_gdbarch_init): Set num_regs to be the number
	of base registers (32) plus the number of machine dependent
	register names, which should equal the number of machine dependent
	registers.

Index: mips-tdep.c
===================================================================
RCS file: /mips/newtools/fsf/gdb/gdb/mips-tdep.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -c -p -r1.21 -r1.22
*** mips-tdep.c	2003/06/23 14:31:26	1.21
--- mips-tdep.c	2003/06/26 02:36:53	1.22
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5908,5914 ****
    if (info.osabi == GDB_OSABI_IRIX)
      num_regs = 71;
    else
!     num_regs = 90;
    set_gdbarch_num_regs (gdbarch, num_regs);
    set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
  
--- 5908,5914 ----
    if (info.osabi == GDB_OSABI_IRIX)
      num_regs = 71;
    else
!     num_regs = 32 + sizeof(mips_generic_reg_names)/sizeof(char *);
    set_gdbarch_num_regs (gdbarch, num_regs);
    set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
  


             reply	other threads:[~2003-06-27 17:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-27 17:28 Fred Fish [this message]
2003-06-27 19:53 ` Andrew Cagney
2003-06-27 20:25   ` Fred Fish
2003-07-01 21:50     ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030627172833.430618B5FD@bletchley.vert.intrinsity.com \
    --to=fnf@intrinsity.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox