It appears that one way to break it is to misconfigure the clocks. For example if you set up the clock config to give you 168MHz with an 8MHz xtal, and then you load that code into a CPU which has a 25MHz xtal on it, the CPU will not do anything useful (at 525MHz) so the SWD interface won't run.
This appears to have actually been done.
The only ways out of it will be
- change the xtal to 8MHz or so
- set one of the BOOT0/1 pins to 1; IIRC this runs one of the boot blocks e.g. code loading via SPI, CAN or UART1 and then you can use the debugger again to load new code
- if you don't have a working program, erase the FLASH (using the debugger directly; I don't think ST Cube IDE has this option).
In my design I have a jumper called RECOVER which sets BOOT0=1. I could not remember why this was done
Well, it can be read by software, so it isn't useless. But it may also be handy for enabling the debugger, where clocks or I/O have been misconfigured.