Mail Archives: djgpp/1995/11/30/12:56:13
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
- Raw text -