netcoredbg
netcoredbg copied to clipboard
How to change current thread?
Using MI protocol, it seems there is no way to change current thread (m_debugger.SetLastStoppedThreadId?). The debugger does not implement -thread-select command or --thread argument. It seems it is possible only if using the VSCode protocol.
For example, when the user clicks the Pause button, the current thread is the last stopped thread, or a random thread if never stopped (often not even the main thread). Then the user may want to step-debug another thread.
Now --thread argument supported for stack-list-frames, stack-list-variables, var-create and step commands (exec-step, exec-next and exec-finish). What command, that you need don't support --thread argument?
Now I see, --thread is supported, although undocumented.
exec-interrupt should support it too. Then I would use -exec-interrupt --thread mainThread if never was stopped.
The problem is that -exec-interrupt sets random current thread if never stopped. And difficult to find a workaround. Would be easier if there was -thread-select.
Please note, GDB/MI protocol is not human oriented, IDE/plugins provide proper formed commands with --thread if need. I am just worry, why you need this command.
I'm adding your debugger to my C# script IDE project. Like in VS, VSCode, Rider. Almost everything works well, just several non-fatal problems.
I added this to "feature requests" list (as I see we planned same for CLI too), but at this moment we all involved in porting to riscv64 (.NET runtime/debugger), not sure this will be done in near future.