 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Scott Meyers Guest
|
Posted: Wed Feb 11, 2004 11:19 am Post subject: Tools for detecting reads from uninit mem |
|
|
I was recently asked about tools for identifying reads from uninitialized
memory. Static analysis tools like lint can find some errors of this type,
but runtime tools are essential, too. Ideally, such tools would trap a
read from any kind of uninitialized memory -- heap (free store), stack, and
static (e.g., global).
I googled around a bit, and I found the following offerings:
Insure++ - appears to do it all
PurifyPlus - appears to do it all
valgrind - appears to do it all
BoundsChecker - not clear whether it does non-heap memory
ElectricFence - appears to apply only to heap memory
mpatrol - appears to apply only to heap memory
memprof - appears to apply only to heap memory
I also saw mention of "checker" and "fortify" at mathtools.net, but getting
information about them required that I register, and I hate that, so I
didn't bother. I'd overcome my hatred if somebody were to tell me that
they're worth looking at.
First, I'd welcome any information about any of the above tools (or similar
tools that I have overlooked), especially regarding whether they detect
uninitialized reads from both heap and non-heap memory. Second, I'd love
to hear insights into how reasonable they are to actually use.
Finally, the people who got me interested in this topic are writing console
games, so comments on tools such as the above for the PS2, XBox, and
GameCube would be really nice. I know that the tools above generally have
limited OS portability.
Thanks,
Scott
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
kanze@gabi-soft.fr Guest
|
Posted: Thu Feb 12, 2004 12:42 pm Post subject: Re: Tools for detecting reads from uninit mem |
|
|
Scott Meyers <Usenet (AT) aristeia (DOT) com> wrote
| Quote: | I was recently asked about tools for identifying reads from
uninitialized memory. Static analysis tools like lint can find some
errors of this type, but runtime tools are essential, too. Ideally,
such tools would trap a read from any kind of uninitialized memory --
heap (free store), stack, and static (e.g., global).
I googled around a bit, and I found the following offerings:
Insure++ - appears to do it all
PurifyPlus - appears to do it all
valgrind - appears to do it all
BoundsChecker - not clear whether it does non-heap memory
ElectricFence - appears to apply only to heap memory
mpatrol - appears to apply only to heap memory
memprof - appears to apply only to heap memory
I also saw mention of "checker" and "fortify" at mathtools.net, but
getting information about them required that I register, and I hate
that, so I didn't bother. I'd overcome my hatred if somebody were to
tell me that they're worth looking at.
First, I'd welcome any information about any of the above tools (or
similar tools that I have overlooked), especially regarding whether
they detect uninitialized reads from both heap and non-heap memory.
Second, I'd love to hear insights into how reasonable they are to
actually use.
|
The only one I've actually used is Purify, and I can attest that it does
a very good job, not only with regards to uninitialized memory accesses
(regardless of where they occur), but also for a variety of other memory
problems.
With regards to uninitialized memory, Purify allows simply copying it
(e.g. with memcpy, or by assigning struct's), but marks the destination
to uninitialized (even if it were initialized before). It also detects
uninitialized memory passed to system API's like write.
| Quote: | Finally, the people who got me interested in this topic are writing
console games, so comments on tools such as the above for the PS2,
XBox, and GameCube would be really nice. I know that the tools above
generally have limited OS portability.
|
That is likely to be a problem. I don't know what the current status
is, but some years ago, we couldn't use Purify on one project because
the platform (a fairly mainstream AIX) wasn't supported.
--
James Kanze GABI Software mailto:kanze (AT) gabi-soft (DOT) fr
Conseils en informatique orientée objet/ http://www.gabi-soft.fr
Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Richter Guest
|
Posted: Fri Feb 13, 2004 1:48 am Post subject: Re: Tools for detecting reads from uninit mem |
|
|
Hi,
| Quote: | I was recently asked about tools for identifying reads from uninitialized
memory. Static analysis tools like lint can find some errors of this type,
but runtime tools are essential, too. Ideally, such tools would trap a
read from any kind of uninitialized memory -- heap (free store), stack, and
static (e.g., global).
|
For Linux and friends, I would recommend to have a look at "valgrind":
http://valgrind.kde.org/
AFAIK, it performs checking on heap and non-heap objects. It also does
a bit more and provides a nice cache-analysis tool ("cachegrind").
Greetings,
Thomas
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Bertrand Augereau Guest
|
Posted: Sat Feb 14, 2004 9:51 pm Post subject: Re: Tools for detecting reads from uninit mem |
|
|
| Quote: | BoundsChecker - not clear whether it does non-heap memory
|
BoundsChecker checks for stack memory overwriting
| Quote: | Finally, the people who got me interested in this topic are writing
console
games, so comments on tools such as the above for the PS2, XBox, and
GameCube would be really nice. I know that the tools above generally have
limited OS portability.
|
I do myself write games for PS2 (and used to for NGC), and I don't know such
tools for both platform...
It is not even easy to set a hardware data breakpoint (yes I know i'm not an
hardcore vim coder, I use MSVC when I can and find myself much more
productive )
The best thing (ie the way we do it ) is to maintain a WIN32 port of the
game and debug cross platforms bugs on PC with appropriate sophisticated
tools. Then you have to sweat to solve platform specific troubles (custom
code, specific chips programming and so on) but you have gained time.
Console development tools have gone through great progress since a few
years, but there's still a LONG way to go!
(And C++ support in the compilers too!)
Which makes me remind that GCC asm syntax SHOULD be adopted in the standard
(or at least as a de facto standard for other compilers)...
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Scott Meyers Guest
|
Posted: Sun Feb 15, 2004 11:36 am Post subject: Re: Tools for detecting reads from uninit mem |
|
|
On 14 Feb 2004 16:51:57 -0500, Bertrand Augereau wrote:
| Quote: | BoundsChecker checks for stack memory overwriting
|
But the question was about detecting *reads* from uninitialized memory.
Scott
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Roland Pibinger Guest
|
Posted: Fri Feb 20, 2004 1:45 pm Post subject: Re: Tools for detecting reads from uninit mem |
|
|
On 15 Feb 2004 06:36:31 -0500, Scott Meyers <Usenet (AT) aristeia (DOT) com>
wrote:
| Quote: | On 14 Feb 2004 16:51:57 -0500, Bertrand Augereau wrote:
BoundsChecker checks for stack memory overwriting
But the question was about detecting *reads* from uninitialized memory.
|
This (slightly outdated) article might interest you:
http://www.microquill.com/heapagent/ha_comp.htm
Best regards,
Roland Pibinger
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|