Compiler Lab Results
Microsoft has been having a .Net compiler lab from Feb 7 to Feb 9. It looks like it’s been going very well, so kudos to the organizers. I’ve had a chance to talk to a few people about clr debugging and they’ve asked some great questions. Here’s a sampling, and some quick answers:
- What about the debugging support for Generics? We added ICorDebugType (see CorDebug.idl) for v2.0 to describe generics. So everything that’s gives back an ICorDebugType is likely generics aware. See ICorDebugILFrame2::EnumerateTypeParameters to get the generic parameters from a stack trace, and ICorDebugValue2::GetExactType to get the ICorDebugType of a variable.
- What edits does Edit-And-Continue allowed? Roughly, you can add new private members, and change the body (but not signature) of methods. There are various restrictions on top of this.
- How can I make my own compiler support Enc? This deserves its own post…
- Can a process use ICorDebug to debug itself? Please don’t do this.
- When will the Whidbey specifications become public? Not sure yet…
- What’s involved in creating an Interop (managed + native) debugger? It’s hard, but doable. Likely a future MDbg sample will include primitive interop-debugging support. What if we just have a managed and native debugger simultaneously attached instead? Ilament here that this is evil, but deserves more detail in another post.
- “I have an existing non-.Net language and my own custom debugger. I’m adding the ability to call .Net functions. How can I debug the managed code without rewriting my debugger?” This also deserves its own post. In short, you could have a managed debugger and your custom debugger simultaneously attached, provided they didn’t interfere.
- What does managed-only debugging do to my unmanaged threads? If you’re stopped at a managed breakpoint while managed-only debugging, the CLR 1) suspend all managed threads, and 2) trap any unmanaged threads that call managed code. Thus unmanaged threads run free until they call into managed code.
- What BCL support is there for working with a debugger? See the System.Diagnostics.Debugger class. It has methods like Debugger.Break(), which is how we implement VB’s Stop statement, and Debugger.Launch().
There’s still 1 more day (Wednesday) of the compiler lab. Feel free to ping me via the contact-link and I’d be happy to swing by the lab and talk about managed debugging issues you may be interested in. Or leave comments here for other questions you may have.
Comments
- Anonymous
March 10, 2006
If you're at the Microsoft campus at the upcoming compiler-lab and want to chat about ICorDebug or low-level... - Anonymous
January 23, 2008
PingBack from http://msdnrss.thecoderblogs.com/2008/01/24/langnet-2008-is-coming/