public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Introduce gdbarch_num_cooked_regs
Date: Mon, 22 Oct 2018 02:26:00 -0000	[thread overview]
Message-ID: <d3f6f05175e58732deca79b38536ade5@polymtl.ca> (raw)
In-Reply-To: <20181021142638.31d9889e@pinnacle.lan>

On 2018-10-21 17:26, Kevin Buettner wrote:
> Hi Simon,
> 

Hi Kevin,

> LGTM, aside from a question and one formatting problem...
> 
>> diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
>> index 1490ee28668a..b6e8f00a0ba1 100644
>> --- a/gdb/m68hc11-tdep.c
>> +++ b/gdb/m68hc11-tdep.c
>> @@ -854,10 +854,7 @@ m68hc11_frame_unwind_cache (struct frame_info 
>> *this_frame,
>> 
>>    /* Adjust all the saved registers so that they contain addresses 
>> and not
>>       offsets.  */
>> -  for (i = 0;
>> -       i < gdbarch_num_regs (gdbarch)
>> -	   + gdbarch_num_pseudo_regs (gdbarch) - 1;
>> -       i++)
>> +  for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
>>      if (trad_frame_addr_p (info->saved_regs, i))
>>        {
>>          info->saved_regs[i].addr += this_base;
> 
> The " - 1" in the original expression was a mistake, right?  (I spent
> a few minutes looking at the mc68hc11's pseudo register layout but 
> can't
> find a reason for subtracting one.)

I don't think I had noticed it, thanks for pointing it out.  I took a 
look too and don't see any reason either.  The saved_regs array is 
allocated with a size equal to the number of cooked registers.  I dug up 
the patch that introduced this code, no comment about it:

https://sourceware.org/ml/gdb-patches/2003-07/msg00483.html

I'll add a comment about it in the commit log.

>> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
>> index 12382cddb357..9c34a070ae14 100644
>> --- a/gdb/tui/tui-regs.c
>> +++ b/gdb/tui/tui-regs.c
>> @@ -206,10 +206,7 @@ tui_show_register_group (struct reggroup *group,
>> 
>>    /* See how many registers must be displayed.  */
>>    nr_regs = 0;
>> -  for (regnum = 0;
>> -       regnum < gdbarch_num_regs (gdbarch)
>> -		+ gdbarch_num_pseudo_regs (gdbarch);
>> -       regnum++)
>> +  for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); 
>> regnum++)
>>      {
>>        const char *name;
>> 
>> @@ -253,10 +250,7 @@ tui_show_register_group (struct reggroup *group,
>> 
>>        /* Now set the register names and values.  */
>>        pos = 0;
>> -      for (regnum = 0;
>> -	   regnum < gdbarch_num_regs (gdbarch)
>> -		    + gdbarch_num_pseudo_regs (gdbarch);
>> -	   regnum++)
>> +      for (regnum = 0;regnum < gdbarch_num_cooked_regs (gdbarch); 
>> regnum++)
> 
> Missing space between ; and "regnum".

Fixed, thanks.

I'm pushing the patch with those fixed.

Simon

      reply	other threads:[~2018-10-22  2:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21 19:01 Simon Marchi
2018-10-21 21:26 ` Kevin Buettner
2018-10-22  2:26   ` Simon Marchi [this message]

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=d3f6f05175e58732deca79b38536ade5@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).