This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Syslog fixes a bug?
- From: "Atwood, Robert C" <r dot atwood at imperial dot ac dot uk>
- To: "Michael Wieher" <michael dot wieher at gmail dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Thu, 8 May 2008 17:46:36 +0100
- Subject: RE: Syslog fixes a bug?
- References: <fb251aba0805071406o2a93422cubb2fc7f0f07c9cc5@mail.gmail.com>
> -----Original Message-----
Michael Wieher said
>
> Hey,
>
> I have a program that dies mysteriously.
>
> If I use syslog() to attempt to write data and see where it dies, it
> lives and works perfectly.
>
Every time I had something like that it was buffer over/under run type
problem. When you make the change, some other thing comes after/before
the affected buffer in the memory layout, such that writing it does not
cause program death .
One time early in my c programming, I spent ages scratching my head
when an extra 'printf' had the same effect you describe, before I knew
about that, and eventually used 'Electric Fence' tool by Bruce Perens,
which found it right away ... as it was simply my program writing past
the end of a 'malloc'ed memory space
>oops< .. If it's more subtle then other debugging tools may help!
Gdb, Dmalloc , dbmalloc, valgrind, etc. etc. ( unless you are
determined to stare the code in the eye yourself and eschew all
debuggign tools for weaklings :-P )