title: How does the Visual Studio Attach to Process work?
body: <p>I've always wanted to know the inner-workings of Visual Studio's debugger and debuggers in general. How does it communicate and control your code, especially when it's running inside a host process or an external network server (attach to process)? Does the compiler or linker patch your code with callbacks so that the debugger is given control?  If it indeed works this way, how do interpreted languages such as JavaScript containing no debug code work? </p>