Firstly, is there a command for getting help and parameters for each sos command in windbg
?
Secondly, I'd like to understand !syncblk
output
Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner
201 05b9493c 979 1 05bc1040 bcc 45 022f3490 System.Collections.ArrayList
2875 05b4c914 1 1 17b99e10 1af8 290 024862d8 MyClass
2945 05b4b66c 1 1 17d1a290 12c0 752 02482940 MyClass
MonitorHeld
shows # of monitor held by the synblk
. 1 for write and 2 for read, but what does the rest of column means?
Say I have a C# code
MyClass MyObj;
MyObj = new MyClass();
Now if I do
lock (MyObj)
{
}
Will the syncblk
owner column show "MyClass" ?
Similarly when I run this !SyncBlk
command, what exactly is it showing me? Is it showing me the number of lock()
and Monitor.Enter
and Mutex
() and other locking mechanisms?
To get help for the SOS commands type !help
or !sos.help
. To get help on specific commands type !help <command>
. The help texts for SOS are also available online. The online version gives you an overview of the command. For additional details use !help syncblk
.
The output of !syncblk
shows you the thread id (header #1 in the output below), the object and the type of the object used to lock (header #2).
+-------#1-------+ +-----#2------+
Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner
201 05b9493c 979 1 05bc1040 bcc 45 022f3490 System.Collections.ArrayList
2875 05b4c914 1 1 17b99e10 1af8 290 024862d8 MyClass
2945 05b4b66c 1 1 17d1a290 12c0 752 02482940 MyClass
1) First value is thread object, second is native thread id and last is WinDbg thread id.
2) First value is object used to lock on and second value is the type of this object.
!syncblk
only covers the internal .NET locks, so Mutex
(which is a kernel object) is not covered here.
In your example the thread id of the code running the lock statement will show up along with the address MyObj
points to and the type MyClass
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With