Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [review] gdb: Support printf 'z' size modifier
@ 2019-11-05 15:46 Andrew Burgess (Code Review)
  2019-11-05 16:22 ` Tom Tromey (Code Review)
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-05 15:46 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511
......................................................................

gdb: Support printf 'z' size modifier

The gdb format mechanism doesn't currently support the 'z' size
modifier, there are a few places in GDB where this is used.  Instead
of removing these uses lets just add support to GDB for using 'z'.

I've not added a test for this as I ran into the issue when trying to
use some debug output.  Before this commit:

  (gdb) set debug dwarf-line 9
  (gdb) file test
  Reading symbols from test...
  Unrecognized format specifier 'z' in printf
  (No debugging symbols found in test)
  (gdb)

After this commit:

  (gdb) set debug dwarf-line 9
  (gdb) file test
  Reading symbols from test...
  Adding dir 1: /usr/include
  Adding file 1: test.c
  Adding file 2: stdc-predef.h
  Processing actual line 3: file 1, address 0x4004a0, is_stmt 1, discrim 0
  Processing actual line 4: file 1, address 0x4004a0, is_stmt 1, discrim 0
  Processing actual line 5: file 1, address 0x4004a0, is_stmt 0, discrim 0
  Processing actual line 5: file 1, address 0x4004a6, is_stmt 0, discrim 0
  Processing actual line 15: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Processing actual line 16: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Processing actual line 10: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Processing actual line 10: file 1, address 0x4003b0, is_stmt 0, discrim 0
  Processing actual line 10: file 1, address 0x4003b7, is_stmt 0, discrim 0
  Adding dir 1: /usr/include
  Adding file 1: test.c
  Adding file 2: stdc-predef.h
  Processing actual line 3: file 1, address 0x4004a0, is_stmt 1, discrim 0
  Recording line 3, file test.c, address 0x4004a0
  Processing actual line 4: file 1, address 0x4004a0, is_stmt 1, discrim 0
  Recording line 4, file test.c, address 0x4004a0
  Processing actual line 5: file 1, address 0x4004a0, is_stmt 0, discrim 0
  Processing actual line 5: file 1, address 0x4004a6, is_stmt 0, discrim 0
  Processing actual line 15: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Recording line 15, file test.c, address 0x4003b0
  Processing actual line 16: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Recording line 16, file test.c, address 0x4003b0
  Processing actual line 10: file 1, address 0x4003b0, is_stmt 1, discrim 0
  Recording line 10, file test.c, address 0x4003b0
  Processing actual line 10: file 1, address 0x4003b0, is_stmt 0, discrim 0
  Processing actual line 10: file 1, address 0x4003b7, is_stmt 0, discrim 0
  (gdb)

gdb/ChangeLog:

	* gdbsupport/format.c (format_pieces::format_pieces): Support
	printf 'z' size modifier.

Change-Id: Ib6c44d88aa5bce265d757e4c0698881803dd186f
---
M gdb/ChangeLog
M gdb/gdbsupport/format.c
2 files changed, 8 insertions(+), 0 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 41daef6..d29fffe 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdbsupport/format.c (format_pieces::format_pieces): Support
+	printf 'z' size modifier.
+
 2019-11-04  Christian Biesinger  <cbiesinger@google.com>
 
 	* psympriv.h: Add static_asserts for sizeof (general_symbol_info)
diff --git a/gdb/gdbsupport/format.c b/gdb/gdbsupport/format.c
index 1e80350..fea73c8 100644
--- a/gdb/gdbsupport/format.c
+++ b/gdb/gdbsupport/format.c
@@ -234,6 +234,9 @@
 	    else
 	      seen_big_d = 1;
 	  }
+	/* For size_t or ssize_t.  */
+	else if (*f == 'z')
+	  f++;
 
 	switch (*f)
 	  {

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib6c44d88aa5bce265d757e4c0698881803dd186f
Gerrit-Change-Number: 511
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-MessageType: newchange


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-11-15  7:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 15:46 [review] gdb: Support printf 'z' size modifier Andrew Burgess (Code Review)
2019-11-05 16:22 ` Tom Tromey (Code Review)
2019-11-05 16:31 ` Simon Marchi (Code Review)
2019-11-06  0:18 ` Pedro Alves (Code Review)
2019-11-07 10:59 ` [review v2] " Andrew Burgess (Code Review)
2019-11-07 11:05 ` Andrew Burgess (Code Review)
2019-11-12 20:19 ` Kevin Buettner (Code Review)
2019-11-12 23:53 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-14 12:55   ` Eli Zaretskii
2019-11-14 16:49     ` Andrew Burgess
2019-11-14 16:59       ` Eli Zaretskii
2019-11-14 17:09         ` Simon Marchi
2019-11-14 18:27           ` Eli Zaretskii
2019-11-14 20:37             ` Pedro Alves
2019-11-15  7:37               ` Eli Zaretskii
2019-11-14 17:06       ` Pedro Alves
2019-11-14 18:18         ` Eli Zaretskii
2019-11-14 21:27       ` Tom Tromey
2019-11-12 23:53 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox