|
From: David E. <cr...@um...> - 2003-07-22 17:09:55
|
On Sat, 19 Jul 2003, Greg Chicares wrote: > David Eisner wrote: > > > > Hi. I'm looking for information about memory debugging tools, > > (like valgrind, electric fence, etc.) that can be used with MinGW. > > > > I found this excellent summary in the archives: > > > > http://sourceforge.net/mailarchive/message.php?msg_id=2623449 > > > > His guess was that mpatrol was the way to go, but I haven't been > > able to get it to compile on MinGW. > > An mpatrol makefile that works for mingw: > http://groups.yahoo.com/group/mpatrol/message/786 > > Samples--dll issues and linking options: > http://groups.yahoo.com/group/mpatrol/message/792 Thanks. I was able to build mpatrol and statically link against it, but I'm having some issues. Setup: oroborus [ working ]$ gcc -v Reading specs from C:/cygwin/usr/local/gcc-2.95.3/bin/../lib/gcc-lib/mingw32/2.95.3-8/specs gcc version 2.95.3-8 (mingw special) (Yes, I'm using gcc 2.95.3. gcc 3.x is not an option right now. And I'm using cygwin, but just for the shell, not the compiler). mpatrol version is mpatrol_1.4.8.tar.gz, built with the makefile in mpatrol-msw-GNUmakefile.tar.gz OK, here's a test program: #include <stdio.h> #include <stdlib.h> #include <string.h> int main( int argc, char *argv[] ) { char *rndm, *foo; rndm = (char *) malloc( 8 * sizeof( char )); rndm[8] = 0xAB; foo = strdup( "yahtzee" ); exit(0); } What I'm observing is that if I comment out the strdup() call, mpatrol (in mpatrol.log) correctly reports the memory error. But, if I include the strdup call, no error is reported. Here's how it's built: gcc -c -g -DWIN32 -I.. -I../../../../include ../main.c -o main.o gcc -g -DWIN32 -I.. -I../../../../include -Wl -L../../../../lib/win32 main.o -lmpatrol -lbfd -liberty -limagehlp -o silly_tool.exe Thanks in advance for your help. -David ------------------------+--------------------------+ David Eisner | E-mail: cr...@um... | CALCE EPSC | Phone: 301-405-5341 | University of Maryland | Fax: 301-314-9269 | ------------------------+--------------------------+ |