This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v2] Pretty printers for NPTL lock types
- From: Tom Tromey <tom at tromey dot com>
- To: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- Cc: Tom Tromey <tom at tromey dot com>, "Carlos O'Donell" <carlos at redhat dot com>, libc-alpha at sourceware dot org, Daniel Gutson <daniel dot gutson at tallertechnologies dot com>, Torvald Riegel <triegel at redhat dot com>, Pedro Alves <palves at redhat dot com>
- Date: Fri, 13 Mar 2015 12:02:02 -0600
- Subject: Re: [RFC v2] Pretty printers for NPTL lock types
- Authentication-results: sourceware.org; auth=none
- References: <CAOKbPbZ+pWcouv2-VqnjVkNbbrA_7BieOmXv9fSofYU3kFjidQ at mail dot gmail dot com> <877fukkdtv dot fsf at tromey dot com> <CAOKbPbbCk1L9+EM5TtNUdLy7Rgs_fF3gEJhiiXKP=VdsOx_PFg at mail dot gmail dot com>
>> Putting newlines into the output seems like it will make the display
>> look strange in gdb in some circumstances.
>>
>> For example, what happens if the printer triggers during a backtrace?
>> Or if the mutex is nested (perhaps several layers deep) inside other
>> structures (with "set print pretty on")?
Martin> What about adding semicolons instead of newlines? That way the output
Martin> would be something like:
Martin> {Type: Normal; Status: Locked, no waiters; Owner ID: XXXX (dead); The
Martin> state protected by this mutex is inconsistent; Attributes: {Robust;
Martin> Private; Protocol: None} }
In the past, when there is a lot of data, what I've preferred is to make
the toString method return just a summary of some important bits (say,
the type) and then delegate the remaining information to children. It's
a trade-off of course. Stuff too much into toString and stack traces
and such become harder to read. But, don't put enough in there and
ordinary use is a pain.
Tom