Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
Date: Fri, 07 Mar 2003 17:04:00 -0000	[thread overview]
Message-ID: <3E68D0FD.2010809@redhat.com> (raw)
In-Reply-To: <1030304211701.ZM24618@localhost.localdomain>

> When using dwarf2 debug info, floating point registers are mapped
> incorrectly for certain mips targets.  It turns out that Irix is the
> only one that's getting it right due to the fact that FP0_REGNUM is
> defined to be 32.
> 
> Thanks to Chris Demetriou for diagnosing this problem and suggesting
> the solution.
> 
> [Note: Irix cross some other mips target is currently broken due to
> the fact that FP0_REGNUM is not multiarched yet.]

I don't think FP0_REGNUM should be multi-arched.  The only reference to 
FP0_REGNUM in generic code that I could find was this gem:

   if (FP0_REGNUM >= 0)  /* need floating point? */
     {
       if ((regno >= 0 && regno < FP0_REGNUM) ||
           regno == PC_REGNUM  ||
           (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
           regno == FP_REGNUM  ||
           regno == SP_REGNUM)
         return;                 /* not a floating point register */

       if ((fpregs = proc_get_fpregs (pi)) == NULL)
         proc_error (pi, "fetch_registers, get_fpregs", __LINE__);

       supply_fpregset (fpregs);
     }

mips_tdep could certainly gain a local tdep->fp0_regnum though.

> Okay?

Yes, just make it a little bit more robust.  The i386 does this:

   /* This will hopefully provoke a warning.  */
   return NUM_REGS + NUM_PSEUDO_REGS;

when it doesn't know what to do with a register.

Andrew

> +static int
> +mips_dwarf_reg_to_regnum (int num)
> +{
> +  if (num < 32)
> +    return num;
> +  else
> +    return num + FP0_REGNUM - 32;
> +}
> +
> +/* Convert a dwarf2 register number to a gdb REGNUM */
> +
> +static int
> +mips_dwarf2_reg_to_regnum (int num)
> +{
> +  if (num < 32)
> +    return num;
> +  else
> +    return num + FP0_REGNUM - 32;
> +}
> +
> +
>  /* 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.  */
> @@ -5980,6 +6003,8 @@ 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_dwarf_reg_to_regnum (gdbarch, mips_dwarf_reg_to_regnum);
> +  set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf2_reg_to_regnum);
>  
>    /* Initialize a frame */
>    set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
> 



  reply	other threads:[~2003-03-07 17:04 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 [this message]
2003-03-07 17:52   ` Kevin Buettner
2003-03-07 18:52     ` Andrew Cagney
2003-03-11 21:22       ` Kevin Buettner
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=3E68D0FD.2010809@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@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