public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Waqar Hameed <whame91@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH] objdump: Round ASCII art lines in jump visualization
Date: Fri, 07 Jul 2023 23:47:48 +0200	[thread overview]
Message-ID: <878rbrgzoz.fsf@gmail.com> (raw)

Lines with rounded corners are easier to follow (and easier on the
eyes). Use `,` and `'` instead of `/` and `\`, respectively, when
drawing lines for jumps.

Before:

    <debug_get_target_type>:
                         endbr64
                         test   %rsi,%rsi
            /----------- je     <debug_get_target_type+0x48>
            |            sub    $0x8,%rsp
            |            xor    %edx,%edx
            |            call   <debug_get_real_type>
            |            test   %rax,%rax
            |  /-------- je     <debug_get_target_type+0x3d>
            |  |         mov    (%rax),%edx
            |  |         cmp    $0x14,%edx
            |  |  /----- je     <debug_get_target_type+0x2c>
            |  |  |  /-- ja     <debug_get_target_type+0x38>
            |  |  |  |   cmp    $0xc,%edx
            |  |  +--|-- je     <debug_get_target_type+0x2c>
            |  |  |  |   cmp    $0xe,%edx
            |  +--|--|-- jne    <debug_get_target_type+0x3d>
            |  |  >--|-> mov    0x18(%rax),%rax
            |  |  |  |   add    $0x8,%rsp
            |  |  |  |   ret
            |  |  |  |   nopl   (%rax)
            |  |  |  \-> cmp    $0x15,%edx
            |  |  \----- je     <debug_get_target_type+0x2c>
            |  \-------> xor    %eax,%eax
            |            add    $0x8,%rsp
            |            ret
            |            nopl   0x0(%rax)
            \----------> xor    %eax,%eax
                         ret
                         nopl   0x0(%rax,%rax,1)

After:

    <debug_get_target_type>:
                         endbr64
                         test   %rsi,%rsi
            ,----------- je     <debug_get_target_type+0x48>
            |            sub    $0x8,%rsp
            |            xor    %edx,%edx
            |            call   <debug_get_real_type>
            |            test   %rax,%rax
            |  ,-------- je     <debug_get_target_type+0x3d>
            |  |         mov    (%rax),%edx
            |  |         cmp    $0x14,%edx
            |  |  ,----- je     <debug_get_target_type+0x2c>
            |  |  |  ,-- ja     <debug_get_target_type+0x38>
            |  |  |  |   cmp    $0xc,%edx
            |  |  +--|-- je     <debug_get_target_type+0x2c>
            |  |  |  |   cmp    $0xe,%edx
            |  +--|--|-- jne    <debug_get_target_type+0x3d>
            |  |  >--|-> mov    0x18(%rax),%rax
            |  |  |  |   add    $0x8,%rsp
            |  |  |  |   ret
            |  |  |  |   nopl   (%rax)
            |  |  |  '-> cmp    $0x15,%edx
            |  |  '----- je     <debug_get_target_type+0x2c>
            |  '-------> xor    %eax,%eax
            |            add    $0x8,%rsp
            |            ret
            |            nopl   0x0(%rax)
            '----------> xor    %eax,%eax
                         ret
                         nopl   0x0(%rax,%rax,1)

Signed-off-by: Waqar Hameed <whame91@gmail.com>
---
 binutils/objdump.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/binutils/objdump.c b/binutils/objdump.c
index a35982ea969..ca4813ce872 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2873,10 +2873,10 @@ jump_info_visualize_address (bfd_vma address,
 		{
 		  if (address <= ji->end)
 		    line_buffer[offset] =
-		      (jump_info_min_address (ji) == address) ? '/': '+';
+		      (jump_info_min_address (ji) == address) ? ',': '+';
 		  else
 		    line_buffer[offset] =
-		      (jump_info_max_address (ji) == address) ? '\\': '+';
+		      (jump_info_max_address (ji) == address) ? '\'': '+';
 		  color_buffer[offset] = color;
 		}
 	    }
@@ -2907,9 +2907,9 @@ jump_info_visualize_address (bfd_vma address,
 		{
 		  if (jump_info_min_address (ji) < address)
 		    line_buffer[offset] =
-		      (jump_info_max_address (ji) > address) ? '>' : '\\';
+		      (jump_info_max_address (ji) > address) ? '>' : '\'';
 		  else
-		    line_buffer[offset] = '/';
+		    line_buffer[offset] = ',';
 		  color_buffer[offset] = color;
 		}
 	    }
-- 
2.34.1


             reply	other threads:[~2023-07-07 21:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 21:47 Waqar Hameed [this message]
2023-07-18 15:24 ` Nick Clifton
2023-07-18 17:21   ` Waqar Hameed
2023-07-19 10:18     ` Nick Clifton
2024-04-23 15:11 ` Nick Clifton
2024-04-23 17:09   ` Waqar Hameed

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=878rbrgzoz.fsf@gmail.com \
    --to=whame91@gmail.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).