Date: Thu, 30 Nov 1995 09:09:29 -0500 From: kagel AT quasar DOT bloomberg DOT com To: terry AT manawatu DOT gen DOT nz Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Bug hiding when using debugger. Reply-To: kagel AT ts1 DOT bloomberg DOT com From: terry AT manawatu DOT gen DOT nz (Terry Rozmus) Date: Wed, 29 Nov 1995 11:31:29 GMT Hi, I have been spending the last several days chasing an annoying bug that only appears when I don't use a debugger (any of them). I would be interested in knowing any differences for a program running under a debugger, and on it's own. The bug is that some dynamically allocated memory gets overwritten with other information whose source I cannot exactly track down. _ANY_ ideas on this would be greatly appreciated as I am getting rather tired of chasing a seemingly nonexistant bug. The debugger is causing the actual address of the malloced memory to be different from the non-debugged run. Your code is trashing the memory somewhere and in the debugger it is simply trashing different data at the same, or perhaps another, address. It may be that the changes are innocuous in the debugger or that you just quit before the damage became apparent. These are REALLY nasty and hard to track down. Look for pointers declared as automatics or malloc'd which you may have forgotten to initialize (as they are not initialized by the compiler and can contained any garbage from the stack). If you are using linked lists check your insert and delete item code for accesses to free'd structures (especially if the next/prev pointer are at the beginning of the structure malloc uses the first few bytes of a freed block). Check for accesses to free'd dynamic memory in general, while safe in some environments this is BAD code and not safe with DJGPP malloc. -- Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com The sky is the daily bread of the eyes. -- Ralph Waldo Emerson