Using Visual C++ attached to Matlab session to debug mex function but local variables are wrong.
Show older comments
When I attached the Visual C++ 2010 Express to R2011b and then set a breakpoint inside the source for a complied mex function I expected the locals window to show values of variables defined in the function scope. Some are there but wrong and others are missing - like a variable defined by "int function_id;" for example. This is the first time I have tried this so I assume I am missing some large concept. It seems like it should work. What do I need to do or need to understand? The compiler selected by mex -setup is the Visual C++ express.
6 Comments
Adam
on 15 Sep 2014
Did you compile the mex with debug symbols?
Eric nestler
on 15 Sep 2014
Adam
on 15 Sep 2014
I mostly compile mex files in Matlab itself where the -g option adds the required debug information.
When I compile in Visual Studio I don't seem to remember doing much beyond setting up the correct combinations in the Configuration Manager to build correctly in either debug or release mode for x64 or Win32 (not in my case), but it is a while since I setup such a project so I may be wrong.
Eric nestler
on 15 Sep 2014
Adam
on 15 Sep 2014
You may need the
-largeArrayDims
option instead of -compatibleArrayDims. This is a problem I had on first building mex when using size_t's, but again this is a good few months ago so I can't remember the exact details. I do remember reading the mex documentation and deciding that largeArrayDims was the option I needed though.
Eric nestler
on 15 Sep 2014
Answers (0)
Categories
Find more on Call C++ from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!