What is Interop-Debugging?

(This is an excerpt from an internal document I wrote explaining what is Interop-Debugging (aka Mixed Mode) and how does it work under the covers)   General Debugging background. When a process is being debugged, it generates debug-events which a debugger can listen and respond to. These events include things like CreateProcess, LoadModule, Exception, ExitThread, Breakpoint,…

9

Finding where unmanaged exceptions came from

Sometimes you’re looking at the callstack that’s in a handler after an exception was thrown. This is very common if you attached at an unhandled exception that popped up a watson dialog.   It might look this like: kernel32!WaitForSingleObject+0xf devenv!DwCreateProcess+0xbb devenv!fExceptionHandling+0x1cb devenv!DwExceptionFilter+0x8b 0x535ef48   That’s not exactly useful. What you really want is to see…

26

How to get a V2.0 ICorDebug object

I think the biggest breaking change in the ICorDebug API is how we deal with versioning. Managed debugging is done via the com-classic ICorDebug interface.   In v1.0/v1.1, you cocreate to get an ICorDebug implementation, like so:           ICorDebug * cor;         hr = CoCreateInstance(CLSID_CorDebug, NULL,                               CLSCTX_INPROC_SERVER,                               IID_ICorDebug,                               (void **)&cor);  …

10

Code Gen flags while Debugging

I ranted here that Debuggers shouldn’t affect behavior. V1.1 had some fundamental violations of this regarding code-gen. We’ve fixed this in v2.0 ICorDebug. This includes: 1)       Ensuring that the mere presence of a debugger doesn’t affect codegen flags. Eg, in v1.1, if a debugger was attached, we’d jit the code differently (such as disabling optimizations)…

11

Object Identity in Managed Debugging

The problem: Perhaps you’ve navigated through a global, local, or parameter while debugging, and then through some ugly series of object references (such as a hash table) to find an object reference. You want to be able to get some identity on that object so that you can easily find it again. Refinding it later…

13

What’s new in v2.0 CLR Debugging (ICorDebug)?

The CLR debugging services have added a lot of great things in v2.0.  The main theme for us has been improving the Rapid Application Development (RAD) experience. Here’s a list of new features: 1)       Edit-And-Continue. EnC is the ablity to edit code while it is being debugged without having to restart the debugging session. Both…

18