Who's got the locks?

I just had a little
fun playing around with SOS today... Here is a bit of mail from a dev on
the CLR debugger team that makes this magic happen.

If you are running V1.1
then you can use the SOS.dll that is in the Framework\v1.1.4322 folder under a
Native Debugger or using VS.Net 2003 in Native or Mixed mode.
You can type .load
sos.dll
in the Intermediate window of VS.NET and then type
!syncblk.
Here is some more
information on !syncblk

=
n
!SyncBlk
n
Command that shows the
list of SyncBlocks , the corresponding owning thread and the object that the
SyncBlock corresponds to

n
Example

0:004>
!SyncBlk

Index SyncBlock
MonitorHeld Recursion Thread ThreadID
Object Waiting

158
00179f74
3
1
17ef90 c00 4
00cfd4e8 System.String

159
00179fa0
3
1
184d88 cfc 3
00cfd4c0 System.String

=

 

Notice I am having a
little trouble getting this to work on my little VB app I am writting, but works
like a charm in C#.