[RFC v2] Pretty printers for NPTL lock types
Martin Galvan
martin.galvan@tallertechnologies.com
Fri Mar 13 12:46:00 GMT 2015
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
More information about the Libc-alpha
mailing list