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.
class=651010416-15042003>

style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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. class=651010416-15042003>
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">You can type .load
sos.dll
in the Intermediate window of VS.NET and then type
!syncblk
.
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Here is some more
information on !syncblk
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">
=
face=Wingdings size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Wingdings">n size=1> style="FONT-SIZE: 7pt; COLOR: navy">      
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">!SyncBlk
class=651010416-15042003>    face=Wingdings> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Wingdings">n size=1> style="FONT-SIZE: 7pt; COLOR: navy">      
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Command that shows the
list of SyncBlocks , the corresponding owning thread and the object that the
SyncBlock corresponds to
class=651010416-15042003>           
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Wingdings">n size=1> style="FONT-SIZE: 7pt; COLOR: navy">      
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Example


face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">0:004>
!SyncBlk

face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Index SyncBlock
MonitorHeld Recursion   Thread  ThreadID    
Object Waiting

face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">158  
00179f74           
3            
1          
17ef90      c00   face=Arial color=red size=2> style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">4 face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">     
00cfd4e8  System.String

face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">159  
00179fa0           
3            
1           
184d88     cfc   color=red size=2> style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">3 face=Arial color=navy size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">     
00cfd4c0 System.String

size=2> style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">=


 

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#.

size=2> 

Comments (1)

  1. David Stone says:

    Nice! Thanks for the info!