This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Syslog fixes a bug?


 
> -----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 )





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]