From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: xxhdx1985126 <xxhdx1985126@163.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: How to determine the thread holding a mutex?
Date: Tue, 10 Jan 2017 17:09:00 -0000 [thread overview]
Message-ID: <1484068173.14191.5.camel@skynet.be> (raw)
In-Reply-To: <65e6915e.b19a.15987f1923b.Coremail.xxhdx1985126@163.com>
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
prev parent reply other threads:[~2017-01-10 17:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 10:34 xxhdx1985126
2017-01-10 17:09 ` Philippe Waroquiers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484068173.14191.5.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb@sourceware.org \
--cc=xxhdx1985126@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox