When you halt at a breakpoint, the firmware stops executing, including the code that kicks the watchdog, so the watchdog counter runs down and resets the chip out from under you, which looks like the debugger "losing" the target. The fix is the debug-freeze feature: most MCUs have a configuration bit (e.g., in the debug/DBGMCU registers) that freezes the watchdog counter whenever the core is halted by the debugger, so you can single-step and inspect without spurious resets, you enable it in your debug build. For legitimately long operations at runtime (a long flash write, a bulk transfer), you don't just inflate the global timeout, that weakens protection for everything; instead you ensure the watchdog is still serviced during the operation (kick at safe checkpoints within it, confirming the operation is progressing normally), or design the operation to be chunked so the main loop continues to kick. The principle is to keep the watchdog reflecting true liveness without either resetting during valid work or blinding it during long tasks. And note IWDG can't be disabled once started, so "just turn it off for this part" usually isn't an option.
Embedded Systems Fundamentals · Interview question
Why does your chip keep resetting when you pause at a breakpoint, and how do you handle long legitimate operations?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
The Watchdog Timer
The hardware that resets a hung MCU: a countdown timer firmware must periodically kick, why you kick only from healthy code, and the window-watchdog twist.