This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Avoid using the ISO C99 `z' formatted output modifier


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
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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]