Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Compute register name once in default_print_one_register_info
Date: Fri, 27 Feb 2026 16:46:11 +0100	[thread overview]
Message-ID: <9a013265-6107-4727-987c-c562418382ea@suse.de> (raw)
In-Reply-To: <20260227143344.333820-1-tromey@adacore.com>

On 2/27/26 3:33 PM, Tom Tromey wrote:
> PR gdb/9884 points out that default_print_one_register_info could call
> gdbarch_register_name a single time.  The current code seems harmless
> but OTOH the proposed change is also harmless and perhaps slightly
> faster, so why not.
> 

LGTM, obvious even.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=9884
> ---
>   gdb/infcmd.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 319d17d95eb..d0d1c142041 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -2505,11 +2505,12 @@ default_print_registers_info (struct gdbarch *gdbarch,
>   
>         /* If the register name is empty, it is undefined for this
>   	 processor, so don't display anything.  */
> -      if (*(gdbarch_register_name (gdbarch, i)) == '\0')
> +      const char *regname = gdbarch_register_name (gdbarch, i);
> +      if (*regname == '\0')
>   	continue;
>   
>         default_print_one_register_info
> -	(file, gdbarch_register_name (gdbarch, i),
> +	(file, regname,
>   	 value_of_register (i, get_next_frame_sentinel_okay (frame)));
>       }
>   }
> 
> base-commit: e302db71359c85e3c1f1eb90e8f0aaa06ee81752


  reply	other threads:[~2026-02-27 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 14:33 Tom Tromey
2026-02-27 15:46 ` Tom de Vries [this message]
2026-02-27 15:55 ` Schimpe, Christina
2026-02-27 16:09   ` Tom Tromey
2026-02-27 16:19     ` Schimpe, Christina

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=9a013265-6107-4727-987c-c562418382ea@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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