public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] objdump: Round ASCII art lines in jump visualization
@ 2023-07-07 21:47 Waqar Hameed
  2023-07-18 15:24 ` Nick Clifton
  2024-04-23 15:11 ` Nick Clifton
  0 siblings, 2 replies; 6+ messages in thread
From: Waqar Hameed @ 2023-07-07 21:47 UTC (permalink / raw)
  To: binutils

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-23 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07 21:47 [PATCH] objdump: Round ASCII art lines in jump visualization Waqar Hameed
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

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).