Question

Asking for help for the SOS extension command !BPMD in Windbg (i.e. typing !help BPMD) results in a text which contains, among other things, a description on how to break into generecally typed methods. This reads as follows:

!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

What I fail to understand here is the syntax used in the last two lines. What does the apostrophe (`) mean, and what is the meaning of the tho integers involved (the ones to the right of the apostrophe)? Are these codes related to the type (public void and static public void) of the methods, or do they refer to the number of template arguments? In case the first guess is true, where would I find a list of possible types?

Was it helpful?

Solution

The backtick symbol is the syntax for specifying a generic type in IL. The number after the backtick is the number of generic parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top