[PING 3][PATCH v10] Add pretty printers for the NPTL lock types
Stefan Liebler
stli@linux.vnet.ibm.com
Fri Aug 5 14:56:00 GMT 2016
On 08/03/2016 08:49 PM, Martin Galvan wrote:
> On Wed, Aug 3, 2016 at 3:29 PM, Martin Galvan
> <martin.galvan@tallertechnologies.com> wrote:
>> If your generated
>> PTHREAD_COND_SHARED is also -1, could you please check the value of
>> int(self.mutex)?
>
> One more thing: if casting to int throws a Python error, try casting
> to long. The comparison should work in both cases though.
>
on i686, s390:
<builddir>nptl/nptl_lock_constants.py:
PTHREAD_COND_SHARED = -1
I've stopped in gdb at test-condattr-printers.c line 87(/* Set shared
*/) and next 2:
with pp:
p *condvar
$3 = pthread_cond_t = {Threads waiting for this condvar = 0, Clock ID =
CLOCK_REALTIME,
Shared = No, Mutex = Cannot access memory at address 0xffffffff
without pp:
(gdb) p *condvar
$4 = {__data = {__lock = 0, __futex = 0, __total_seq = 0, __wakeup_seq = 0,
__woken_seq = 0, __mutex = 0xffffffff, __nwaiters = 0,
__broadcast_seq = 0},
__size = '\000' <repeats 32 times>,
"\377\377\377\377\000\000\000\000\000\000\000\000\374\
364\377\277", __align = 0}
I've added the following in nptl-printers.py in
ConditionVariablePrinter.read_attributes():
print (int(self.mutex))
print (self.mutex)
print (type(self.mutex))
with the result:
4294967295
0xffffffff
<class 'gdb.Value'>
> And btw, I just noticed that the gdb version regex was just missing an
> additional '.+' to capture the distro name. However, just to be safe
> I'll take a look at the gdb code to see what other version strings can
> it produce.
>
Yes this helps in my case.
Nevertheless if your gdb outputs something different and the regex does
not match, you'll get an error:
match = re.search(r'GNU gdb \(.+\) .+ ([1-9]+)\.([0-9]+)',
gdb_version_out)
gdb_version = (int(match.group(1)), int(match.group(2)))
AttributeError: 'NoneType' object has no attribute 'group'
Can you add a check to verify match variable and mark the test as
unsupported due to a not supported gdb?
More information about the Libc-alpha
mailing list