public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: common: fix printf formats
@ 2021-01-09 19:09 Mike Frysinger
  2021-01-11 11:33 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 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
@ 2021-01-11 11:33 ` Andrew Burgess
  2021-01-11 13:28   ` Mike Frysinger
  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

* Re: [PATCH] sim: common: fix printf formats
  2021-01-11 11:33 ` Andrew Burgess
@ 2021-01-11 13:28   ` Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2021-01-11 13:28 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

On 11 Jan 2021 11:33, Andrew Burgess wrote:
> * 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.

it was in the commit message:

> > * sim-core.c (sim_memory_map): Change %#x to PRIxTW.

-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ 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
2021-01-11 11:33 ` Andrew Burgess
2021-01-11 13:28   ` Mike Frysinger

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).