From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42625 invoked by alias); 17 Jul 2019 16:41:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42617 invoked by uid 89); 17 Jul 2019 16:41:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=What=e2, displaying, H*M:c628?= X-HELO: mail-wm1-f67.google.com Received: from mail-wm1-f67.google.com (HELO mail-wm1-f67.google.com) (209.85.128.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jul 2019 16:41:37 +0000 Received: by mail-wm1-f67.google.com with SMTP id s3so22842574wms.2 for ; Wed, 17 Jul 2019 09:41:37 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id y16sm47940081wrg.85.2019.07.17.09.41.34 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 09:41:34 -0700 (PDT) Subject: Re: [PATCH] AArch64 pauth: Indicate unmasked addresses in backtrace To: Alan Hayward References: <20190717081336.68835-1-alan.hayward@arm.com> <68E9D3EF-D6A5-44C9-A87C-916EC6970435@arm.com> <9c474f28-30f3-2428-d147-4474471a61ba@redhat.com> <8009C474-AE70-4A5B-A2D9-EB3B90626D95@arm.com> Cc: Simon Marchi , "gdb-patches\\@sourceware.org" , nd From: Pedro Alves Message-ID: Date: Wed, 17 Jul 2019 16:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <8009C474-AE70-4A5B-A2D9-EB3B90626D95@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-07/txt/msg00397.txt.bz2 On 7/17/19 5:07 PM, Alan Hayward wrote: >> I almost suggested the same, but didn't when I realized that we >> don't always print the addresses: >> >> (top-gdb) bt >> #0 gdb_main (args=0x7fffffffd3a0) at src/gdb/main.c:1186 >> #1 0x0000000000469a7e in main (argc=1, argv=0x7fffffffd4a8) at src/gdb/gdb.c:32 >> > > What’s the reason for that? Surely we always know the address of a function > in the backtrace? Can it happen in the middle of a backtrace? "It always worked that way", at least for me. We show an address if the PC is pointing to the middle of a line, or we don't have debug info. If pointing at a line exactly, then we show no address. (gdb) frame #0 main (argc=1, argv=0x7fffffffd4a8) at src/gdb/gdb.c:29 29 args.argc = argc; (gdb) si 0x0000000000469a5f 29 args.argc = argc; (gdb) frame #0 0x0000000000469a5f in main (argc=1, argv=0x7fffffffd4a8) at src/gdb/gdb.c:29 29 args.argc = argc; Same logic for when displaying the frame where a program stops, when stepping, ctrl-c, breakpoint hits, etc. Breakpoint 5, main (argc=1, argv=0x7fffffffd4a8) at src/gdb/gdb.c:28 ^^^^ 28 memset (&args, 0, sizeof args); (gdb) p /x $pc $1 = 0x469a46 (top-gdb) del Delete all breakpoints? (y or n) y (top-gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: build/gdb/gdb Breakpoint 6, 0x0000000000469a4a in main (argc=1, argv=0x7fffffffd4a8) at src/gdb/gdb.c:28 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 memset (&args, 0, sizeof args); > > >> But if you do want to align the addresses, you could do that by >> specifying a width for the "addr" column. > >> If "[U]" is rare, given no column >> headers, the spaces may look a bit odd, though. > > In general, it depends how a binary/library was compiled. But I’d expect a binary > to either have it in most functions or none. > > Should be easy enough to remove the extra spaces if the system doesn’t support PAC. > > >> Maybe you'd want to pre-compute >> the max column width by looking at the max number of frames that fit on a >> page, or something along those lines. >> > > hmmm... ok. I’ll see what I can do there. If most functions have it, then I wouldn't bother trying to compute the max column width. But then if most functions have it, I wonder what's the point of showing the marker, though. :-) Would it make sense to reverse the logic? Thanks, Pedro Alves