MBZ
MBZ

Reputation: 27592

C++ view Mutex value in watch window

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

Upvotes: 2

Views: 1992

Answers (3)

bk1e
bk1e

Reputation: 24328

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.

Upvotes: 3

Hans Passant
Hans Passant

Reputation: 941605

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.

Upvotes: 0

YeenFei
YeenFei

Reputation: 3218

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

Upvotes: 1

Related Questions