* [PATCH] sim: common: fix printf formats
@ 2021-01-09 19:09 Mike Frysinger via Gdb-patches
2021-01-11 11:33 ` Andrew Burgess
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger via Gdb-patches @ 2021-01-09 19:09 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sim: common: fix printf formats
2021-01-09 19:09 [PATCH] sim: common: fix printf formats Mike Frysinger via Gdb-patches
@ 2021-01-11 11:33 ` Andrew Burgess
2021-01-11 13:28 ` Mike Frysinger via Gdb-patches
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2021-01-11 11:33 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
* Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-09 14:09:35 -0500]:
> 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.
Missing ChangeLog, otherwise, LGTM.
Thanks,
Andrew
>
> * 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-11 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 19:09 [PATCH] sim: common: fix printf formats Mike Frysinger via Gdb-patches
2021-01-11 11:33 ` Andrew Burgess
2021-01-11 13:28 ` Mike Frysinger via Gdb-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox