Re: Exception occurs only when run outside the debugger *confused*



Matthias Kaeppler wrote
(in article <defssb$mma$02$1@xxxxxxxxxxxxxxxxx>):

> Hi,
>
> I have a very strange problem here:
> 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).

Congratulations, you have found a heisenbug.
http://catb.org/~esr/jargon/html/H/heisenbug.html

The bad news, is they are a bitch to remove.

> This is insane, I wanted to actually *use* the debugger to *find* the
> error, but then the error only occurs when the debugger is not active?!

It happens, they even have a name for it. :-)

> I am using g++ 3.3.5. Does anyone have an idea how odd behavior like
> this can happen, generally?

Debuggers can use different memory management than the
stand-alone program. Odds are you are corrupting memory in a
subtle fashion. Take a close look at all use of dynamic memory,
pointers, etc.

> I can post my makefile if that helps.

Without source, it's of little value. Try pruning down the
program by gradually removing (or stubbing out) pieces of code
until you can eliminate the exception. Then concentrate on the
last thing you removed.


--
Randy Howard (2reply remove FOOBAR)

.



Relevant Pages