So, I am sure everybody has been here, but just to describe it properly, a short story:
I am writing a (to me) somewhat complicated program. By changing the input parameters I suddenly start getting a run-time error.
After several hours of placing more or less meaningful printing-commands around the code, I locate the place that I can't get past.
However, nothing seems to take place there.
I print all the usual variables, but nothing seems to be wrong.
I start simplifying the code. Removing all member-functions that are not used, all variables, slowly replacing all variables with dummies, while at the same time checking if the error still occurs.
Suddenly, after having removed about 4/5 of the program, the bug disappears. However, when rolling back the most recent changes, it does not reappear.
This has happened before during other projects, and I have spoken to other people who also knew of it. My question is, what do you guys do to locate such an error, when it stops occurring? The original version also seems to run atm. I have not much experience with debugging programs, but I tried running it through gdb - it just reported that the program had excited fine. Do I just have to wait for it to reappear, and hope I have more luck next time I go hunting? It's incredibly frustrating, both having wasted so much time not solving it, and also knowing that it's still in there somewhere.