On Wed, Sep 08, 2010 at 11:22:20PM +0800, JonY wrote: > On 9/8/2010 21:26, Sébastien Villemot wrote: > >Some extra information on the problem that I described in my previous post, > >and > >which I suspect to be a bug in MinGW-w64 for 64-bit platform. > > > >I attach a sample testcase, which I compile with: > > > >x86_64-w64-mingw32-gcc -g -O2 -fexceptions -Wall -shared > >-I~/MATLAB/extern/include mextest.c -o mextest.mexw64 -L~MATLAB/bin/win64 > >-lmex > > > >The libmex.dll contains both mexErrMsgTxt() and mexPrintf(). > > > >As such, the example makes MATLAB crash. > > > >But if I comment out the second function call (mexPrintf()), then the DLL > >behaves as expected: MATLAB catches the exception thrown by mexErrMsgTxt(), > >and > >displays the error message. > > > >It is very strangs since having or not the mexPrintf() should not change the > >result, since it is never reached. > > > >So it looks like a compiler bug, unless I’m missing something ? I’m not > >familiar with exception unwinding, so please forgive my ignorance. > > sorry for the lack of responses, its hard to know what is wrong when > nobody is familiar with Matlab internals.
Thanks for your answer. I perfectly understand that it is difficult for you to
give any help in this context.
> How exactly is a matlab exception thrown and caught anyway?
Unfortunately I have no idea, this is not documented. In this case the
exception is thrown by a MATLAB internal, and catched by another internal.
Attached is a WinDbg log of the crash. One can see my module ("mextest.mexw64")
loaded, then the exception being thrown and then a stack overflow. Hope this
helps. Note that I also tried with gdb (TDM build) but the results did not look
useful.
If there is any extra information that I could provide to help debug this, in
particular through any debugger (gdb or WinDbg), please let me know.
Thanks,
--
Sébastien Villemot
CEPREMAP — http://www.cepremap.ens.fr
Dynare project — http://www.dynare.org
Phone: +33 1 40 77 49 90
PGP Key: 0xA6C029B9D06B2913D71C105EBE37E801FB6EFF8B (http://pgp.mit.edu/)
*** wait with pending attach Symbol search path is: *** Invalid *** **************************************************************************** * Symbol loading may be unreliable without a symbol search path. * * Use .symfix to have the debugger choose a symbol path. * * After setting your symbol path, use .reload to refresh symbol locations. * **************************************************************************** Executable search path is: ModLoad: 00000000`00400000 00000000`004d3000 C:\Program Files\MATLAB\R2007a\bin\win64\MATLAB.exe ModLoad: 00000000`77ec0000 00000000`77ffb000 C:\WINDOWS\system32\ntdll.dll ModLoad: 00000000`77d40000 00000000`77eb3000 C:\WINDOWS\system32\kernel32.dll ModLoad: 00000000`10000000 00000000`103f5000 C:\Program Files\MATLAB\R2007a\bin\win64\libut.dll ModLoad: 00000000`4a900000 00000000`4aa01000 C:\Program Files\MATLAB\R2007a\bin\win64\icuin32.dll ModLoad: 00000000`4a800000 00000000`4a8dd000 C:\Program Files\MATLAB\R2007a\bin\win64\icuuc32.dll ModLoad: 000007ff`7fee0000 000007ff`7ffe6000 C:\WINDOWS\system32\ADVAPI32.dll ModLoad: 000007ff`7fd30000 000007ff`7fec9000 C:\WINDOWS\system32\RPCRT4.dll ModLoad: 000007ff`7e9c0000 000007ff`7e9e2000 C:\WINDOWS\system32\Secur32.dll ModLoad: 00000000`00260000 00000000`00267000 C:\Program Files\MATLAB\R2007a\bin\win64\icudt32.dll ModLoad: 00000000`78130000 00000000`781f9000 C:\WINDOWS\WinSxS\amd64_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_18A05F69\MSVCR80.dll ModLoad: 000007ff`7fc00000 000007ff`7fc86000 C:\WINDOWS\system32\msvcrt.dll ModLoad: 00000000`4ab00000 00000000`4ab10000 C:\Program Files\MATLAB\R2007a\bin\win64\icuio32.dll ModLoad: 00000000`7c420000 00000000`7c529000 C:\WINDOWS\WinSxS\amd64_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_18A05F69\MSVCP80.dll ModLoad: 000007ff`7e470000 000007ff`7e483000 C:\WINDOWS\system32\imagehlp.dll ModLoad: 00000000`77c20000 00000000`77d2c000 C:\WINDOWS\system32\USER32.dll ModLoad: 000007ff`7fc90000 000007ff`7fd2c000 C:\WINDOWS\system32\GDI32.dll ModLoad: 00000000`00290000 00000000`002e2000 C:\Program Files\MATLAB\R2007a\bin\win64\mcr.dll ModLoad: 000007ff`7f190000 000007ff`7fb9c000 C:\WINDOWS\system32\SHELL32.dll ModLoad: 000007ff`7ef60000 000007ff`7effb000 C:\WINDOWS\system32\SHLWAPI.dll ModLoad: 000007ff`57140000 000007ff`573c5000 C:\WINDOWS\system32\ole32.dll ModLoad: 00000000`00300000 00000000`00356000 C:\Program Files\MATLAB\R2007a\bin\win64\jmi.dll ModLoad: 000007ff`770f0000 000007ff`770fa000 C:\WINDOWS\system32\WSOCK32.dll ModLoad: 000007ff`77310000 000007ff`77340000 C:\WINDOWS\system32\WS2_32.dll ModLoad: 000007ff`77140000 000007ff`7714c000 C:\WINDOWS\system32\WS2HELP.dll ModLoad: 00000000`00370000 00000000`003db000 C:\Program Files\MATLAB\R2007a\bin\win64\libmx.dll ModLoad: 00000000`00ce0000 00000000`00cf2000 C:\Program Files\MATLAB\R2007a\bin\win64\libz.dll ModLoad: 00000000`00d00000 00000000`00ee6000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwservices.dll ModLoad: 000007ff`7d540000 000007ff`7d5b7000 C:\WINDOWS\system32\comdlg32.dll ModLoad: 000007ff`76200000 000007ff`762ef000 C:\WINDOWS\WinSxS\amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.3959_x-ww_AB06DEB0\COMCTL32.dll ModLoad: 00000000`00ef0000 00000000`00f4e000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwmathutil.dll ModLoad: 00000000`00f60000 00000000`00f84000 C:\Program Files\MATLAB\R2007a\bin\win64\mpath.dll ModLoad: 000007ff`77370000 000007ff`77409000 C:\WINDOWS\system32\NETAPI32.dll ModLoad: 00000000`00fa0000 00000000`017b9000 C:\Program Files\MATLAB\R2007a\bin\win64\m_interpreter.dll ModLoad: 00000000`12000000 00000000`1228a000 C:\Program Files\MATLAB\R2007a\bin\win64\xerces-c_2_6.dll ModLoad: 000007ff`724e0000 000007ff`7261e000 C:\WINDOWS\system32\dbghelp.dll ModLoad: 000007ff`7fbf0000 000007ff`7fbfb000 C:\WINDOWS\system32\VERSION.dll ModLoad: 00000000`017e0000 00000000`017eb000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwmathrng.dll ModLoad: 00000000`01800000 00000000`01a20000 C:\Program Files\MATLAB\R2007a\bin\win64\m_parser.dll ModLoad: 00000000`01a30000 00000000`01a3c000 C:\Program Files\MATLAB\R2007a\bin\win64\mtok.dll ModLoad: 00000000`01a50000 00000000`01a60000 C:\Program Files\MATLAB\R2007a\bin\win64\ir_xfmr.dll ModLoad: 00000000`01a70000 00000000`01aba000 C:\Program Files\MATLAB\R2007a\bin\win64\m_ir.dll ModLoad: 00000000`01ad0000 00000000`01ae4000 C:\Program Files\MATLAB\R2007a\bin\win64\libmex.dll ModLoad: 00000000`01b00000 00000000`01b7c000 C:\Program Files\MATLAB\R2007a\bin\win64\m_dispatcher.dll ModLoad: 00000000`01b90000 00000000`01bb7000 C:\Program Files\MATLAB\R2007a\bin\win64\datasvcs.dll ModLoad: 00000000`01bd0000 00000000`01d5e000 C:\Program Files\MATLAB\R2007a\bin\win64\mcos.dll ModLoad: 00000000`01d70000 00000000`01d9c000 C:\Program Files\MATLAB\R2007a\bin\win64\libmat.dll ModLoad: 00000000`01db0000 00000000`01ec2000 C:\Program Files\MATLAB\R2007a\bin\win64\libhdf5.dll ModLoad: 00000000`01ed0000 00000000`01ef1000 C:\Program Files\MATLAB\R2007a\bin\win64\m_pcodegen.dll ModLoad: 00000000`01f10000 00000000`01f2e000 C:\Program Files\MATLAB\R2007a\bin\win64\m_pcodeio.dll ModLoad: 00000000`01f40000 00000000`01f8c000 C:\Program Files\MATLAB\R2007a\bin\win64\profiler.dll ModLoad: 00000000`01fa0000 00000000`0200f000 C:\Program Files\MATLAB\R2007a\bin\win64\comcli.dll ModLoad: 000007ff`7ebc0000 000007ff`7ecd6000 C:\WINDOWS\system32\OLEAUT32.dll ModLoad: 00000000`02020000 00000000`020e6000 C:\Program Files\MATLAB\R2007a\bin\win64\udd.dll ModLoad: 00000000`02100000 00000000`021b2000 C:\Program Files\MATLAB\R2007a\bin\win64\uiw.dll ModLoad: 00000000`021d0000 00000000`021e4000 C:\Program Files\MATLAB\R2007a\bin\win64\iqm.dll ModLoad: 00000000`02200000 00000000`0220a000 C:\Program Files\MATLAB\R2007a\bin\win64\uinone.dll ModLoad: 00000000`02220000 00000000`02263000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwhardcopy.dll ModLoad: 00000000`02280000 00000000`0237d000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwgui.dll ModLoad: 00000000`02390000 00000000`023e5000 C:\Program Files\MATLAB\R2007a\bin\win64\libuij.dll ModLoad: 00000000`02400000 00000000`0241e000 C:\Program Files\MATLAB\R2007a\bin\win64\bridge.dll ModLoad: 00000000`02430000 00000000`025cb000 C:\WINDOWS\WinSxS\amd64_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6E02DFE5\MFC80.DLL ModLoad: 000007ff`78f10000 000007ff`78f51000 C:\WINDOWS\system32\WINSPOOL.DRV ModLoad: 00000000`7c630000 00000000`7c64f000 C:\WINDOWS\WinSxS\amd64_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_FDBC5A54\ATL80.DLL ModLoad: 00000000`025d0000 00000000`02656000 C:\Program Files\MATLAB\R2007a\bin\win64\udd_mi.dll ModLoad: 00000000`02670000 00000000`0268d000 C:\Program Files\MATLAB\R2007a\bin\win64\mwoles05.DLL ModLoad: 00000000`026a0000 00000000`028c2000 C:\Program Files\MATLAB\R2007a\bin\win64\hg.dll ModLoad: 00000000`028e0000 00000000`02b67000 C:\Program Files\MATLAB\R2007a\bin\win64\numerics.dll ModLoad: 00000000`02b80000 00000000`02b8c000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwamd.dll ModLoad: 00000000`02b90000 00000000`02c0d000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwcholmod.dll ModLoad: 00000000`02c10000 00000000`02c1b000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwcolamd.dll ModLoad: 00000000`02c20000 00000000`02c4b000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwlapack.dll ModLoad: 00000000`02c50000 00000000`02cf5000 C:\Program Files\MATLAB\R2007a\bin\win64\libfftw3.dll ModLoad: 00000000`02d00000 00000000`02da0000 C:\Program Files\MATLAB\R2007a\bin\win64\libfftw3f.dll ModLoad: 00000000`02da0000 00000000`02e61000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwumfpack.dll ModLoad: 00000000`02e70000 00000000`02e80000 C:\Program Files\MATLAB\R2007a\bin\win64\mlautoregister.dll ModLoad: 000007ff`7d500000 000007ff`7d539000 C:\WINDOWS\system32\IMM32.DLL ModLoad: 000007ff`7f000000 000007ff`7f187000 C:\WINDOWS\WinSxS\amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_0A7B2435\comctl32.dll ModLoad: 00000000`5d360000 00000000`5d36d000 C:\WINDOWS\WinSxS\amd64_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_C351F8E3\MFC80ENU.DLL ModLoad: 00000000`05dc0000 00000000`05e05000 C:\Program Files\MATLAB\R2007a\bin\win64\libguide40.dll ModLoad: 00000000`05e20000 00000000`05e52000 C:\Program Files\MATLAB\R2007a\bin\win64\mkl.dll ModLoad: 00000000`05e60000 00000000`05e66000 C:\Program Files\MATLAB\R2007a\bin\win64\mklcompat.dll ModLoad: 00000000`06880000 00000000`06dea000 C:\Program Files\MATLAB\R2007a\bin\win64\mllapack.dll ModLoad: 00000000`06df0000 00000000`06eb5000 C:\Program Files\MATLAB\R2007a\bin\win64\libifcoremd.dll ModLoad: 00000000`06ec0000 00000000`07020000 C:\Program Files\MATLAB\R2007a\bin\win64\libmmd.dll ModLoad: 000007ff`77230000 000007ff`772af000 C:\WINDOWS\system32\uxtheme.dll ModLoad: 000007ff`7a410000 000007ff`7a4af000 C:\WINDOWS\system32\MSCTF.dll ModLoad: 000007ff`7ce50000 000007ff`7ce91000 C:\WINDOWS\system32\apphelp.dll ModLoad: 000007ff`58af0000 000007ff`58b4c000 C:\WINDOWS\system32\msctfime.ime ModLoad: 000007ff`799e0000 000007ff`799e4000 C:\WINDOWS\system32\icmp.Dll ModLoad: 000007ff`57040000 000007ff`57071000 C:\WINDOWS\system32\iphlpapi.dll ModLoad: 000007ff`7e380000 000007ff`7e390000 C:\WINDOWS\system32\PSAPI.DLL ModLoad: 00000000`08120000 00000000`085fc000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\server\jvm.dll ModLoad: 000007ff`7e240000 000007ff`7e290000 C:\WINDOWS\system32\WINMM.dll ModLoad: 00000000`08620000 00000000`08629000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\hpi.dll ModLoad: 00000000`08640000 00000000`08650000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\verify.dll ModLoad: 00000000`08650000 00000000`0867a000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\java.dll ModLoad: 00000000`08680000 00000000`08694000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\zip.dll ModLoad: 00000000`0ed90000 00000000`0ef86000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\awt.dll ModLoad: 00000000`0ff90000 00000000`0ffa6000 C:\Program Files\MATLAB\R2007a\bin\win64\nativejava.dll ModLoad: 00000000`0ffc0000 00000000`0ffd9000 C:\Program Files\MATLAB\R2007a\bin\win64\nativejmi.dll ModLoad: 00000000`10c00000 00000000`10c07000 C:\Program Files\MATLAB\R2007a\bin\win64\nativeservices.dll ModLoad: 00000000`10c20000 00000000`10c7c000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\fontmanager.dll ModLoad: 00000000`11480000 00000000`1149a000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\net.dll ModLoad: 00000000`114a0000 00000000`114aa000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\nio.dll ModLoad: 00000000`11cb0000 00000000`11cb7000 C:\Program Files\MATLAB\R2007a\bin\win64\nativelex.dll ModLoad: 00000000`11ce0000 00000000`11ced000 C:\Program Files\MATLAB\R2007a\bin\win64\nativecmdwin.dll ModLoad: 000007ff`51d40000 000007ff`51e1b000 C:\WINDOWS\system32\spool\DRIVERS\x64\3\unidrvui.dll ModLoad: 00000000`07920000 00000000`0794c000 C:\Program Files\MATLAB\R2007a\sys\java\jre\win64\jre1.5.0_05\bin\dcpr.dll ModLoad: 00000000`07950000 00000000`07abe000 C:\Program Files\MATLAB\R2007a\bin\win64\libmwbuiltins.dll ModLoad: 00000000`07ae0000 00000000`07ae9000 C:\Program Files\MATLAB\R2007a\toolbox\matlab\timefun\private\dtstr2dtnummx.mexw64 ModLoad: 00000000`07b00000 00000000`07b09000 C:\Program Files\MATLAB\R2007a\toolbox\matlab\timefun\private\dtstr2dtvecmx.mexw64 (4a0.5ac): Break instruction exception - code 80000003 (first chance) *** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\ntdll.dll - ntdll!DbgBreakPoint: 00000000`77ef2ab0 cc int 3 Missing image name, possible paged-out or corrupt data. Missing image name, possible paged-out or corrupt data. Missing image name, possible paged-out or corrupt data. 0:021> g ModLoad: 000007ff`7dac0000 000007ff`7dc38000 C:\WINDOWS\system32\SETUPAPI.dll ModLoad: 000007ff`7ea10000 000007ff`7eaee000 C:\WINDOWS\system32\CLBCatQ.DLL ModLoad: 000007ff`7eaf0000 000007ff`7ebb6000 C:\WINDOWS\system32\COMRes.dll ModLoad: 000007ff`7da40000 000007ff`7dab3000 C:\WINDOWS\System32\cscui.dll ModLoad: 000007ff`7da10000 000007ff`7da3c000 C:\WINDOWS\System32\CSCDLL.dll ModLoad: 00000000`70d40000 00000000`70d62000 c:\cygwin\home\Administrator\mextest.mexw64 (4a0.768): C++ EH exception - code e06d7363 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) ... The same line is repeated about 2000 times ... (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Unknown exception - code c0000025 (first chance) (4a0.768): Stack overflow - code c00000fd (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. ntdll!RtlLookupFunctionEntry+0x49c: 00000000`77ee5f3c c644244000 mov byte ptr [rsp+40h],0 ss:00000000`004e3b20=00 Missing image name, possible paged-out or corrupt data. Missing image name, possible paged-out or corrupt data. Missing image name, possible paged-out or corrupt data.
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
