Is it possible to debug a mex function in VS Code with MINGW 8.1?

조회 수: 4 (최근 30일)
btmy87
btmy87 2025년 7월 30일
댓글: Daewon 2025년 9월 17일
I'm trying to debug a mex function in VS Code with MINGW 8.1 and MATLAB R2025a on Windows. I followed the directions in this blog post: https://blogs.mathworks.com/developer/2018/06/19/mex-debugging-vscode. But VS Code refuses to load the symbols and detect the break point. I tried this procedure in several different MATLAB versions, and I believe the difference is related to the `gdb` version that's included with MINGW and how it interacts with VS Code.
  • Using MATLAB R2023b, I can successfully debug a mex function using MINGW 6.3, but the procedure no longer works when using MINGW 8.1. Both MINGW 6.3 and 8.1 are supported by this version of MATLAB. https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/system-requirements-release-2023b-supported-compilers.pdf
  • Using MATLAB R2025a, I cannot debug a mex function using MINGW 8.1 through VS Code. The debugging symbols do not appear to load. I tried the troubleshooting steps below.
  • I verified that I attached to the right PID by using Process Explorer to verify the mex function was loaded under that PID.
  • I double-checked that I called mex with the `-g` option.
  • I ran `gdb` from the command prompt, and I was able to attach to the process, set a breakpoint, and stop when calling the mex function. So the symbols are definitely in the dll.
  • I tried both my mex function, and the 'explore.c' example included with MATLAB. I get the same results for both cases.
  • I tried a stand-alone installation of MINGW 8.1, and a copy of MINGW 8.1 installed as a MATLAB add-on.
  • Using MATLAB R2025a, I can compile the mex function using MINGW 8.1, and successfully debug using MINGW 6.3. I can also debug successfully using MINGW 15.1.
While there are other workarounds, I'm hoping for a solution entirely within the MATLAB MINGW addon.
  댓글 수: 3
btmy87
btmy87 2025년 8월 5일
No issues debugging in Visual Studio directly, or when using MSVC compilers and VS Code. I'm trying to get this to work on a system that only has MINGW 8.1 installed as a MATLAB Add On.
Daewon
Daewon 2025년 9월 17일
I have the same problem. I have also tried ming 6.3 and I was not able to get this work for me either.
I have not tried debuging with min 15.1, which I can try next.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품


릴리스

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by