请解释!SyncBlk WinDbg的命令 [英] Please explain !SyncBlk the windbg command

查看:1329
本文介绍了请解释!SyncBlk WinDbg的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,是有在的WinDbg

其次,我想了解!syncblk 输出

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 显示监视器#所持 synblk 。 1写入和2读,但到底是什么列的其余部分是指?

MonitorHeld shows # of monitor held by the synblk. 1 for write and 2 for read, but what does the rest of column means?

说我有一个C#代码

MyClass MyObj;
MyObj = new MyClass();

现在,如果我做

lock (MyObj)
{
}

请问 syncblk 所有者列秀MyClass的?
同样,当我运行这个!SyncBlk 命令,究竟是什么它显示我?难道是显示我的锁的数量() Monitor.Enter 互斥()和其他的锁定机制?

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?

推荐答案

要获得帮助的SOS命令,键入!帮助!sos.help 。得到帮助的特定命令键入帮助<!指挥GT; 。为SOS的帮助文本也可在网上。网络版为您提供了命令的概述。有关更多信息,请使用!帮助syncblk

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.

的输出!syncblk 说明你的线程ID(在下面的输出头#1),对象和用于锁定对象的类型(标题#2)。

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)首先值是线程对象,二是本地线程ID和最后一个是WinDbg的线程ID。

1) First value is thread object, second is native thread id and last is WinDbg thread id.

2)的第一个值是用来锁定对象,第二个值是该对象的类型。

2) First value is object used to lock on and second value is the type of this object.

!syncblk 只覆盖了内部.NET锁,因此互斥 (这是一个内核对象)这里不讨论。

!syncblk only covers the internal .NET locks, so Mutex (which is a kernel object) is not covered here.

在你的榜样,运行lock语句代码的线程ID会显示与地址一起 MyObj中点并类型 MyClass的

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.

这篇关于请解释!SyncBlk WinDbg的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆