public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Tom Tromey <tom@tromey.com>
Cc: Alan Modra via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: Don't use BFD_VMA_FMT in gdb and sim
Date: Fri, 5 Aug 2022 20:51:40 +0930	[thread overview]
Message-ID: <Yuz9RDd30V7/1JHZ@squeak.grove.modra.org> (raw)
In-Reply-To: <87zggjga9u.fsf@tromey.com>

On Thu, Aug 04, 2022 at 11:59:25AM -0600, Tom Tromey wrote:
> >>>>> "Alan" == Alan Modra via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Alan> Like commit b82817674f, this replaces BFD_VMA_FMT "x" with PRIx64,
> Alan> and casts to promote bfd_vma to uint64_t.
> 
> Alan> Tested with both 64-bit and 32-bit gdb builds, and 64-bit make check.
> Alan> OK to install?
> 
> Alan> diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
> Alan> index 2516e4ed058..c2823191b42 100644
> Alan> --- a/gdb/windows-tdep.c
> Alan> +++ b/gdb/windows-tdep.c
> Alan> @@ -1011,10 +1011,10 @@ is_linked_with_cygwin_dll (bfd *abfd)
> Alan>        || import_table_va >= idata_section_end_va)
> Alan>      {
> Alan>        warning (_("\
> Alan> -%s: import table's virtual address (0x%" BFD_VMA_FMT "x) is outside .idata \
> Alan> -section's range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
> Alan> -	       bfd_get_filename (abfd), import_table_va, idata_section_va,
> Alan> -	       idata_section_end_va);
> Alan> +%s: import table's virtual address (0x%" PRIx64 ") is outside .idata \
> Alan> +section's range [0x%" PRIx64 ", 0x%" PRIx64 "[."),
> Alan> +	       bfd_get_filename (abfd), (uint64_t) import_table_va,
> Alan> +	       (uint64_t) idata_section_va, (uint64_t) idata_section_end_va);
> 
> For gdb, it's more normal to use %s and 'hex_string (value)'.
> hex_string will add the 0x as well.  It's fine to call it multiple times
> in a single printf.

OK, here's a revision of the gdb/windows-tdep.c changes.  With range
bracket fixed too.  sim/ remains as before.

diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index a34ac5e5f0a..702af65d450 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -1007,10 +1007,11 @@ is_linked_with_cygwin_dll (bfd *abfd)
       || import_table_va >= idata_section_end_va)
     {
       warning (_("\
-%s: import table's virtual address (0x%" BFD_VMA_FMT "x) is outside .idata \
-section's range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
-	       bfd_get_filename (abfd), import_table_va, idata_section_va,
-	       idata_section_end_va);
+%s: import table's virtual address (%s) is outside .idata \
+section's range [%s, %s]."),
+	       bfd_get_filename (abfd), hex_string (import_table_va),
+	       hex_string (idata_section_va),
+	       hex_string (idata_section_end_va));
       return false;
     }
 
@@ -1057,10 +1058,11 @@ section's range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
       if (name_va < idata_section_va || name_va >= idata_section_end_va)
 	{
 	  warning (_("\
-%s: name's virtual address (0x%" BFD_VMA_FMT "x) is outside .idata section's \
-range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
-		   bfd_get_filename (abfd), name_va, idata_section_va,
-		   idata_section_end_va);
+%s: name's virtual address (%s) is outside .idata section's \
+range [%s, %s]."),
+		   bfd_get_filename (abfd), hex_string (name_va),
+		   hex_string (idata_section_va),
+		   hex_string (idata_section_end_va));
 	  break;
 	}
 

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2022-08-05 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  5:32 Alan Modra
2022-08-04 17:59 ` Tom Tromey
2022-08-05 11:21   ` Alan Modra [this message]
2022-08-05 15:29     ` 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=Yuz9RDd30V7/1JHZ@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).