public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Sobisch <simonsobisch@gnu.org>
To: "Maciej W. Rozycki" <macro@embecosm.com>
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 17:52:56 +0100	[thread overview]
Message-ID: <6d92837c-ffe1-dbf3-bf61-15ecbcc140ea@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.20.2201191812560.11348@tpp.orcam.me.uk>


Am 26.01.2022 um 16:48 schrieb Maciej W. Rozycki:
> Hi Simon,
> 
>   Your message wasn't directly cc-ed to me and I missed it previously in
> the flood of mailing-list traffic.  Sorry about this.

Thanks for still coming back :-)

>   Please note that I have posted v3 before your message already.

I see, so some of my questions are possibly also not up-tp-date-

>>>> In my opinion there should be only 1 new test for the new setting and
>>>> the other should be left unchanged while still working, because then
>>>> existing usages will still work, too.
> 
>   Agreed.

That's something we can work with - let's check the implementations and 
options below for that.

> 
>>>> 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?

Please elaborate. Also: is that option "still on the table"?

>   What I can offer as possible alternative solutions are:
> 
> * As you proposed, but instead driven by an entirely separate knob such as
>    `set print characters-enable <on|off>'; if "off", which would also be
>    the default, then keeping the current semantics of `set print elements'.

Proposal 2 - That's an interesting idea. We could also say that in a 
later GDB version the default will be changed to on.
The best thing here: it is easily possible to have a different default 
for print characters (possibly much higher than print elements) with 
still keeping backward compatibility.

> * Leave `set print elements' alone and instead introduce a replacement
>    say `set print array-elements' command for array elements in addition to
>    `set print characters' already have proposed.  The latter two commands
>    would adjust the respective settings each while the former command would
>    set them both, for compatibility.  It's not clear to me what `show print
>    elements' would have to report however, maybe the `print array-elements'
>    setting.

Proposal 3 - also an interesting idea, a clean split.
I tend to this one.
> 
> * Have `set print elements' adjust both limits till `set print characters'
>    or `show print characters' have been used, at which point further
>    requests would only adjust the array element limit.  This wouldn't pose
>    a problem with `show print elements', but the semantics would be
>    complicated.

Proposal 4 - has "complicated in"  - let's drop it.

>   Thoughts?
> 
>    Maciej

Thanks again for working on this,
Simon

  reply	other threads:[~2022-01-26 16:53 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 [this message]
2022-01-26 18:18         ` Maciej W. Rozycki
  -- 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=6d92837c-ffe1-dbf3-bf61-15ecbcc140ea@gnu.org \
    --to=simonsobisch@gnu.org \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@embecosm.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).