From: "Maciej W. Rozycki" <macro@embecosm.com>
To: Simon Sobisch <simonsobisch@gnu.org>
Cc: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: split array and string limiting options
Date: Wed, 26 Jan 2022 18:18:37 +0000 (GMT) [thread overview]
Message-ID: <alpine.DEB.2.20.2201261804210.11348@tpp.orcam.me.uk> (raw)
In-Reply-To: <6d92837c-ffe1-dbf3-bf61-15ecbcc140ea@gnu.org>
On Wed, 26 Jan 2022, Simon Sobisch wrote:
> > > > > To do so the new parameter cannot be directly used as it is in the
> > > > > patch
> > > > > but must be fowarded to a new function or duplicated.
> > > > >
> > > > > As an example this would mean instead of :
> > > > >
> > > > > --- src.orig/gdb/c-valprint.c
> > > > > +++ src/gdb/c-valprint.c
> > > > > @@ -271,7 +271,7 @@ c_value_print_array (struct value *val,
> > > > >
> > > > > for (temp_len = 0;
> > > > > (temp_len < len
> > > > > - && temp_len < options->print_max
> > > > > + && temp_len < options->print_max_chars
> > > > > && extract_unsigned_integer (valaddr + temp_len * eltlen,
> > > > > eltlen, byte _order) != 0);
> > > > > ++temp_len)
> > > > >
> > > > > have the following
> > > > >
> > > > >
> > > > > + const int print_max_chars = (options->print_max_chars != -1) ?
> > > > > options->print_max_chars : options->print_max;
> > > > > for (temp_len = 0;
> > > > > (temp_len < len
> > > > > - && temp_len < options->print_max
> > > > > + && temp_len < print_max_chars
> > > > > && extract_unsigned_integer (valaddr + temp_len * eltlen,
> > > > > eltlen, byte_order) != 0);
> > > > > ++temp_len)
> > > >
>
> Proposal 1 - Should work, shouldn't it?
>
> > If you want to keep backwards compatibility, then no particular value for
> > `set print elements' can be used to drive `set print characters' I'm
> > afraid. Someone may have used it somewhere.
>
> What do you mean with that? If the default is whatever print elements is it
> should be compatible, shouldn't it?
Right, I got this mixed up as it's the new `set print characters' setting
that will drive the default rather than the existing `set print elements'
one, the semantics of which will remain unchanged for non-character
entities. So e.g.:
(gdb) set print characters elements
(which will also be the default) will make `set print elements' drive the
number of characters printed (and the `elements' syntactic argument can
either set the limit to a reserved value such as `-1' as you suggested or
drive a separate internal boolean flag). While if we use any other value,
then the character limit will get separated from the `set print elements'
setting.
So it seems good to me and probably the least interface complication for
users and the least maintenance burden to carry along. Thank you for your
persistence!
Any other input, anyone?
Maciej
next prev parent reply other threads:[~2022-01-26 18:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 7:58 Simon Sobisch
2022-01-06 9:33 ` Andrew Burgess
2022-01-06 13:32 ` Simon Sobisch
2022-01-06 14:18 ` Andrew Burgess
2022-01-26 15:48 ` Maciej W. Rozycki
2022-01-26 16:52 ` Simon Sobisch
2022-01-26 18:18 ` Maciej W. Rozycki [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-12-14 16:38 Maciej W. Rozycki
2021-12-14 17:24 ` Eli Zaretskii
2021-12-15 18:01 ` Andrew Burgess
2022-01-04 23:15 ` Maciej W. Rozycki
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=alpine.DEB.2.20.2201261804210.11348@tpp.orcam.me.uk \
--to=macro@embecosm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simonsobisch@gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).