Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to determine the thread holding a mutex?
@ 2017-01-10 10:34 xxhdx1985126
  2017-01-10 17:09 ` Philippe Waroquiers
  0 siblings, 1 reply; 2+ messages in thread
From: xxhdx1985126 @ 2017-01-10 10:34 UTC (permalink / raw)
  To: gdb

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 276 bytes --]

Hi, everyone.

I'm trying to debug a problem that appears to be a deadlock. I wonder if I can use gdb to find out which thread is holding a mutex. If so, my work would be much easier, as there are many threads in my program.

Please help me, Thank you:-)\x16º&ÖëzÛ«ŸŽy×¹b²Ö«r\x18\x1d

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to determine the thread holding a mutex?
  2017-01-10 10:34 How to determine the thread holding a mutex? xxhdx1985126
@ 2017-01-10 17:09 ` Philippe Waroquiers
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Waroquiers @ 2017-01-10 17:09 UTC (permalink / raw)
  To: xxhdx1985126; +Cc: gdb

On Tue, 2017-01-10 at 18:34 +0800, xxhdx1985126 wrote:
> Hi, everyone.
> 
> I'm trying to debug a problem that appears to be a deadlock. I wonder 
> if I can use gdb to find out which thread is holding a mutex.
>  If so, my work would be much easier, as there are many threads in my program.

What you can do is to use valgrind --tool=helgrind 
to first see if valgrind helgrind tool does not point at a possible
culprit for the deadlock.

Assuming helgrind does not explain the bug, and assuming that the
deadlock reproduces under valgrind/helgrind,
you can use the valgrind gdbserver monitor command 'info locks'
to obtain the list of locks 
See
http://www.valgrind.org/docs/manual/hg-manual.html#hg-manual.monitor-commands
and
http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver

for more information.


Philippe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-10 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 10:34 How to determine the thread holding a mutex? xxhdx1985126
2017-01-10 17:09 ` Philippe Waroquiers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox