views:

47

answers:

3

Hi,

is it possible to view the value of a Mutex or Semaphore in Watch winodw in debug mode?

+1  A: 

No. because the value you holding are just handle to internal window structures.

YeenFei
+1  A: 

If a debugger could see the internal state of a synchronization object then a program could as well. Allowing it to circumvent the API and use the object in a thread-unsafe manner. This is for your own good, but of course an enormous pita when trying to debug threading problems. Good luck.

Hans Passant
+1  A: 

You can view the state of kernel objects like mutexes and semaphores using a kernel debugger (Kd or WinDbg) and the !handle and !object extension commands. Note that kernel debugging requires a second PC (though a VM guest may suffice in some circumstances).

Also note that critical sections are not kernel objects (though they may contain a handle to one), so you should be able to view some information about them with a user-mode debugger.

bk1e