Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2002 17:01:20 -0800
From:      Darryl Okahata <darrylo@soco.agilent.com>
To:        Robert Suetterlin <robert@mpe.mpg.de>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: HOW to debug memory corruption efficiently? 
Message-ID:  <200201310101.RAA00455@mina.soco.agilent.com>
In-Reply-To: Your message of "Wed, 30 Jan 2002 12:17:13 %2B0100."

next in thread | raw e-mail | index | archive | help
Robert Suetterlin <robert@mpe.mpg.de> wrote:

> 	Unfortunately I'm neither proficient in C++ nor efficient in
> debugging, so I stumble around the problem rather blindfolded.  Once
> I blamed the compiler, systemlibraries and operating system, I knew
> I needed some help.  The problem appeared on a linux system, but I
> guess the techniques I might need will be the same under Linux,
> FreeBSD or any un*x.

     Unfortunately, you'll probably have to debug this the hard way.
Figure out what part of memory is being trashed, and then figure out
what is trashing the memory.  If the memory address/data is consistent,
you might be able to use the i386 hardware breakpoint debug registers to
help you.

     The "best" -- but horribly expensive -- way is to port the software
to another Unix platform (like Solaris or HP-UX), and use Rational
Software's "Purify" to locate the memory corruption.  It's almost a
no-brainer to use, and it works ungodly well.  You don't even need
source code to use purify -- object files are enough, as purify works at
*link* time (you don't have to specially compile your code, unless you
want to take advantage of special purify APIs).  The downside is that
your program does run 3-10X slower, and Purify is pretty expensive (but
it's such a killer programming app).  It's not available for either
FreeBSD or Linux, though.

     Purify's nearest (commercial) competitor is ParaSoft's "Insure++".
Perhaps things have improved but, when we last evaluated it a year or
two back, it was a LOT slower than purify (unusably slow for our
applications).  I seem to recall 5-10X slower than purify (maybe more).
It can detect a few problems that purify does not, however (e.g., bad
arguments to printf()).  Insure++ needs access to source code for best
results.  I believe a Linux version is available.

     There is no open-source equivalent to purify (and probably won't
be, due to patent issues).  The closest thing is "GNU checker", but
that's a pale, feeble dust speck compared to purify (assuming that you
even manage to get checker working).

-- 
	Darryl Okahata
	darrylo@soco.agilent.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Agilent Technologies, or
of the little green men that have been following him all day.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201310101.RAA00455>