Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2][PR gdb/24052] Implement 'set print zero-values on|off'
Date: Sun, 31 May 2020 16:33:40 +0000 (UTC)	[thread overview]
Message-ID: <728076575.828289.1590942820579@mail.yahoo.com> (raw)
In-Reply-To: <c68234de-f504-1a83-c6a5-fc7c425a92df@redhat.com>

 Am Sonntag, 31. Mai 2020, 17:21:16 MESZ hat Pedro Alves <palves@redhat.com> Folgendes geschrieben:

> On 5/31/20 3:58 PM, Hannes Domani via Gdb-patches wrote:
> >  Am Sonntag, 31. Mai 2020, 15:39:05 MESZ hat Pedro Alves <palves@redhat.com> Folgendes geschrieben:
>
> >> The thing is that an enum does not measure a quantity or offset.
> >> "0" has no usual particular significance compared to
> >> other enumerators.  While with pointers and integrals, usually
> >> "0" has significance, meaning no quantity, no offset or no object,
> >> or in general absence of the property being measured by the variable.
> >>
> >> For example, here's GDB's auto_boolean:
> >>
> >> /* * A generic, not quite boolean, enumeration.  This is used for
> >>      set/show commands in which the options are on/off/automatic.  */
> >> enum auto_boolean
> >> {
> >>    AUTO_BOOLEAN_TRUE,
> >>    AUTO_BOOLEAN_FALSE,
> >>    AUTO_BOOLEAN_AUTO
> >> };
> >>
> >> I'd think it confusing that "zero-values off" would hide
> >> AUTO_BOOLEAN_TRUE, but not AUTO_BOOLEAN_FALSE.
> >>
> >> Here:
> >>
> >> extern enum language_mode
> >>    {
> >>      language_mode_auto, language_mode_manual
> >>    }
> >> language_mode;
> >>
> >> What's the significance of hiding auto but not manual?
> >>
> >> Here:
> >>
> >> /* alignment enum */
> >> enum ui_align
> >>    {
> >>      ui_left = -1,
> >>      ui_center,
> >>      ui_right,
> >>      ui_noalign
> >>    };
> >>
> >> Why hide ui_center, instead of the other enumerators?
> >>
> >> Etc.
> >
> > It seems we have very different views about this.
> > I don't think it's confusing at all to hide AUTO_BOOLEAN_TRUE/
> > language_mode_auto/ui_center in these cases.
> >
>
> OK, if such different views are both reasonable, then this
> normally means that the larger set of users will also contain
> people with such opposing views, which calls for making it
> optional.  Maybe:
>
> set print zero-values all / non-enums / none
>
> > (For me it's more confusing that AUTO_BOOLEAN_TRUE is first in this enum.)
> >
> > If you don't want to hide it, just don't use -zero-values off.
> >
>
> Even the original reporter in the PR suggested only removing
> zero enums under an option:
>
> "Optionally also removing those enums which evaluate to zero would
> save even more unneeded information."
>
> >> (gdb) p g_out
> >> $1 = {pad1 = {c = 0 '\000', i = 0}, pad2 = {c = 0 '\000', i = 0}}
> >> (gdb) p out
> >> $2 = {pad1 = {c = 0 '\000', i = 0}, pad2 = {c = 0 '\000', i = 0}}
> >>
> >> (gdb) p -zero-values off -- g_out
> >> $3 = {}
> >> (gdb) p -zero-values off -- out
> >> $4 = {pad1 = {}, pad2 = {}}
> >>
> >> As you see, $3 and $4 gave different outputs, due to the padding.
> >
> > I agree that this might be weird, but I kinda see this as a feature.
>
> What's the value of the feature?  I think it's a hard to justify feature,
> because garbage in padding happens randomly, and naturally, and doesn't
> affect the value at the language level.  I very much question the value
> in wanting a different output here, and I hazard a guess that you were
> initially surprised with this case too.  IMO it's just a bug not to
> consider it.
>
> >> Why print "static_field = 0" when zero-values is off?
> >
> > When printing structures, I usually don't care about the static members.
> >
> > And with -zero-values off it should just display the parts that have some kind
> > of value.
> > So now I kinda want to hide all static members when -zero-values off, no
> > matter what their real value is.
>
> NAK.  Let's keep options orthogonal.

OK.
I will first try to fix the padding and static members.
Once I got that, enums.

But I have no idea how python pretty printers could be handled.


Hannes


      reply	other threads:[~2020-05-31 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200530161253.61299-1-ssbssa.ref@yahoo.de>
2020-05-30 16:12 ` Hannes Domani
2020-05-30 18:00   ` Pedro Alves
2020-05-31  0:06     ` Hannes Domani
2020-05-31 13:38       ` Pedro Alves
2020-05-31 14:47         ` Pedro Alves
2020-05-31 14:58         ` Hannes Domani
2020-05-31 15:21           ` Pedro Alves
2020-05-31 16:33             ` Hannes Domani [this message]

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=728076575.828289.1590942820579@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@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