Subj : Re: Exception occurs only when run outside the debugger *confused* To : comp.programming From : Jason Curl Date : Wed Aug 24 2005 07:24 pm James Dow Allen wrote: >>My program throws an exception coming from the glibmm >>library when I start it normally. However, when I run it >>with the debugger (KDbg), it >>runs just fine! (no exception thrown). >> >>I am using g++ 3.3.5. Does anyone have an idea how odd >>behavior like this can happen, generally? > > > In C, use of automatic variables before initialization > is a common source of such anomalies. Use of uninitialized > malloc'ed variables, or array index out of bounds are > other possibilities. Use of threads or longjmps could also > be culprit; any other possibilities, anyone? I've found that gcc-3.3 with -O0 automatically sets uninitialised variables to zero, so that I usually don't find the problem, until I turn up the optimisations. This appears to have changed in gcc-4.0.0. The other friend I have on Linux is 'valgrind' that checks for use of uninitialised variables and memory leaks. This has been very useful, finding the occasional bug that I didn't know existed > > James > .