[RFC v2] Pretty printers for NPTL lock types
Tom Tromey
tom@tromey.com
Fri Mar 13 18:02:00 GMT 2015
>> 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
More information about the Libc-alpha
mailing list