Programming is actually an addiction. What makes it addictive to a certain type of personality is that little rush of satisfaction when you try your code and it *works*... and while this is still true to an extent of batch systems from the 50s and 60s it was the interactive systems of the 70s onwards that really spurred the development of the hacker subculture. It was not just the convenience and productivity improvements but that the 'hit' was coming harder and faster.
This theory is well known to those who design slot machines and other forms of gambling, it is called the theory of occasional rewards. With this in mind, frequent long debugging sessions do not make the process any less addictive, indeed MORE addictive since the occasional rewards are less predictable etc. With this in mind it is unsurprising that programmers tend to have other fixes too such as coffee, harder drugs or even gambling. Some personalities seem to be quite susceptible to occasional-rewards things.
Nick