bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible deadlock when gdb calls 'SuspendThread' function


From: Jose Manuel Pulido
Subject: Possible deadlock when gdb calls 'SuspendThread' function
Date: Mon, 18 Jul 2011 18:06:53 +0200

Hello all. I'm using gdb 7.2, release version to debug a program written in c++ and compiled with gcc 4.5.0 in a MinGW environment under Windows XP SP3 32 bits.

This is how my debugging session goes on: I usually attach gdb to my program when it's already running (gdb --pid xxxx), then gdb takes a couple seconds to show the interactive prompt and I enter 'continue' after (possibly) setting one or more breakpoints.
My program keeps running and if I enter ctrl+c in the gdb console, sometimes not only gdb stop responding, but so does my program and Windows explorers renders unable to launch any new window. I can't even launch a task manager to kill gdb or my program. This, however, doesn't happen always, but roughly in the 20% of my executions.

If I manage to kill my program's process when this happens, both gdb and explorer regain their responsivity and gdb shows a lot of console lines at once, but the first of them is the following one:

'warning: SuspendThread failed. (winerr 5)'

Online documentation on SuspendThread states that a deadlock condition can occur if the thread being suspended owns a synchronization object. My program is GUI based and has some worker threads that use mutexes and system wide critical sections. Yet, I tried disabling every mutex and critical section in my code, but that didn't work out.

The thing is I can debug other programs without any problem, and I've used to be able to debug this one as well, but I fail to understand what might be causing this. Reviewing the changes in my source code during the last two months, or selectively disabling functionality, but nothing of that helped.

I thank in advance to anyone that might read this and give a piece of advice.

Regards, Jose.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]