From: Keith Seitz <keiths@redhat.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix bad interaction between element limit and repeated values (BZ#24331).
Date: Sat, 13 May 2023 10:30:21 -0700 [thread overview]
Message-ID: <8f642a5b-7144-5cca-5566-a1dadc9e93fc@redhat.com> (raw)
In-Reply-To: <20230508012211.3770553-1-ppluzhnikov@google.com>
Hi,
On 5/7/23 18:22, Paul Pluzhnikov via Gdb-patches wrote:
> Currently
>
> print -elements=3 -- "AAAAAA"
>
> prints complete string, which is not what the user asked for.
>
> Fix two buggy tests exposed by the fix, and add a new test.
Thank you for the patch. I just have one small ask.
> diff --git a/gdb/valprint.c b/gdb/valprint.c
> index b05d90dd26b..b770c93d805 100644
> --- a/gdb/valprint.c
> +++ b/gdb/valprint.c
> @@ -2363,16 +2363,19 @@ print_converted_chars_to_obstack (struct obstack *obstack,
> const std::vector<converted_character> &chars,
> int quote_char, int width,
> enum bfd_endian byte_order,
> - const struct value_print_options *options)
> + const struct value_print_options *options,
> + int *finished)
The comment preceding this function explains the meaning of all of its
arguments. Please add `finished', too.
> {
> - unsigned int idx;
> + unsigned int idx, num_elements;
> const converted_character *elem;
> enum {START, SINGLE, REPEAT, INCOMPLETE, FINISH} state, last;
> gdb_wchar_t wide_quote_char = gdb_btowc (quote_char);
> bool need_escape = false;
> + const int print_max = options->print_max_chars > 0
> + ? options->print_max_chars : options->print_max;
>
> /* Set the start state. */
> - idx = 0;
> + idx = num_elements = 0;
> last = state = START;
> elem = NULL;
>
Otherwise LGTM.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Keith
next prev parent reply other threads:[~2023-05-13 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-08 1:22 Paul Pluzhnikov
2023-05-13 17:30 ` Keith Seitz [this message]
2023-05-15 9:43 ` Andrew Burgess
2023-05-15 15:13 ` [PATCH] Update comments for the gdb/24331 fix Paul Pluzhnikov
2023-05-16 10:55 ` Andrew Burgess
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=8f642a5b-7144-5cca-5566-a1dadc9e93fc@redhat.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=ppluzhnikov@google.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).