Samsung / netcoredbg

NetCoreDbg is a managed code debugger with MI interface for CoreCLR.
MIT License
772 stars 100 forks source link

Feature request: Add "supportsGotoTargetsRequest" capability #84

Open nickspoons opened 2 years ago

nickspoons commented 2 years ago

Adding the "supportsGotoTargetsRequest" would allow skipping/repeating sections of code, as one can by dragging the debugger location icon in Visual Studio.

https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Goto

alpencolt commented 2 years ago

For connection to Visual Studio we use MI protocol and it doesn't has such command. VSCode protocol is used for connection with VSCode but I cannot find how to use this functionality from IDE. Probably it's also may require changes in runtime since no one checked this logic on Linux.

BTW @nickspoons what is the user scenario of this feature? Skipping of code blocks will cause inconsistent stack state and incorrect application work.

nickspoons commented 2 years ago

The use case is to explore the code. In Visual Studio, for example, I might accidentally step over a method when I meant to step into it, and in VS I can drag the current point of execution back to the method and then step into it. Yes this can indeed cause the application to work incorrectly, that's a decision I've taken while I'm working in the debugger.

Another use case could be a fragment of code that writes some changes to a database, but I don't want the changes written while I'm debugging so I skip over those steps and continue debugging.

There are many ways I've used this in Visual Studio. I currently use this debugger from Vim using the vimspector plugin, which currently does not support this capability, but if it was supported by netcoredbg I could look into implementing it in vimspector.

I have no idea if vscode has a way of using this capability. I would have thought so, since it seems like vscode has driven a lot of the LSP development, but perhaps not. In any case, it's part of the spec so I thought it would be worth opening an issue for it.

alpencolt commented 2 years ago

I see, it might be useful. MI engine which we use for communication with Visual Studio has support in latest releases https://github.com/microsoft/MIEngine/pull/1042. May be we'll implement it in next releases, keep this issue open.