public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Sergio Durigan Junior <sergiodj@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Provide useful completer for "info registers"
Date: Wed, 10 Dec 2014 17:36:00 -0000	[thread overview]
Message-ID: <87388no1ac.fsf@br87z6lw.de.ibm.com> (raw)
In-Reply-To: <54809B2C.8070707@redhat.com> (Pedro Alves's message of "Thu, 04	Dec 2014 17:34:36 +0000")

On Thu, Dec 04 2014, Pedro Alves wrote:

> Thanks Andreas,
>
> I think a register completer is a great idea.

Thanks, I thought so, too ;-)

>
> On 11/26/2014 08:54 PM, Sergio Durigan Junior wrote:
>> I'd say this patch also needs a testcase :-).  I know that this is
>> architecture specific, so I'd personally be happy with something very
>> simple, maybe testing only one or two architectures would be enough.
>
> I think $pc, $sp, $fp (the user regs) should work everywhere.
>
> See user-regs.c and std-regs.c.
>
> Actually, looks like the patch misses considering those for completion?
>
> See infcmd.c:registers_info:
>
>       /* A register name?  */
>       {
>         int regnum = user_reg_map_name_to_regnum (gdbarch, start, end - start);
>
>         if (regnum >= 0)
>           {
>             /* User registers lie completely outside of the range of
>                normal registers.  Catch them early so that the target
>                never sees them.  */
>             if (regnum >= gdbarch_num_regs (gdbarch)
>                           + gdbarch_num_pseudo_regs (gdbarch))
>               {

Yes, the patch misses them...  Note that this is consistent with the
list of registers shown by "mt print registers" or "info registers all".
But you're right, the "info registers" command accepts user registers,
so the completer should offer them as well.  Added this in v3.

It seems that user registers can not be listed by any means in GDB.
Most architectures only have the built-in set of user registers ($pc,
$sp, $fp, and $ps), but some define additional ones.  This creates a
difficulty with the test case, which tries to determine the full list of
registers and reggroups the completer is supposed to yield.  Thus I just
added such a command in v3 as well.

  reply	other threads:[~2014-12-10 17:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 17:28 Andreas Arnez
2014-11-26 20:54 ` Sergio Durigan Junior
2014-11-26 21:52   ` Sergio Durigan Junior
2014-11-28 18:14   ` Andreas Arnez
2014-11-28 20:39     ` Sergio Durigan Junior
2014-12-04 17:34   ` Pedro Alves
2014-12-10 17:36     ` Andreas Arnez [this message]
2014-12-10 18:21       ` Pedro Alves
2014-12-04 17:38 ` Pedro Alves
2014-12-10 17:48   ` Andreas Arnez

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=87388no1ac.fsf@br87z6lw.de.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=sergiodj@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).