VS debugger matlab mex "not currently a breakpoint is hit, there is no symbol for the document to load any" can not hit a breakpoint

VS debugger matlab mex "not currently a breakpoint is hit, has not loaded any symbol for the document" could not hit a breakpoint Solution

VS can debug matlab mex file, but sometimes baffling "The current can not hit a breakpoint, has not loaded any symbol for the document" and can not hit the breakpoint. Bloggers spent four hours and finally find out where the pit.

Current methods to change the online VS settings are invalid!

lab environment

Visual Studio 2017
matlab 2018b
WIN 10

Problems of small official operating partner press to go again

https://ww2.mathworks.cn/help/matlab/matlab_external/debugging-on-microsoft-windows-platforms.html?action=changeCountry&s_tid=gn_loc_drop

Handling over:

  • Make sure you choose Visual Studio C compiler:
cc = mex.getCompilerConfigurations('C','Selected');
cc.Name

= ANS
in the Microsoft Visual C ++ 2012 © (2015,2017 does not matter here)

  • A copy of the official sample, compiled with -g MEX source file, this option will produce .mexw64 and .mexw64.pdb file
copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'),'.','f')
mex -g yprime.c
  • Start Visual Studio. Do not quit your MATLAB® session.

  • From the Visual Studio Tools menu, select Attach to Process.

  • In the "Attach to Process" dialog box, select the process and click on additional MATLAB (do not change anything !!)
    Visual Studio to load the data and then displays an empty code pane.

  • Open> the file by choosing File> Open source file yprime.c. Matlab find yprime.c in the working directory. (No new VS Solutions)

  • Set a breakpoint in mexFunction entrance.
    This time the breakpoint is hollow and shows "the current can not hit a breakpoint, has not loaded any symbol for the document," it is normal!

  • In the command line to run their own (not written in matlab script inside plus break)

yprime(1,1:4)
  • Finally, the proposed closure Debug> Window> Exception Settings> check box under win32 exception

If you can hit a breakpoint please read

In the absence of closed VS debugger, how many times can hit the play command. But once you quit VS debugger, reboot (re-attach to the process) How many times can not hit the breakpoint!
But matlab re-mex -g yprime.c they can hit. . .

But you can not always cool only once it orz ...

I began to think that what VS change the pdb file, or without reloading, and eventually found should be turned off when the communications in matlab VS debugger is terminated, but do not know matlab, maintained a unilateral communication, this time onlyclear allRe calling (VS attach to the process open)

yprime(1,1:4)

To re-hit the breakpoint!

If help please leave a message, thank you

Released nine original articles · won praise 2 · Views 4634

Guess you like

Origin blog.csdn.net/zb12138/article/details/104781129