问题
Given I have started a live debugging session by clicking the Play button in Visual Studio (F5) in order to launch the executable.
Say that I find an interesting situation which cannot be analyzed in Visual Studio but I know how to analyze it in WinDbg.
How would I detach Visual Studio and attach with WinDbg so that WinDbg is now the debugger?
I have tried:
- detaching VS, but that will of course continue running the application, which I don't want
- attaching WinDbg. Only one debugger can be attached. I'm not looking for a non-invasive attach of WinDbg.
- I'd not like to create a crash dump in VS and then analyze that in WinDbg. I would prefer continuing the live debug session.
- freezing the threads (interestingly they show up as unfrozen in a non-invasive WinDbg), but they will be unfrozen when detaching VS
回答1:
Here's how it worked for me:
- Attach a WinDbg instance in non-invasive mode (F6)
- Detach Visual Studio
- Attach a new WinDbg instance in invasive mode (F6)
- It will break automatically
- Detach the non-invasive WinDbg (
.detach
)
Likewise you can transfer control back to Visual Studio:
- Attach a WinDbg instance in non-invasive mode (F6)
- Detach the invasive WinDbg (
.detach
) - Attach Visual Studio
- Break in Visual Studio (press Pause)
- Detach the non-invasive WinDbg (
.detach
)
来源:https://stackoverflow.com/questions/47710102/switching-from-vs-debugger-to-windbg