From: "Andrew Burgess (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>,
Simon Marchi <simon.marchi@polymtl.ca>,
Tom Tromey <tromey@sourceware.org>
Subject: [review v2] gdb: Support printf 'z' size modifier
Date: Thu, 07 Nov 2019 11:05:00 -0000 [thread overview]
Message-ID: <20191107110523.DAECE25B28@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1572968811000.Ib6c44d88aa5bce265d757e4c0698881803dd186f@gnutoolchain-gerrit.osci.io>
Andrew Burgess has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511
......................................................................
Patch Set 2:
(3 comments)
New version should hopefully correctly handle the argument as a different size and includes some selftests.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511/1//COMMIT_MSG
Commit Message:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511/1//COMMIT_MSG@11
PS1, Line 11:
6 |
7 | gdb: Support printf 'z' size modifier
8 |
9 | The gdb format mechanism doesn't currently support the 'z' size
10 | modifier, there are a few places in GDB where this is used. Instead
11 > of removing these uses lets just add support to GDB for using 'z'.
12 |
13 | I've not added a test for this as I ran into the issue when trying to
14 | use some debug output. Before this commit:
15 |
16 | (gdb) set debug dwarf-line 9
> Just FYI, we didn't use to allow 'z' since it is a C99 feature (and thus C++11), and older compilers [â¦]
I did consider just replacing all uses of %z with something else and casting the argument, there aren't that many uses so the patch would be pretty similar in size to what I've now posted. Let me know if you'd prefer this approach.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511/1//COMMIT_MSG@13
PS1, Line 13:
8 |
9 | The gdb format mechanism doesn't currently support the 'z' size
10 | modifier, there are a few places in GDB where this is used. Instead
11 | of removing these uses lets just add support to GDB for using 'z'.
12 |
13 > I've not added a test for this as I ran into the issue when trying to
14 > use some debug output. Before this commit:
15 |
16 | (gdb) set debug dwarf-line 9
17 | (gdb) file test
18 | Reading symbols from test...
19 | Unrecognized format specifier 'z' in printf
> It would seem easy enough to add an entry in test_format_specifier, in unittests/format_pieces-selft [â¦]
Done.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511/1/gdb/gdbsupport/format.c
File gdb/gdbsupport/format.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/511/1/gdb/gdbsupport/format.c@237
PS1, Line 237:
23 | format_pieces::format_pieces (const char **arg, bool gdb_extensions)
| ...
232 | seen_double_big_d = 1;
233 | }
234 | else
235 | seen_big_d = 1;
236 | }
237 > /* For size_t or ssize_t. */
238 > else if (*f == 'z')
239 > f++;
240 |
241 | switch (*f)
242 | {
243 | case 'u':
244 | if (seen_hash)
> This seems necessary but perhaps not sufficient -- nothing [â¦]
Thanks for this. I think I was fooled by it "just working" when treating the size_t as an int. I believe I've now handled this correctly.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib6c44d88aa5bce265d757e4c0698881803dd186f
Gerrit-Change-Number: 511
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Pedro Alves <palves@redhat.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 07 Nov 2019 11:05:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Pedro Alves <palves@redhat.com>
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment
next prev parent reply other threads:[~2019-11-07 11:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 15:46 [review] " 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) [this message]
2019-11-12 20:19 ` Kevin Buettner (Code Review)
2019-11-12 23:53 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-12 23:53 ` 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107110523.DAECE25B28@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=gdb-patches@sourceware.org \
--cc=gnutoolchain-gerrit@osci.io \
--cc=palves@redhat.com \
--cc=simon.marchi@polymtl.ca \
--cc=tromey@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox