Need help to interpret pthread_mutex_t structure as printed by gdb

Olle Blomgren ollemblomgren@gmail.com
Thu Aug 4 10:42:00 GMT 2016


I have two processes that share mutexes laid out in a shared memory
segment. After some execution where both processes intensively acquire
and release mutexes in this shared memory segment, one thread in one
of the processes blocks on a mutex and never continues. My initial
debugging tells me that the mutex in question should have been woken
up by the release of the lock by another thread, but it doesn't. To
come further I need help with interpreting the mutex printout I get
from the core file which I manually create from the frozen process.

The GDB-printout:

$1 = {__data = {__lock = 0, __nr_readers = 0, __readers_wakeup = 1941,
__writer_wakeup = 425, __nr_readers_queued = 0, __nr_writers_queued = 1,
__writer = 0, __shared = 0, __pad1 = 0, __pad2 = 0, __flags = 0}, __size =
"\000\000\000\000\000\000\000\000\225\a\000\000\251\001\000\000\000\000\000
\000\001", '\000' <repeats 34 times>, __align = 0}

The mutex is an RW-lock and the attribute is: PTHREAD_PROCESS_SHARED

The frozen thread holds a write-lock.

Can anyone see what I'm missing by reading the mutex that blocks my
thread, that should be running? Can anyone spot a memory overwrite
that confuses the mutex?

Thanks in advance



More information about the Libc-help mailing list