Is it possible to send debugging messages from MCU to PC over SWD via GDB without interrupting the running code (ie. without using breakpoints), like we could do via UART of MCU by sacrificing 2 UART pins?
This can be achieved by something is called semihosting. How this is implemented depends on the specific devices and software you are using.
It works by using an SVC and BKPT instructions to trigger an action from the debugger host.