[RFC v2] Pretty printers for NPTL lock types
Mike Frysinger
vapier@gentoo.org
Fri Mar 13 05:49:00 GMT 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150313/fc88ee63/attachment.sig>
More information about the Libc-alpha
mailing list