Jeff Abrahamson on Thu, 21 Mar 2002 17:00:17 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] If you do C/C++ on Linux you need this


On Wed, Mar 20, 2002 at 04:17:02PM -0500, ian reinhart geiser wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wednesday 20 March 2002 03:29 pm, gabriel rosenkoetter wrote:
> > On Wed, Mar 20, 2002 at 02:39:53PM -0500, ian reinhart geiser wrote:
> > > 	We have grown up with gdb to debug our code all of these years, but gdb
> > > is only useful once you have a bug.  Ever want to scan your binary to
> > > find out where the bugs are in the first place?
> > >
> > > 	http://developer.kde.org/~sewardj/
> >
> > What's it do that ElectricFence doesn't?
> I think this is a little more extensive because it intercepts all system 
> calls, so it can find access violations and allocation problems that 
> ElectricFence will miss.
> 
> I have not used electric fence though so I cannot say for sure, I use to use 
> ccmalloc, and that sucked.  This is lightyears better. 

Fwiw, note that malloc allows a small amount of error checking all on
its own, which I have occasionaly found to be quite useful. From the
malloc man page:

       Recent  versions of Linux libc (later than 5.4.23) and GNU
       libc (2.x) include a malloc implementation which  is  tun-
       able  via  environment  variables.   When MALLOC_CHECK_ is
       set, a special (less  efficient)  implementation  is  used
       which  is  designed  to be tolerant against simple errors,
       such as double calls of free() with the same argument,  or
       overruns of a single byte (off-by-one bugs).  Not all such
       errors can be proteced against, however, and memory  leaks
       can  result.   If  MALLOC_CHECK_ is set to 0, any detected
       heap corruption is silently ignored; if set to 1, a  diag       
       nostic  is  printed  on  stderr;  if  set to 2, abort() is
       called immediately.  This can be useful because  otherwise
       a  crash may happen much later, and the true cause for the
       problem is then very hard to track down.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>

 The Big Book of Misunderstanding, now in bookstores and on the web:
 <http://www.misunderstanding.net/buystuff.html>


______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug