Sending commands from Visual Studio 2022 to gdb in WSL 2
I recently set up a Linux build of my compiler using WSL2 and Visual Studio. Sending commands to gdb was unintuitive but I found out how to here1.
When debugging an executable in VS2022, go to: View -> Other Windows -> Command Window
.
Within the command window, prefix gdb commands with Debug.MIDebugExec
, e.g.:
Debug.MIDebugExec print x
-
The link was nestled in this article: https://learn.microsoft.com/en-us/cpp/build/configure-cmake-debugging-sessions?view=msvc-170 ↩