Mex Debugging with VS Code

42 visualizaciones (últimos 30 días)
Samuel Mason
Samuel Mason el 22 de Oct. de 2018
Editada: Lipi Vora el 24 de Oct. de 2018
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"
}
]
}

Respuestas (1)

Lipi Vora
Lipi Vora el 24 de Oct. de 2018
Editada: Lipi Vora el 24 de Oct. de 2018
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.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by