Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: common: fix printf formats
Date: Sat,  9 Jan 2021 14:09:35 -0500	[thread overview]
Message-ID: <20210109190935.13594-1-vapier@gentoo.org> (raw)

For 32-bit targets, %x happens to work for unsigned_word.  But for
64-bit targets, it's too small, and gcc throws an error.  Use the
right printf format define for them.

* sim-core.c (sim_memory_map): Change %#x to PRIxTW.
---
 sim/common/sim-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index ade345ef16fb..9b1e16832104 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -480,7 +480,8 @@ sim_memory_map (SIM_DESC sd)
 	  if (mapping->level != 0)
 	    continue;
 
-	  entry = xasprintf ("<memory type='ram' start='%#x' length='%#x'/>\n",
+	  entry = xasprintf ("<memory type='ram' start='%#" PRIxTW "' "
+			     "length='%#" PRIxTW "'/>\n",
 			     mapping->base, mapping->nr_bytes);
 	  /* The sim memory map is organized by access, not by addresses.
 	     So a RWX memory map will have three independent mappings.
-- 
2.28.0


             reply	other threads:[~2021-01-09 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 19:09 Mike Frysinger via Gdb-patches [this message]
2021-01-11 11:33 ` Andrew Burgess
2021-01-11 13:28   ` Mike Frysinger via Gdb-patches

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=20210109190935.13594-1-vapier@gentoo.org \
    --to=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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