This is actually expected when you use ST-LINK GDB server.
In the launch sequence we do the following:
- IDE: Launch ST-LINK GDB server
- ST-LINK GDB server connects to the MCU
- IDE: Launch GDB-client and connects to remote ("remote", regardless if same host or not) ST-LINK GDB server
- IDE: Apply the "load" command to have a generic way to manage loading elf-files regardless of GDB-server back-end.
- ST-LINK GDB server receives the load command. It does not load the image to target, instead it forwards the binary data to CubeProg_CLI which flashes the image to target.
- When CubeProg_CLI is done flash loading, ST-LINK GDB connects back to target applying the reset strategy.
- At this stage the IDE will apply breakpoints, set the PC counter and issue the Continue command (if applicable).
The issue you observe happens somewhere inside step 3-5 above. It is the Eclipse framework which is notified that we actually have a debug session running. The framework will then try to suspend the CPU and fetch the current PC to update the editor with which line we are currently executing. Whether this Eclipse debug event update will happen or not is timing sensitive which is why it may be hard to re-produce. Maybe more likely to happen when we have to process a larger image file during step 5.
I don't think we have a work-around for this. We use the Eclipse/CDT debug launch mechanism in a way it was not originally designed for, and this is the penalty. I doubt this is something we can fix.
But as always, the more complaints we get, the higher priority to fix. But our position is that we have more painful defects to attend than this one. :)