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"
}
]
}