Message ID | 878rbrgzoz.fsf@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3556994vqx; Fri, 7 Jul 2023 14:49:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlENc2b8v5GYY/dGsxx5I0yj207LiODzHbAkhMuhzrezRbNPe9t2+sETbty2Po04OP1vDZJm X-Received: by 2002:aa7:c541:0:b0:51e:166d:8e95 with SMTP id s1-20020aa7c541000000b0051e166d8e95mr4724643edr.4.1688766559222; Fri, 07 Jul 2023 14:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688766559; cv=none; d=google.com; s=arc-20160816; b=ouIOS5Wrk8LGpYdvElkfBhcfakKa3pb9PraUjDsKdj6uwJzWqHzP93ir46d7Yhkbyb z1iQ/AQMV5LvanrCzhaYUxpBuniwoVY7PU5ZdbVt55BOBLnmh3rm6SWaGnkTASksqmsH IKSZDUeIZbdjKQLsrjUjhcIfXk00EOvKFTS12MHcb/pN6to5tMAWRVy5itFNPXbJ2Si4 ljRh237rxuo0GlUmfyJFRzSZtkgLipQOmc2/ydJ++Arq8gyL0ch4LcBGRVKhq0YVqKpY 43eBfc2hwe/K+q28ddPahnMn9wQKMbOnTz2YeTGFedzXOq7+g7gKi4a9a7j8tINY7sEo rlww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :message-id:date:subject:to:user-agent:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=9mm8cYZKQBUanaqIrnBxJO8cwbz8LJcZNzFRk9/YBPc=; fh=F6pypGq8gtAf/EHLkW/cZCjl9uAz7NzzdxXtR/iZSt8=; b=L+zqMoAHM/ZXR9Hr3xuWutvI7fvYoVftYHWqqa5Moy0TOKQT9YBJ8BYVn/SvL2JV75 wcEqYEzTkhiKIh8fbVE5oqeWd8EQ+4GZhkafZAyDn2wSed1zVbW+Jc8EjwFBJ5KPkLSk EVM2VF91ugkeOtvyn7nEPeGdAcfkR/Q8697PFv3XsvnIXuTM/TIahMZ9ljn54xsk8miN fmlMaztujyPGySgu8E6dyyvPs3aJynVGqYjPoVOsGpJxKH2SliG8ro5zEYxmlfwngiDZ Dd6MA+yu1PAfSvMHtDZZhI/9C2ulPcETttKwgpuzRWRR+IfFXKlRJhjXRoQWkO6dbUHf 2+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rFQc3WI8; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n5-20020aa7c685000000b0051e2cde98c5si1569180edq.245.2023.07.07.14.49.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 14:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rFQc3WI8; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 520873851C01 for <ouuuleilei@gmail.com>; Fri, 7 Jul 2023 21:49:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 520873851C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688766556; bh=9mm8cYZKQBUanaqIrnBxJO8cwbz8LJcZNzFRk9/YBPc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rFQc3WI8Axua813l8ZUwhNok5JgldbAUrc6GdIRrBC5H2isTRNo5flJeSbfNxGsv4 3KzKeC91z9bHvcH+UF3nSebGltjONdyIBWPp0PpNlzf3NI8XwyukOYHSl8ohw/Xdoz 6QrSQbubFIuvzj4pItK552mmBJl2OBBv6RvfrceM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id CDCA33858C60 for <binutils@sourceware.org>; Fri, 7 Jul 2023 21:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDCA33858C60 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbd33a57dcso26392345e9.0 for <binutils@sourceware.org>; Fri, 07 Jul 2023 14:49:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688766546; x=1691358546; h=mime-version:message-id:date:subject:to:from:user-agent :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9mm8cYZKQBUanaqIrnBxJO8cwbz8LJcZNzFRk9/YBPc=; b=kprIZd+/jOaOLUNxMrzY9K6h5LtLZp03dGEa3M5kNvyXdoWpyCtgNtnPGo/Ep15W2a NMOBQRzr6R8TwjTfFwD5C+9u7q/RRCVeBDxdZVbboFvJ1fBUG3lb5hm6gTvMKMIrRLCB 155suMCt4iATgc+6xe6bnWe/2Tw59vBBd6lApaU1+dWS9ILNfa1LTF+JDV4jo4ZBqIZp iWAT3nbk48C+/sxRSQq/D8rKbPcjYr4lIpLTMr7JXWsacO/DmkedpT9lX6/h0/WXFAOI Hd+F2hi6uecnFnjtT/SLtY12YadxmMzkrIz/xo4PLokbw54UYnbveqa0l5J1jQjTcUGc aGGA== X-Gm-Message-State: ABy/qLZl4JodAFxE5lEuBQweRbodKJBynP70rXBsDHCOZPxKm3HK0SvU mQMb5YHcrHICtu8AtuHi22mCxYU72ZI= X-Received: by 2002:a7b:c7d9:0:b0:3f5:146a:c79d with SMTP id z25-20020a7bc7d9000000b003f5146ac79dmr4745272wmk.15.1688766546403; Fri, 07 Jul 2023 14:49:06 -0700 (PDT) Received: from wractal (c-5dabe455.023-86-6d6c6d4.bbcust.telenor.se. [85.228.171.93]) by smtp.gmail.com with ESMTPSA id v7-20020a1cf707000000b003fbc89af035sm3464534wmh.17.2023.07.07.14.49.05 for <binutils@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 14:49:06 -0700 (PDT) User-agent: a.out To: binutils@sourceware.org Subject: [PATCH] objdump: Round ASCII art lines in jump visualization Date: Fri, 07 Jul 2023 23:47:48 +0200 Message-ID: <878rbrgzoz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Waqar Hameed via Binutils <binutils@sourceware.org> Reply-To: Waqar Hameed <whame91@gmail.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770800083408157228?= X-GMAIL-MSGID: =?utf-8?q?1770800083408157228?= |
Series |
objdump: Round ASCII art lines in jump visualization
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Waqar Hameed
July 7, 2023, 9:47 p.m. UTC
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(-)
Comments
Hi Waqar, > Lines with rounded corners are easier to follow (and easier on the > eyes). Use `,` and `'` instead of `/` and `\`, respectively, when > drawing lines for jumps. Well this is kind of a personal thing, and not everyone may agree with your choice of characters. So how about allowing the user to select the characters that they like ? For example if you added a new command line option: --visualize-jump-chars="/,+>'" which could then be used to provide the characters displayed at various points on the graph. Obviously this would be a more complicated patch, and would require adding some more documentation, but overall I think that it would be worthwhile... Cheers Nick
On Tue, Jul 18, 2023 at 16:24 Nick Clifton <nickc@redhat.com> wrote: >> Lines with rounded corners are easier to follow (and easier on the >> eyes). Use `,` and `'` instead of `/` and `\`, respectively, when >> drawing lines for jumps. > > Well this is kind of a personal thing, and not everyone may agree with > your choice of characters. So how about allowing the user to select the > characters that they like ? For example if you added a new command line > option: > > --visualize-jump-chars="/,+>'" > > which could then be used to provide the characters displayed at various > points on the graph. Obviously this would be a more complicated patch, > and would require adding some more documentation, but overall I think that > it would be worthwhile... I understand that this is highly subjective and not everyone would agree with the argument stated in the commit message (I guess the "scientific method" would be to do a survey :) ). I don't think an option that specifies characters would make much sense; there is only a small subset of characters that qualifies to represent lines. An option to choose "ASCII style" is probably better, e.g. `--visualize-jumps=round` or something. However, I'm OK with just dropping this patch. It's not really a big deal.
Hi Waqar, > However, I'm OK with just dropping this patch. It's not really a big > deal. OK, well then lets keep things simple and leave them as they are. But thank you for submitting the patch, and please feel free to submit more patches in the future. Cheers Nick
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; } }