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

Eli Zaretskii
2001-02-24T23:53:00Z

On Sat, 24 Feb 2001, Zack Weinberg wrote:

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

I thought you were proposing a general-purpose feature, not something
specific to GCC. If this is GCC-specific, I tend to agree with Michael:
throw together a bunch of special-purpose commands using the GDB
scripting facilities, put them on .gdbinit distributed with GCC, and be
done with it. That's what Emacs does, for example.

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

Perhaps it would be better to make the GCC prettyprinter more robust in
the face of such calamities. After all, GDB doesn't do anything that any
other program cannot do, to avoid crashing when accessing invalid
addresses and corrupted data structures.