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