This issue occurs because Java expects segmentation violation signals (SIGSEGV) to be thrown in certain operations, traps them, and deals with them or turns them into Java exceptions. To work around this issue, consider the following options:
1) If Java is not required, then start MATLAB with the '-nojvm' option by executing the following command at the GDB command prompt to resolve this issue:
2) If Java is required, then turn off the debugger trap for SIGSEGV while starting MATLAB and turn it on just before executing the MEX file. This can be achieved by executing the following commands at the GDB prompt while starting MATLAB:
Once MATLAB is running, set a breakpoint in the MEX file and then continue until the breakpoint is reached. Then, type the following at the GDB command prompt
to allow the debugger to start trapping SIGSEGV again. Note that the above commands are GDB commands issued to the GDB prompt (not the MATLAB prompt), and other debuggers have different ways of doing the same thing.
Best Answer