【问题标题】:setting breakpoint in WINDBG SOS with generically typed classes使用泛型类在 WINDBG SOS 中设置断点
【发布时间】:2013-05-27 14:05:55
【问题描述】:

在 Windbg 中寻求 SOS 扩展命令 !BPMD 的帮助(即输入 !help BPMD)会生成一个文本,其中包含有关如何闯入通用类型方法的描述等内容。内容如下:

!BPMD works equally well with generic types. Adding a breakpoint on a generic 
type sets breakpoints on all already JIT-ted generic methods and sets a pending 
breakpoint for any instantiation that will be JIT-ted in the future.

Example for generics:
Given the following two classes:

class G3<T1, T2, T3> 
{
    ...
    public void F(T1 p1, T2 p2, T3 p3)
    { ... }
}

public class G1<T> {
    // static method
    static public void G<W>(W w)
    { ... }
}

One would issue the following commands to set breapoints on G3.F() and 
G1.G():

!bpmd myapp.exe G3`3.F
!bpmd myapp.exe G1`1.G

我在这里无法理解的是最后两行中使用的语法。撇号 (`) 是什么意思,所涉及的 tho 整数(撇号右侧的那些)是什么意思?这些代码是与方法的类型(public void 和 static public void)相关,还是指模板参数的数量?如果第一个猜测是真的,我在哪里可以找到可能类型的列表?

【问题讨论】:

    标签: clr windbg sos


    【解决方案1】:

    反引号是在 IL 中指定泛型类型的语法。反引号后面的数字是泛型参数的个数。

    【讨论】:

    • 谢谢。您能否为此提供参考?我刚刚搜索了“IL 模板泛型”和类似的东西,确实产生了一些结果,但我不会称之为参考。
    • 我手头没有参考资料。这只是我多年来所知道的。对此感到抱歉。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-26
    • 1970-01-01
    相关资源
    最近更新 更多