Windows XP SP3 / MinGW
I have downloaded the 1.5.1 SVN tag tree and built it myself. I simply went
into <mpatrol>/build/windows and executed "make -f Makefile.mingw all", then
copied the include files to my include directory and the mpatrolmt.dll file to
the same directory as my executable.
I am trying to use mpatrol to do some memory analysis on a piece of software.
The complete system is pretty complex, but I am starting with only a small
piece. Our "launcher" is a simple executable that does some reading of
configuration files and then calls DLL entry points (via
LoadLibrary/GetProcAddress) to start the rest of the system. So, the launcher
itself is not linked against any external DLLs from our system.
The compile line for my launcher looks something like this:
gcc -c -mno-cygwin -g -DRI_HAVE_STDINT_H -Wall -Ic:/<myproject>/include
-include mpatrol.h -I./Win32 main.c -o
c:/<myproject>/gen/Win32/debug/launcher/main.o
gcc -c -mno-cygwin -g -DRI_HAVE_STDINT_H -Wall -Ic:/<myproject>/include
-include mpatrol.h -I./Win32 -Ic:/<myproject>/include Win32/port.c -o
c:/<myproject>/gen/Win32/debug/launcher/./Win32/port.o
g++ -mno-cygwin -o c:/<myproject>/install/Win32/debug/bin/ri.exe
c:/<myproject>/gen/Win32/debug/launcher/main.o
c:/<myproject>/gen/Win32/debug/launcher/./Win32/port.o
-Lc:/<myproject>/install/Win32/debug/bin -lmpatrolmt
The program crashes before ever getting to my main(). Running in GDB, I get the
following SIGSEGV notification:
(gdb) run
Starting program: c:/<myproject>/install/Win32/debug/bin/ri.exe
c:/<myproject>/launcher/launcher_win32.cfg
[New thread 656.0xaac]
Program received signal SIGSEGV, Segmentation fault.
0x7c9104da in ntdll!RtlStatMemoryStream () from C:\WINDOWS\system32\ntdll.dll
(gdb)
The mpatrol.log file is created and there is some information in it. So, I
rebuilt mpatrol with debug symbols and put a breakpoint in __mp_printversion()
to see if I could learn anything.
(gdb) run
Starting program: c:/<myproject>/install/Win32/debug/bin/ri.exe
c:/<myproject>/src/launcher/launcher_win32.cfg
[New thread 1108.0xd7c]
Breakpoint 1, __mp_printversion () at ../../src/diag.c:1805
(gdb) where
#0 __mp_printversion () at ../../src/diag.c:1805
#1 0x004d575f in __mp_init () at ../../src/inter.c:508
#2 0x004d5f8a in __mp_alloc (l=128, a=0, f=AT_MALLOC, s=0x0, t=0x0, u=0, g=0x0,
h=0, k=1) at ../../src/inter.c:873
#3 0x004da8d1 in malloc (l=128) at ../../src/malloc.c:55
#4 0x004c10c3 in DllMainCRTStartup@12 () from
c:\<myproject>\install\Win32\debug\bin\mpatrolmt.dll
#5 0x7c90118a in ntdll!LdrSetAppCompatDllRedirectionCallback () from
C:\WINDOWS\system32\ntdll.dll
#6 0x004c0000 in ?? ()
#7 0x00000001 in ?? ()
#8 0x0022fd30 in ?? ()
#9 0x004c1060 in __dll_exit () from
c:\<myproject>\install\Win32\debug\bin\mpatrolmt.dll
#10 0x7c91c4da in ntdll!LdrHotPatchRoutine () from C:\WINDOWS\system32\ntdll.dll
#11 0x7c921194 in ntdll!RtlMapGenericMask () from C:\WINDOWS\system32\ntdll.dll
#12 0x7c92108f in ntdll!RtlMapGenericMask () from C:\WINDOWS\system32\ntdll.dll
#13 0x7c90e437 in ntdll!LdrCreateOutOfProcessImage () from
C:\WINDOWS\system32\ntdll.dll
I can step all the way through until I am back in the DllMainCRTStartup
function. Then, the next step causes the crash. Any ideas for me? Any more
information I could provide to help?
Greg