Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] mips-tdep: info registers
Date: Fri, 27 Feb 2009 20:36:00 -0000	[thread overview]
Message-ID: <20090227195607.GJ26056@adacore.com> (raw)
In-Reply-To: <gnupjj$kvk$1@ger.gmane.org>

Aleksandar,

>Joel, the attached removes numeric value syntax, but allows it for mips; 
>mips will explicitly map regno to raw regno (which is currently 1-1).
>
>I will let you take it from here.

I am afraid that I won't have time to do much more than review your
change. Just reviewing changes right now is a struggle for me, so
do you think you could submit them officially?

I think there are two parts to this patch:

> Index: gdb/infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.231
> diff -u -p -r1.231 infcmd.c
> --- gdb/infcmd.c	25 Jan 2009 23:35:51 -0000	1.231
> +++ gdb/infcmd.c	23 Feb 2009 18:21:54 -0000
> @@ -1948,21 +1948,6 @@ registers_info (char *addr_exp, int fpre
>  	  }
>        }
>  
> -      /* A register number?  (how portable is this one?).  */
> -      {
> -	char *endptr;
> -	int regnum = strtol (start, &endptr, 0);
> -	if (endptr == end
> -	    && regnum >= 0
> -	    && regnum < gdbarch_num_regs (gdbarch)
> -			+ gdbarch_num_pseudo_regs (gdbarch))
> -	  {
> -	    gdbarch_print_registers_info (gdbarch, gdb_stdout,
> -					  frame, regnum, fpregs);
> -	    continue;
> -	  }
> -      }
> -
>        /* A register group?  */
>        {
>  	struct reggroup *group;

This patch is fine, and approved. Please just run it through the testsuite
before checking in. (can you remember to post a ChangeLog for it as well?)

The mips-tdep part can be treated independently.  Although I don't see
any problem with it, and you updated it the same way I would have changed
it, I'm not sure about going against the comment:

>    /* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers, 
>       but then don't make the raw register names visible.  */

It looks fine to return "0" ... "31" as the names of the raw registers,
but I'd like someone with more experience with the mips target to confirm
it.

> Index: gdb/mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.490
> diff -u -p -r1.490 mips-tdep.c
> --- gdb/mips-tdep.c	22 Feb 2009 01:02:17 -0000	1.490
> +++ gdb/mips-tdep.c	23 Feb 2009 18:21:57 -0000
> @@ -440,13 +440,25 @@ mips_register_name (struct gdbarch *gdba
>      "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
>    };
>  
> +  static char *mips_gpr_numeric_names[] = {

A little short comment explaining what this is about might be useful.

> +    "0", "1", "2", "3", "4", "5", "6", "7",
> +    "8", "9", "10", "11", "12", "13", "14", "15",
> +    "16", "17", "18", "19", "20", "21", "22", "23",
> +    "24", "25", "26", "27", "28", "29", "30", "31"
> +  };
> +
>    enum mips_abi abi = mips_abi (gdbarch);
>  
>    /* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers, 
>       but then don't make the raw register names visible.  */

This comment needs to be removed or updated.  If the comment next to
mips_gpr_numeric_names is clear enough, I think it can simply be
removed.

>    int rawnum = regno % gdbarch_num_regs (gdbarch);
>    if (regno < gdbarch_num_regs (gdbarch))
> -    return "";
> +    {
> +      if (regno >= 0)
> +	return mips_gpr_numeric_names [regno];
> +      else
> +	return "";
> +    }
>  
>    /* The MIPS integer registers are always mapped from 0 to 31.  The
>       names of the registers (which reflects the conventions regarding
> @@ -4601,7 +4613,9 @@ mips_print_registers_info (struct gdbarc
>  {
>    if (regnum != -1)		/* do one specified register */
>      {
> -      gdb_assert (regnum >= gdbarch_num_regs (gdbarch));
> +      if (regnum < gdbarch_num_regs (gdbarch)
> +	  && regnum >= 0)
> +	regnum += gdbarch_num_regs (gdbarch); /* Print pseudo register.  */
>        if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
>  	error (_("Not a valid register for the current processor type"));
>  


-- 
Joel


  reply	other threads:[~2009-02-27 19:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 16:24 Aleksandar Ristovski
2009-02-23  2:52 ` Joel Brobecker
2009-02-23  3:00   ` Daniel Jacobowitz
2009-02-23  3:13     ` Joel Brobecker
2009-02-23  8:53       ` Eli Zaretskii
2009-02-23 16:18         ` Aleksandar Ristovski
2009-02-24  1:32           ` Eli Zaretskii
2009-02-23  8:56     ` Mark Kettenis
2009-02-23 16:26       ` Aleksandar Ristovski
2009-02-23 17:15         ` Daniel Jacobowitz
2009-02-23 17:36           ` Joel Brobecker
2009-02-23 18:24             ` Aleksandar Ristovski
2009-02-23 20:02               ` Aleksandar Ristovski
2009-02-27 20:36                 ` Joel Brobecker [this message]
2009-03-04 21:47                   ` Aleksandar Ristovski
2009-03-05 19:12                     ` Joel Brobecker
2009-03-05 19:22                       ` Daniel Jacobowitz
2009-03-05 19:27                         ` Aleksandar Ristovski
2009-03-05 19:35                           ` Daniel Jacobowitz
2009-03-05 22:50                             ` Joel Brobecker
2009-03-05 23:08                               ` Daniel Jacobowitz
2009-03-06  5:00                                 ` Aleksandar Ristovski
2009-03-06 12:25                                   ` Daniel Jacobowitz
2009-03-06 14:52                                     ` Aleksandar Ristovski
2009-04-01 18:50                                       ` Joel Brobecker
2009-04-01 19:16                                         ` Aleksandar Ristovski
2009-02-24 20:24               ` Maciej W. Rozycki
2009-02-25  2:15                 ` Aleksandar Ristovski
2009-02-25  7:04                   ` Maciej W. Rozycki

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=20090227195607.GJ26056@adacore.com \
    --to=brobecker@adacore.com \
    --cc=aristovski@qnx.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