diff mbox

Avoid using the ISO C99 `z' formatted output modifier

Message ID alpine.DEB.1.10.1403191837150.23119@tp.orcam.me.uk
State Committed
Headers show

Commit Message

Maciej W. Rozycki March 19, 2014, 6:47 p.m. UTC
Hi,

 This fixes a call in mi_memory_changed that makes use of the ISO C99 `z' 
formatted output modifier.  We still require ISO C90 conformance.  This 
update removes a failure on the i686-mingw32 host (tested with the 
powerpc-eabi target):

(gdb)
PASS: gdb.mi/mi-memory-changed.exp: continue to callee4
Expecting: ^(set var C = 4[
]+)?(.*=memory-changed,thread-group="i[0-9]+".addr="0x[0-9A-Fa-f]+",len="0x[0-9A-Fa-f]+".*\^done[
]+[(]gdb[)]
[ ]*)
set var C = 4
&"set var C = 4\n"
=memory-changed,thread-group="i1",addr="0x17ffff28",len="0xzx"
^done
(gdb)
FAIL: gdb.mi/mi-memory-changed.exp: set var C = 4

With the change applied the log is as follows:

(gdb)
PASS: gdb.mi/mi-memory-changed.exp: continue to callee4
Expecting: ^(set var C = 4[
]+)?(.*=memory-changed,thread-group="i[0-9]+".addr="0x[0-9A-Fa-f]+",len="0x[0-9A-Fa-f]+".*\^done[
]+[(]gdb[)]
[ ]*)
set var C = 4
&"set var C = 4\n"
=memory-changed,thread-group="i1",addr="0x17ffff28",len="0x4"
^done
(gdb)
PASS: gdb.mi/mi-memory-changed.exp: set var C = 4

No change in output on the i686-linux-gnu host.  OK to apply?

2014-03-19  Maciej W. Rozycki  <macro@codesourcery.com>

	gdb/
	* mi/mi-interp.c (mi_memory_changed): Avoid using the ISO C99
	`z' formatted output modifier.

  Maciej

gdb-mi-interp-size-t-printf.diff

Comments

Joel Brobecker March 20, 2014, 12:23 p.m. UTC | #1
Hi Maciej,

> 2014-03-19  Maciej W. Rozycki  <macro@codesourcery.com>
> 
> 	gdb/
> 	* mi/mi-interp.c (mi_memory_changed): Avoid using the ISO C99
> 	`z' formatted output modifier.

LGTM - go ahead and commit.

Thank you,
Maciej W. Rozycki March 20, 2014, 9:44 p.m. UTC | #2
On Thu, 20 Mar 2014, Joel Brobecker wrote:

> > 	* mi/mi-interp.c (mi_memory_changed): Avoid using the ISO C99
> > 	`z' formatted output modifier.
> 
> LGTM - go ahead and commit.

 Thanks, applied.

  Maciej
diff mbox

Patch

Index: gdb-fsf-trunk-quilt/gdb/mi/mi-interp.c
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/mi/mi-interp.c	2014-01-14 22:02:56.000000000 +0000
+++ gdb-fsf-trunk-quilt/gdb/mi/mi-interp.c	2014-03-19 13:25:57.018399978 +0000
@@ -854,7 +854,7 @@  mi_memory_changed (struct inferior *infe
 
   ui_out_field_fmt (mi_uiout, "thread-group", "i%d", inferior->num);
   ui_out_field_core_addr (mi_uiout, "addr", target_gdbarch (), memaddr);
-  ui_out_field_fmt (mi_uiout, "len", "0x%zx", len);
+  ui_out_field_fmt (mi_uiout, "len", "%s", hex_string (len));
 
   /* Append 'type=code' into notification if MEMADDR falls in the range of
      sections contain code.  */