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: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: "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 14:48:09 -0300
- 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>
On Fri, Mar 13, 2015 at 2:47 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 12 Mar 2015 14:33, Martin Galvan wrote:
>> else: # Mutex is locked
>> if self.lock & FUTEX_WAITERS:
>
> i prefer to avoid inline comments
I've been looking at the code again and IMHO, save for perhaps that
one comment, the rest of the inline comments should stay. The ones
beside the "else"s are helpful for maintainers to know what my
assumptions were for that particular else, i.e. which cases I
predicted would go through that path. Any cases not mentioned in the
else comment nor the previous if/elifs are a sign of a possible bug,
or at least a reminder for maintainers who have to implement a new
case.
The comments by the globals are useful to identify what they'll be
used for without having to search through the code, and the comment
inside MutexPrinter's printAttributes method tells of an inconsistency
inside the NPTL itself.
On Fri, Mar 13, 2015 at 2:27 PM, Tom Tromey <tom@tromey.com> wrote:
>>>>>> "Martin" == Martin Galvan <martin.galvan@tallertechnologies.com> writes:
>
> Martin> if mutexType == PTHREAD_MUTEX_NORMAL:
> Martin> self.output += "* Type: Normal\n"
>
> 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")?
>
> Tom
What about adding semicolons instead of newlines? That way the output
would be something like:
{Type: Normal; Status: Locked, no waiters; Owner ID: XXXX (dead); The
state protected by this mutex is inconsistent; Attributes: {Robust;
Private; Protocol: None} }
--
MartÃn GalvÃn
Software Engineer
Taller Technologies Argentina
San Lorenzo 47, 3rd Floor, Office 5
CÃrdoba, Argentina
Phone: 54 351 4217888 / +54 351 4218211