public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tom@tromey.com>, Mark Wielaard <mark@klomp.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix gdb/coffread.c build on 32bit architectures
Date: Mon, 28 Aug 2023 07:27:00 -0700	[thread overview]
Message-ID: <5b5995f9-2175-45c9-a7a1-23ce73d44444@redhat.com> (raw)
In-Reply-To: <4c50f8c5-b0cd-4a63-85e8-62d5011b5b0c@redhat.com>

On 8/28/23 07:20, Keith Seitz via Gdb-patches wrote:
> 
> May I assume that converting to hex_string for printing these offsets is obvious
> or pre-approved?

Or to be more explicit (pardon me -- ECAFFEINE):

Use hex_string to output hexidecimal values

Late last week, I committed a patch that used %ld to output the
value of some offsets in coffread.c.  This caused a build failure
on 32-bit hardware, and Mark Wielaard offered up a quick fix by
using PRIxPTR.

As mentioned by Tom Tromey, the correct way to handle this is by using
a utility function such as hex_string.  This patch converts the two
%ld formats into %s w/hex_string instead.
---
  gdb/coffread.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/coffread.c b/gdb/coffread.c
index c609c963453..3caa7eb3175 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1325,8 +1325,8 @@ getsymname (struct internal_syment *symbol_entry)
    if (symbol_entry->_n._n_n._n_zeroes == 0)
      {
        if (symbol_entry->_n._n_n._n_offset > stringtab_length)
-	error (_("COFF Error: string table offset (%" PRIxPTR ") outside string table (length %ld)"),
-	       symbol_entry->_n._n_n._n_offset, stringtab_length);
+	error (_("COFF Error: string table offset (%s) outside string table (length %s)"),
+	       hex_string (symbol_entry->_n._n_n._n_offset), hex_string (stringtab_length));
        result = stringtab + symbol_entry->_n._n_n._n_offset;
      }
    else
-- 
2.41.0



  reply	other threads:[~2023-08-28 14:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3b0896a6-04d4-4c7c-ac32-9ae78acdb66c@redhat.com/>
2023-08-25 21:16 ` Mark Wielaard
2023-08-25 21:19   ` Keith Seitz
2023-08-28 14:08   ` Tom Tromey
2023-08-28 14:20     ` Keith Seitz
2023-08-28 14:27       ` Keith Seitz [this message]
2023-08-28 14:32     ` Mark Wielaard
2023-08-28 14:41       ` Andreas Schwab
2023-08-28 16:31       ` Tom Tromey
2023-08-28 16:33       ` 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=5b5995f9-2175-45c9-a7a1-23ce73d44444@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark@klomp.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).