This is the mail archive of the libc-alpha@sourceware.org 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 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

Attachment: signature.asc
Description: Digital signature


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