public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Style more output of "disassemble" command
Date: Mon, 10 Aug 2020 15:25:17 +0100	[thread overview]
Message-ID: <20200810142517.GG12133@blade.nx> (raw)
In-Reply-To: <20200804215507.23152-1-tom@tromey.com>

Tom Tromey wrote:
> I noticed a couple of spots where the "disassemble" could style its
> output, but currently does not.  This patch adds styling to the
> function name at the start of the disassembly, and any addresses
> printed there.
...
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index e3965fea076..b70da4a0145 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -1397,12 +1397,16 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
>      {
>        printf_filtered ("Dump of assembler code ");
>        if (name != NULL)
> -	printf_filtered ("for function %s:\n", name);
> +	printf_filtered ("for function %ps:\n",
> +			 styled_string (function_name_style.style (), name));
>        if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
>          {
>  	  if (name == NULL)
> -	    printf_filtered ("from %s to %s:\n",
> -			     paddress (gdbarch, low), paddress (gdbarch, high));
> +	    printf_filtered ("from %ps to %ps:\n",
> +			     styled_string (address_style.style (),
> +					    paddress (gdbarch, low)),
> +			     styled_string (address_style.style (),
> +					    paddress (gdbarch, high)));
>  
>  	  /* Dump the specified range.  */
>  	  gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
> @@ -1413,9 +1417,11 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
>  	    {
>  	      CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
>  	      CORE_ADDR range_high = BLOCK_RANGE_END (block, i);
> -	      printf_filtered (_("Address range %s to %s:\n"),
> -			       paddress (gdbarch, range_low),
> -			       paddress (gdbarch, range_high));
> +	      printf_filtered (_("Address range %ps to %ps:\n"),
> +			       styled_string (address_style.style (),
> +					      paddress (gdbarch, range_low)),
> +			       styled_string (address_style.style (),
> +					      paddress (gdbarch, range_high)));
>  	      gdb_disassembly (gdbarch, current_uiout, flags, -1,
>  			       range_low, range_high);
>  	    }

Your patch looks good, but, as a consistency thing, does GDB have a
position w.r.t. gettext macros?  Both these hunks are in the same
function, but only the second hunk's printf_filtered calls have _().

Thanks,
Gary

-- 
Gary Benson - he / him / his
Principal Software Engineer, Red Hat


  reply	other threads:[~2020-08-10 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 21:55 Tom Tromey
2020-08-10 14:25 ` Gary Benson [this message]
2020-10-09  1:26   ` Tom Tromey

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=20200810142517.GG12133@blade.nx \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).