This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC v2] Pretty printers for NPTL lock types

On Fri, Mar 13, 2015 at 2:47 AM, Mike Frysinger <> 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

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 <> wrote:
>>>>>> "Martin" == Martin Galvan <> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]