thanks for your hint regarding the order of the linker command.
That works!
I try now exactely the way as recommended (and only using one line):
gcc test1.c -o test1 -lmpatrol -lbfd -liberty -limagehlp -lintl
The test1.c is the example from the repository:
#include "mpatrol.h"
int main(void){
char *p;
if (p = (char *) malloc(16)) free(p + 1); // offset 1 byte
return EXIT_SUCCESS;
}
There are no warnings or error messages and I get a test1.exe, which is about 5MByte.
So far all seems to be perfect.
When I start test1.exe, the program runs endless without stop (and without crash).
The (complete) content of the mpatrol.log is:
-----------------------------------------------------
mpatrol 1.5.1 (16 December 2008)
Copyright (C) 1997-2008 Graeme S. Roy
This is free software, and you are welcome to redistribute it under certain
conditions; see the GNU Lesser General Public License for details.
For the latest mpatrol release and documentation,
visit http://sourceforge.net/projects/mpatrol.
operating system: Microsoft Windows NT/2000/XP/Vista
system variant: N/A
processor architecture: Intel 80x86
processor word size: 32-bit
object file format: BFD
dynamic linker type: Windows
Log file generated on Thu Mar 22 17:01:48 2012
read 1316 symbols from ntdll.dll
read 954 symbols from kernel32.dll
read 108 symbols from IMAGEHLP.DLL
read 830 symbols from msvcrt.dll
read 84 symbols from libintl-8.dll
read 677 symbols from ADVAPI32.DLL
read 514 symbols from RPCRT4.dll
read 77 symbols from Secur32.dll
read 119 symbols from libgcc_s_dw2-1.dll
read 14 symbols from libiconv-2.dll
read 732 symbols from USER32.dll
read 610 symbols from GDI32.dll
read 133 symbols from IMM32.DLL
read 98 symbols from DBGHELP.dll
read 14 symbols from VERSION.dll
-----------------------------------------------------
Is there something else, what I did wrong?
To be completely sure to link against the right libraries,
I set the path explicitely to the installed mingw-installation,
where I also compiled mpatrol:
set path=C:\mingw\bin;c:\mingw\msys\1.0\bin
and I also set:
set MPATROL_OPTIONS="LOGALL" (I also tried MPATROL_OPTIONS=LOGALL without apostrophes)
Kind regards
Gerhard
Sitz: Backnang; Registergericht: Amtsgericht Stuttgart HRA 270977
Persoenlich haftender Gesellschafter: Tesat-Spacecom Geschaeftsfuehrungs GmbH;
Sitz:Backnang; Registergericht: Amtsgericht Stuttgart HRB 271658;
Geschaeftsfuehrung: Peter Schlote, Matthias Spinnler, Jochen Huppert
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
MinGW...@lists.sourceforge.net
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-use...@lists.sourceforge.net?subject=unsubscribe
I tried that myself just now, and it worked as the mpatrol manual
predicts: in 'mpatrol.log', I see:
ERROR: [MISMAT]: free: 0x00D8FE61 does not match allocation of 0x00D8FE60
0x00D8FE60 (16 bytes) {malloc:20:0} [-|-|-]
> There are no warnings or error messages and I get a test1.exe, which is about 5MByte.
> So far all seems to be perfect.
>
> When I start test1.exe, the program runs endless without stop (and without crash).
That seems strange for a three-line program with no loop that
uses hardly any resources. Have you tried running it under 'gdb'
and stepping through each line?
> The (complete) content of the mpatrol.log is:
>
> -----------------------------------------------------
> mpatrol 1.5.1 (16 December 2008)
> Copyright (C) 1997-2008 Graeme S. Roy
[...]
> read 14 symbols from VERSION.dll
That's the introductory information that's written to 'mpatrol.log'
at the beginning of the program. It sounds like the program is
somehow not reaching the call to free(). That's odd, because
'mpatrol' provides its own version of free(), which should have
detected the error and written something to the log.
If you build the program without mpatrol:
gcc test1.c -o test1
does the resulting test1.exe run to completion?
> Is there something else, what I did wrong?
>
> To be completely sure to link against the right libraries,
> I set the path explicitely to the installed mingw-installation,
> where I also compiled mpatrol:
> set path=C:\mingw\bin;c:\mingw\msys\1.0\bin
>
> and I also set:
> set MPATROL_OPTIONS="LOGALL" (I also tried MPATROL_OPTIONS=LOGALL without apostrophes)
I don't see anything wrong there.
Do any of the other mpatrol examples work for you as expected?
I'm using
mpatrol 1.4.8 (08 January 2002)
(which is a little old, but it has always worked for me), and
gcc.exe (GCC) 3.4.5 (mingw-vista special r3)
(which is a little old, but I need it for C++ exceptions).
I built mpatrol from source myself with makefiles adapted
from the mpatrol distribution--not the autotoolized version
you used.