public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/python: add gdb.Architecture.format_address
Date: Mon, 21 Feb 2022 20:02:22 +0200	[thread overview]
Message-ID: <837d9oumhd.fsf@gnu.org> (raw)
In-Reply-To: <878ru4cepy.fsf@redhat.com> (message from Andrew Burgess on Mon,  21 Feb 2022 17:27:21 +0000)

> From: Andrew Burgess <aburgess@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Mon, 21 Feb 2022 17:27:21 +0000
> 
> I'm certainly not against renaming, if we can come up with a better
> name... maybe 'format_address_info'?  I don't know... I still kind of
> like 'format_address'...

I hope someone will come up with a better name.

> +@defun Architecture.format_address (@var{address})
> +Return a string in the format @samp{ADDRESS <SYMBOL+OFFSET>}, where
> +@samp{ADDRESS} is @var{address} formatted in hexadecimal,
> +@samp{SYMBOL} is a symbol, the address range of which, covers
> +@var{address}, and @samp{OFFSET} is the offset from @samp{SYMBOL} to
> +@var{address} in decimal.  This is the same format that @value{GDBN}
> +uses when printing address, symbol, and offset information, for
> +example, within disassembler output.
> +
> +If no @samp{SYMBOL} has an address range that covers @var{address},
> +then the @samp{<SYMBOL+OFFSET>} part is not included in the returned
> +string, instead the returned string will just contain the
> +@var{address} formatted as hexadecimal.
> +
> +In all cases, the @samp{ADDRESS} component will be padded with leading
> +zeros based on the width of an address for the current architecture.

This is okay, but needs the markup fixed.  All the places where you
use SOMETHING ("ADDRESS", "SYMBOL", etc.) should be @var{something},
i.e. have the @var markup and be in lower-case.  (To prevent confusion
with the argument @var{address}, call it something else, like
@var{addr}.)  Also, remove @samp everywhere except this single
instance:

   @samp{@var{address} <@var{symbol}+@var{offset}>}

And finally, this text:

> @samp{SYMBOL} is a symbol, the address range of which, covers
> +@var{address}

is better worded as

  @var{symbol} is the symbol to which @var{addr} belongs

Btw, is the above accurate? does GDB really guarantee that ADDR is
p[art of SYMBOL's memory? or does it just find the closest symbol
whose address is smaller than ADDR?

Thanks.

  reply	other threads:[~2022-02-21 18:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 16:17 Andrew Burgess
2022-02-11 18:54 ` Eli Zaretskii
2022-02-21 17:27   ` Andrew Burgess
2022-02-21 18:02     ` Eli Zaretskii [this message]
2022-02-22 13:56       ` Andrew Burgess
2022-02-22 14:48         ` Eli Zaretskii
2022-02-23 14:20           ` Andrew Burgess
2022-03-03 16:49             ` Andrew Burgess
2022-03-03 18:35         ` Craig Blackmore
2022-03-04 10:51           ` Andrew Burgess
2022-03-04 10:50 ` [PATCHv2] " Andrew Burgess
2022-03-04 15:22   ` Simon Marchi
2022-03-07 12:33   ` [PATCHv3] gdb/python: add gdb.format_address function Andrew Burgess
2022-03-21 17:53     ` Andrew Burgess
2022-03-21 18:23     ` Simon Marchi
2022-03-22 13:19       ` Andrew Burgess
2022-03-23 12:14         ` Simon Marchi
2022-03-23 15:30           ` Andrew Burgess
2022-03-28 21:59             ` Simon Marchi
2022-03-29 13:38               ` Andrew Burgess

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=837d9oumhd.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@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).