The "mexFunction" function is the name of the gateway function which every MEX function built with the C MEX API, Fortran MEX API, and CUDA runtime API requires. The frame line that contains the "mexFunction" keyword from the "Stack Trace" section of the crash log is the one which contains the name of the MEX function that caused the crash. Here is an example frame line from a stack trace containing the "mexFunction" keyword:
[ 15] 0x00007f93f0200fb0 /usr/share/psychtoolbox-3/PsychBasic/Screen.mexa64+00769968 mexFunction+00000700
In this example, the "Screen.mexw64" MEX function from the third-party Psychtoolbox Toolbox appears to be the one that caused MATLAB to crash.
If the MEX function is built using the C++ MEX API, "mexFunctionAdapter" will be the name of the gateway function which appears in the stack trace. Similarly, the frame line that contains the "mexFunctionAdapter" keyword from the "Stack Trace" section is the one which contains the name of the MEX function that caused the crash. Here is an example frame line from a stack trace containing the "mexFunctionAdapter" keyword:
[ 1] 0x000000006aa05323 C:\Users\user1\Documents\arrayProduct.mexw64+00021283 mexFunctionAdapter+00000531
In this example, the custom MEX function "arrayProduct.mexw64" appears to be the one that caused MATLAB to crash.
Finally, please keep the following additional guidelines in mind when investigating the MEX function that caused MATLAB to crash:
- If the MEX function is located inside the MATLAB root folder and is an official MathWorks function, contact MathWorks Technical Support for further assistance along with reproduction steps and relevant files.
- If you are not the author of this MEX function, you may want to contact the author for help in troubleshooting this MATLAB crash. The original author may assist in troubleshooting the MEX function, or they may provide you with the source code so that you may troubleshoot the MEX function yourself.