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: Martin Galvan <martin dot galvan at tallertechnologies 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 09:45:36 -0300
- Subject: Re: [RFC v2] Pretty printers for NPTL lock types
- Authentication-results: sourceware.org; auth=none
- References: <CAOKbPbbVud=gru917mXYfnOnQ9nCCY1vR4fvyU8JpRVzaGe5bw at mail dot gmail dot com> <CAOKbPbZ+pWcouv2-VqnjVkNbbrA_7BieOmXv9fSofYU3kFjidQ at mail dot gmail dot com> <20150313054731 dot GJ877 at vapier>
On Fri, Mar 13, 2015 at 2:47 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 12 Mar 2015 14:33, Martin Galvan wrote:
>> self.output = ""
>
> i prefer to stick to single quotes when possible
>
>> def to_string(self):
>> """gdb API function. This is called from gdb when we try to print
>> a mutex."""
>
> docstrings should follow PEP257
>
> see the style guide for details:
> https://sourceware.org/glibc/wiki/Style_and_Conventions#Code_formatting_in_python_sources
>
>> if mutexType == PTHREAD_MUTEX_NORMAL:
>> self.output += "* Type: Normal\n"
>> elif mutexType == PTHREAD_MUTEX_RECURSIVE:
>> self.output += "* Type: Recursive\n"
>> elif mutexType == PTHREAD_MUTEX_ERRORCHECK:
>> self.output += "* Type: Error check\n"
>> elif mutexType == PTHREAD_MUTEX_ADAPTIVE_NP:
>> self.output += "* Type: Adaptive\n"
>
> this is symply a frozen dict lookup
>
>> else: # Mutex is locked
>> if self.lock & FUTEX_WAITERS:
>
> i prefer to avoid inline comments
>
>> mutex = self.mutex.cast(gdb.lookup_type('pthread_mutex_t').pointer()).dereference()
>
> we stick to 80 cols
> -mike
Thanks for the feedback! Will apply those changes in v3.
--
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