2

I am working on C and I have a core dump of a multithreaded (two threads) process that I am debugging. I see in gdb that the mutex_lock is acquired by both the threads under a rare situation. Is there a way I could check the thread that possess the lock in gdb? I am running a flavor of linux.. Also, I am not allowed to post the code since it's proprietary.

sril
  • 53
  • 1
  • 7

1 Answers1

1

On every line that gets and releases the lock in question (of course change the printf text), do the following:

break file:line
commands
printf "acquiring lock"
info threads
cont
end
steve
  • 5,870
  • 1
  • 21
  • 22
  • Thank you for the reply. I realized that in the code, while one thread had acquired a lock, another thread was doing an unlock immediately after the process starts up. This was causing both the threads to assume that they held the lock and proceed. This inturn caused an assert in one of the threads to fail leading to a core dump. – sril Aug 16 '11 at 07:53