MATLAB closes/times out when debugging MEX/native code.
Hello there!
I use the VS code MATLAB extension to run my MATLAB session and use the MSVC cppvsdbg debugger on Windows to debug MEX C code. I attach cppvsdbg to the MATLAB process and can use it to debug MEX code just fine. However, when cppvsdbg pauses the MATLAB process for debugging, the MATLAB process gets terminated after 70 seconds. (The program '[20516] MATLAB.exe' has exited with code 1 (0x1).)
This is not the happening when I debug a MATLAB session that is running the "usual" way with the MATLAB gui. I can pause that one in the debugger for days and it will keep working. So what I suspect is, that there is some communication timeout in the VS code extension that requires the MATLAB process to answer before 70 s (which it can't, because it is paused in the debugger), or it will terminate the process.
Maybe you can add a way configure this timeout, so debugging native code becomes possible?
To Reproduce
- Run MATLAB from the VS code extension.
- Attach cppvsdbg (or gdb) to the MATLAB process.
- Pause the MATLAB process in the debugger.
- MATLAB process gets terminated after 70 seconds.
Expected behavior MATLAB process should stay alive.
Hi @ju-w , thanks for raising this to our attention!
This is something we would like to resolve in the future.
Hi @dklilley, I have a problem about the debug function in vscode. I am trying to use matlab in jupyter with the extension jupyter-matlab-proxy. The "Start Debugger Automatically" is set True. However, the debug mode fails to stop in the breakpoint for both jupyter and matlab files. The software is as following: Vscode V1.98.2 Matlab V2021b Matlab Extension for VS Code V1.3.3 jupyter-matlab-proxy v0.16.4 System MacOS V15.5
Hi @niukai10 , this sounds like a separate issue from this thread. Can you please open a new issue for this?
Hi @dklilley, thanks for your timely reply. I have opened a new issue mathworks/jupyter-matlab-proxy#113.