VHDL delayed assignment problem
Move the debug assignment outside the if statement with the condition rising_edge(clock).

In the following waveform you can see it's not assigned until the first clock edge and the output assignment is dependent on debug. 


(clickable)

The debug assignment could just as easily be a concurrent statement or have initial value supplied by a generic.