From: Pedro Alves <palves@redhat.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
"gdb-patches\\@sourceware.org" <gdb-patches@sourceware.org>,
nd <nd@arm.com>
Subject: Re: [PATCH] AArch64 pauth: Indicate unmasked addresses in backtrace
Date: Wed, 17 Jul 2019 16:41:00 -0000 [thread overview]
Message-ID: <ed33a79b-c628-9d9d-bb86-a303bda53750@redhat.com> (raw)
In-Reply-To: <8009C474-AE70-4A5B-A2D9-EB3B90626D95@arm.com>
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
next prev parent reply other threads:[~2019-07-17 16:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 8:14 Alan Hayward
2019-07-17 11:15 ` Pedro Alves
2019-07-17 13:36 ` Alan Hayward
2019-07-17 14:44 ` Pedro Alves
2019-07-17 15:02 ` Simon Marchi
2019-07-17 15:18 ` Pedro Alves
2019-07-17 16:07 ` Alan Hayward
2019-07-17 16:41 ` Pedro Alves [this message]
2019-07-17 17:34 ` Alan Hayward
2019-07-18 13:48 ` Tom Tromey
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=ed33a79b-c628-9d9d-bb86-a303bda53750@redhat.com \
--to=palves@redhat.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
--cc=simon.marchi@polymtl.ca \
/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