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

Zack Weinberg
2001-02-27T00:17:00Z

On Sun, Feb 25, 2001 at 09:51:13AM +0200, Eli Zaretskii wrote:
>
> 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.

I am proposing a general-purpose feature. The GCC usage is a specific
example of why it would be useful.

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

Oh really? GDB gets a nice EFAULT/EIO error return from ptrace(2)
when it tries to dereference wild pointers. The prettyprinter runs in
inferior context and gets SIGSEGV when it does that. We'd have to
trap it and longjmp out. The complexity cost would be huge.

Unless you're saying GCC could ptrace itself...

zw