Debug terminated immediately on start (Solved)
I had been debugging this program for some time with no problems. After making change to a header file to resolve a conflict, the debugger would no longer run. The program compiled , loaded and verified OK, but as soon as the debug perspective appeared the console reported "connection lost" "shutting down" and the C/C++ perspective returned. The board itself ran OK, and other programs ran and debugged OK on it, but this one program always caused GDB to terminate. I was using "ST-Link GDB server", but I got the same problem with "OpenOCD".
I couldn't find any way to diagnose the problem, just asking "What have I changed?".
Eventually I discovered it was a value in the Expressions window, that had been invalidated by the change in the header file, that was causing GDB to exit. Not sure whether this is a problem with CubeIDE or with GDB as there doesn't seem to be any diagnostics.
