This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Option to elide single-bit bitfields when printing structures


On Fri, Feb 23, 2001 at 06:34:55PM +0200, Eli Zaretskii wrote:
> > > > (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_?
> > 
> > Nobody really does, it wouldn't make sense.
> > You know what isn't set because it's not shown.
> 
> Then IMHO this feature is less helpful than it could be.  See the list
> above: can you really remember all of the flags if they are not shown?
> And if half of them are shown, is it really easy to know which are and
> which aren't?

Perhaps you are not familiar with the way these flags get used in gcc.
It is very rare that more than two or three are set on any particular
structure, and the ones which are not set are generally irrelevant.
Further, there are so many of them that it can be next to impossible
to see which are set and which aren't in GDB's usual display.

GCC already has a prettyprinter you can call from the debugger for
these things, which obeys the same convention.  The problem with it is
that if the structure is damaged, the prettyprinter is liable to
crash.  So it would be nice if GDB's inspection facility were capable
of the same sort of printout.

> If I need to know about only one flag, I'd rather do this:
> 
>   (gdb) p decl->common.public_flag != 0

Thing is, I don't want to know about only one flag.  I want to know
about whichever flags happen to be set on this structure I've got
here.  I don't know which they are in advance.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]