Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
Date: Tue, 11 Mar 2003 21:22:00 -0000	[thread overview]
Message-ID: <1030311212221.ZM11769@localhost.localdomain> (raw)
In-Reply-To: Andrew Cagney <ac131313@redhat.com> "Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions" (Mar  7,  1:52pm)

On Mar 7,  1:52pm, Andrew Cagney wrote:

> True.  In the mean time, these new methods might as well be consistent 
> with the other existing reg_to_regnum methods (from memory, it does 
> eventually provoke a warning).

Okay.

I've studied the code some more on the gcc side of things.  gcc
differentiates between ``dbx'' (which we call ``aout'' in gdb) and
everything else.  As such, I decided that it didn't make much sense to
have three identical functions to maintain (i.e. the ecoff, dwarf,
and dwarf2 cases).  It's quite possible that the non-dbx case(s) will
need to be modified in the near future since I'm considering adding
some mappings for the hi and lo registers.  If we ever do discover a
reason for making the dwarf, dwarf2, and ecoff mappings diverge, it
will be easy enough to replicate the function at that time.

Below is a revised patch which takes into account your earlier
comments as well as the observation that I just made above.

Okay?

	* mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to
	mips_dwarf_dwarf2_ecoff_reg_to_regnum().
	(mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
	Do range checks on register number obtained from debugging info.
	(mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and
	set_gdbarch_dwarf2_reg_to_regnum().  Adjust call of
	set_gdbarch_ecoff_reg_to_regnum() to account for new name of
	mapping function.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 mips-tdep.c
--- mips-tdep.c	3 Mar 2003 20:50:19 -0000	1.168
+++ mips-tdep.c	11 Mar 2003 21:03:42 -0000
@@ -5546,23 +5546,37 @@ mips_saved_pc_after_call (struct frame_i
 static int
 mips_stab_reg_to_regnum (int num)
 {
-  if (num < 32)
+  if (num >= 0 && num < 32)
     return num;
-  else
+  else if (num >= 38 && num < 70)
     return num + FP0_REGNUM - 38;
+  else
+    {
+      /* This will hopefully (eventually) provoke a warning.  Should
+         we be calling complaint() here?  */
+      return NUM_REGS + NUM_PSEUDO_REGS;
+    }
 }
 
-/* Convert a ecoff register number to a gdb REGNUM */
+
+/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */
 
 static int
-mips_ecoff_reg_to_regnum (int num)
+mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
 {
-  if (num < 32)
+  if (num >= 0 && num < 32)
     return num;
-  else
+  else if (num >= 32 && num < 64)
     return num + FP0_REGNUM - 32;
+  else
+    {
+      /* This will hopefully (eventually) provoke a warning.  Should
+         we be calling complaint() here?  */
+      return NUM_REGS + NUM_PSEUDO_REGS;
+    }
 }
 
+
 /* Convert an integer into an address.  By first converting the value
    into a pointer and then extracting it signed, the address is
    guarenteed to be correctly sign extended.  */
@@ -5979,7 +5993,9 @@ mips_gdbarch_init (struct gdbarch_info i
 
   /* Map debug register numbers onto internal register numbers.  */
   set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
-  set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+  set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+  set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+  set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
 
   /* Initialize a frame */
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);


  reply	other threads:[~2003-03-11 21:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04 21:17 Kevin Buettner
2003-03-07 17:04 ` Andrew Cagney
2003-03-07 17:52   ` Kevin Buettner
2003-03-07 18:52     ` Andrew Cagney
2003-03-11 21:22       ` Kevin Buettner [this message]
2003-03-11 22:06         ` Andrew Cagney
2003-03-07 19:13     ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2003-03-31 23:11 [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
2003-04-02  3:36 ` Andrew Cagney
2003-03-04 17:24 [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-03-04 18:01 ` Andrew Cagney
2002-12-17 10:35 [patch/rfc] Add get_*() to rs6000-tdep.c Andrew Cagney
     [not found] ` <ac131313@redhat.com>
2002-12-17 14:13   ` Kevin Buettner
2002-12-18  7:37     ` Andrew Cagney
2003-03-11 23:16   ` [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
2003-03-11 23:18   ` [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-04-02  5:13   ` [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner

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=1030311212221.ZM11769@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ac131313@redhat.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