One time I had a register write that worked in release mode, but didn’t in debug. Ended up being an AVR timing requirement when configuring the oscillator or flash that expected the second write to happen at most N cycles after the first and debug mode just happened to add enough operations between the two lines of C to miss the window.