Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: zackw@stanford.edu, gdb-patches@sources.redhat.com
Subject: Re: Option to elide single-bit bitfields when printing structures
Date: Fri, 23 Feb 2001 10:09:00 -0000	[thread overview]
Message-ID: <3A96A65C.6264@redhat.com> (raw)
In-Reply-To: <200102230756.CAA06304@indy.delorie.com>

Eli Zaretskii wrote:
> 
> > From: "Zack Weinberg" <zackw@stanford.edu>
> > Date: Thu, 22 Feb 2001 11:56:33 -0800
> >
> > (gdb) p decl->common
> > $1 = {chain = 0x40253000, type = 0x40253138, code = FUNCTION_DECL,
> >   side_effects_flag = 0, constant_flag = 0, addressable_flag = 0,
> >   volatile_flag = 0, readonly_flag = 0, unsigned_flag = 0,
> >   asm_written_flag = 0, used_flag = 0, nothrow_flag = 0, static_flag = 0,
> >   public_flag = 1, private_flag = 0, protected_flag = 0, bounded_flag = 0,
> >   lang_flag_0 = 0, lang_flag_1 = 0, lang_flag_2 = 0, lang_flag_3 = 0,
> >   lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 0, dummy = 0}
> >
> > It's hard to see which are set and which aren't.  With this patch, you
> > can get it printed like this:
> >
> > (gdb) set print elide-bitflags on
> > (gdb) p decl->common
> > $2 = {chain = 0x40253000, type = 0x40253138, code = FUNCTION_DECL, public_flag}
> >
> > which is, IMHO, much easier to read.
> 
> What if someone wants to know which flags are _reset_?  What if there
> are more than one set flag in your example?  What if the bit fields
> span more than one bit?  I don't see how your suggestion would deal
> with these cases in a way that the resulting display is
> self-explaining.  That trailing "public_flag" is already hard to
> understand; I stared at it for a few moments without understanding
> what's going on here, before it hit me.
> 
> Perhaps we need a special command or a special format that would put
> the burden on the user.  For example, if the user specifies exactly
> what flags (set or unset) does she want to see, the display doesn't
> need to explain that, because the user asked for it.
> 
> >       * cp-valprint.c (elide_bitflag_print): New flag.
> >       (cp_print_value_fields): If elide_bitflag_print, skip printing
> >       single-bit fields whose value is zero entirely, and skip
> >       printing the value for single-bit fields whose value is one.
> >       (_initialize_cp_valprint): Add 'set print elide-bitflags'
> >       command, default to old behavior.
> 
> If these changes are approved by the cp-valprint maintainer, please
> add some minimal changes in gdb.texinfo which describe this feature.

I don't think this feature is necessary.  This is just an
instance of special display of data.  This is what the 
gdb scripting language is for.


  parent reply	other threads:[~2001-02-23 10:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010222115633.B11707@wolery.stanford.edu>
     [not found] ` <200102230756.CAA06304@indy.delorie.com>
2001-02-23  7:03   ` Daniel Berlin
     [not found]     ` <6137-Fri23Feb2001183455+0200-eliz@is.elta.co.il>
2001-02-24 13:10       ` Zack Weinberg
2001-02-24 23:53         ` Eli Zaretskii
2001-02-27  0:17           ` Zack Weinberg
2001-02-27 11:04             ` Eli Zaretskii
2001-02-27 11:44               ` Daniel Berlin
2001-02-27 14:41               ` Michael Snyder
2001-02-23 10:09   ` Michael Snyder [this message]
2001-02-24 13:05     ` Zack Weinberg
2001-02-24 23:54       ` Eli Zaretskii
2001-02-27  0:13         ` Zack Weinberg

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=3A96A65C.6264@redhat.com \
    --to=msnyder@redhat.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=zackw@stanford.edu \
    /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