Search the web
Sign In
New User? Sign Up
mpatrol · mpatrol library discussion group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Problems running mpatrol in MinGW   Message List  
Reply | Forward Message #1189 of 1198 |
RE: [mpatrol] Re: Problems running mpatrol in MinGW

Hi Greg,
 
Sorry I've taken so long to get back to you.  I'm not a MinGW user but there are several people in this group that have reported success using mpatrol with MinGW.  Does anyone have any thoughts on getting mpatrol to work for Greg in his setup?
 
There appears to be an issue with mpatrol.dll when it's built to use msvcrt.dll so perhaps building everything against Microsoft's libc might work, but I don't know if that's an option with MinGW and would require you to have Visual Studio already installed on your machine.
 
mpatrol was developed for UNIX systems and it looks like it might need to have a bit more work done to it to get it to work consistently under Windows in all setups.  In particular, I'd like to have mpatrol --dynamic work, but that needs quite a bit of work to use DLL injection.  I'm afraid all this could mean that it's just not going to work for you at the moment.
 
Sorry I can't be of more help,
 
Graeme.
 
 

From: mpatrol@yahoogroups.com [mailto:mpatrol@yahoogroups.com] On Behalf Of greg80303
Sent: 09 March 2009 03:32
To: mpatrol@yahoogroups.com
Subject: [mpatrol] Re: Problems running mpatrol in MinGW

Thought I would add a couple more observations that I've made regarding the use of DLLs vs static libs. I played around a little with compiling and running the test applications in mpatrol/tests/fail.

1) If I compile and link the test application against the static mpatrol library, all works as expected.

2) If I compile and link the test application against the mpatrol DLL, I get a crash when I run.

3) If I compile my executable against the static mpatrol library, all works as expected.

4) If I compile my executable against the mpatrol DLL, I get a crash when I run. This is the exact situation of my original post.

5) I compile my executable against the static mpatrol library. But, this time, my application contains calls against another DLL (call it "myappDLL"), so I link my application against myappDLL. Regardless of whether myappDLL is compiled against mpatrol static lib or mpatrol DLL, I get a crash.

6) Same as #5, but this time I do not compile myappDLL against mpatrol. All works as expected (but I want to have all of my app DLLs using mpatrol, so this doesn't help me)

7) Same as #5, but instead of compiling my executable against myappDLL, I use LoadLibrary and GetProcAddress to call into myappDLL. Regardless of whether myappDLL is compiled against static or DLL version of mpatrol, I get a crash upon call to LoadLibrary.

I've read Greg Chicares' investigation documents posted in the files section of this group, but I don't see anything in his work about crashes, only errors and corruption in the log file.

--- In mpatrol@yahoogroups.com, "greg80303" <grutz@...> wrote:
>
> 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
>



Mon Mar 23, 2009 9:20 am

graemeroy
Offline Offline
Send Email Send Email

Forward
Message #1189 of 1198 |
Expand Messages Author Sort by Date

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...
greg80303
Online Now Send Email
Mar 8, 2009
10:55 pm

Thought I would add a couple more observations that I've made regarding the use of DLLs vs static libs. I played around a little with compiling and running...
greg80303
Online Now Send Email
Mar 9, 2009
9:39 am

Hi Greg, Sorry I've taken so long to get back to you. I'm not a MinGW user but there are several people in this group that have reported success using mpatrol...
Graeme Roy
graemeroy
Offline Send Email
Mar 23, 2009
9:20 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help