public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: binutils@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/3] objdump: fix extended (256) disassembler colors
Date: Wed, 10 Aug 2022 15:24:37 +0100	[thread overview]
Message-ID: <091335e069804270ba8d9e217285c70743100603.1660139020.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1660139020.git.aburgess@redhat.com>

After commit:

  commit a88c79b77036e4778e70d62081c3cfd1044bb8e3
  Date:   Tue Aug 9 14:57:48 2022 +0100

      Default to enabling colored disassembly if output is to a terminal.

The 256 extended-color support for --disassembler-color was broken.
This is fixed in this commit.

	PR 29457
	* objdump (objdump_styled_sprintf): Check disassembler_color
	against an enum value, don't treat it as a bool.
---
 binutils/objdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binutils/objdump.c b/binutils/objdump.c
index 08c335476ff..9259c76c716 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2247,7 +2247,7 @@ objdump_styled_sprintf (SFILE *f, enum disassembler_style style,
 	{
 	  size_t space = f->alloc - f->pos;
 
-	  if (disassembler_color)
+	  if (disassembler_color == on)
 	    n = snprintf (f->buffer + f->pos, space, "\033[%dm", color);
 	  else
 	    n = snprintf (f->buffer + f->pos, space, "\033[38;5;%dm", color);
-- 
2.25.4


  reply	other threads:[~2022-08-10 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 14:24 [PATCH 0/3] Disassembler styling, bug fixes and customisation Andrew Burgess
2022-08-10 14:24 ` Andrew Burgess [this message]
2022-08-10 15:32   ` [PATCH 1/3] objdump: fix extended (256) disassembler colors Nick Clifton
2022-08-10 16:12     ` Andrew Burgess
2022-08-10 14:24 ` [PATCH 2/3] objdump: introduce OBJDUMP_COLORS environment variable Andrew Burgess
2022-08-10 15:48   ` Nick Clifton
2022-08-10 14:24 ` [PATCH 3/3] objdump: allow the disassembler colors to be customized Andrew Burgess
2022-08-10 15:57   ` Nick Clifton

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=091335e069804270ba8d9e217285c70743100603.1660139020.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    /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).