Mex Debugging with VS Code

조회 수: 29 (최근 30일)
Samuel Mason
Samuel Mason 2018년 10월 22일
편집: Lipi Vora 2018년 10월 24일
Trying to setup debugging of mex files through vs-code, following this tutorial. After compiling the mex file via
mex -g ${files}.cpp -L${linkedfiles.lib}
and attaching the debugger to MATLAB's process, this warning is shown at the top of the debug console within VS Code:
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
followed with (after many [New Thread xxxx.xxxx]]:
0x00007ffef41bd8c1 in ntdll!DbgBreakPoint () from C:\WINDOWS\SYSTEM32\ntdll.dll
The debugger also shows that any breakpoints added are "unverified", and when running the compiled mex file, any breakpoints are ignored.
All compiled files and VS Code workspace are in MATLAB's workspace folder.
Mex Compiler Config:
>> cc = mex.getCompilerConfigurations('C++')
cc =
CompilerConfiguration with properties:
Name: 'MinGW64 Compiler (C++)'
Manufacturer: 'GNU'
Language: 'C++'
Version: '5.3.0'
Location: 'C:\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64'
ShortName: 'mingw64-g++'
Priority: 'E'
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: 'C:\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin\g++'
LinkerVersion: ''
MexOpt: 'C:\Users\masom\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C++_win64.xml'
Launch.json:
{
"name": "(gdb) Attach to Matlab",
"type": "cppdbg",
"request": "attach",
"program": "C:/Program Files/MATLAB/R2018a/bin/win64/MATLAB.exe",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"miDebuggerPath": "C:/mingw-w64/x86_64-5.3.0-posix-seh-rt_v4-rev0/mingw64/bin/gdb.exe",
"setupCommands": [
{
"text": "handle SIGSEGV nostop"
},
{
"text": "handle SIGSEGV noprint"
}
]
}

답변 (1개)

Lipi Vora
Lipi Vora 2018년 10월 24일
편집: Lipi Vora 2018년 10월 24일
Hi,
I followed the steps mentioned in the tutorial for an example MEX file found in my case in, “C:\Program Files\MATLAB\R2018a\extern\examples\mex\arrayProduct.c” MATLAB folder. I am able to hit breakpoints in the “arrayProduct” function in VS Code. I would recommend you try the steps with a sample MEX file to eliminate issues that might be arising specific to your source code.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by