Mex Debugging with VS Code

58 ビュー (過去 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 Center および File ExchangeMATLAB Compiler についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by