Breakpoints are ignored when running a GUI
Show older comments
Breakpoints are ignored when running a GUI created using GUIDE.
The breakpoints are not cleared i.e. still visible/acitve in the Editor.
There are no 'clear all' commands in the code.
Breakpoints are respected when running the code in the Editor window.
I have tried restarting MatLab and rebooting the computer.
Please advice.
18 Comments
Ganesh Regoti
on 27 Jan 2020
Hi,
Can you please elaborate about the issue? I am unable to understand whether you want to add or clear break points.
And also I would suggest you to use appdesigner rather than using GUIDE.
Henrik Enquist
on 27 Jan 2020
Ganesh Regoti
on 27 Jan 2020
Hi,
Can you share a sample application. I'm unable to reproduce the issue, it's working fine on my system.
Try to cross-check if that part of code is covered during execution. If that line of code is not executed then there no way it would stop at that point.
Or else try re-assiging the breakpoints. To get more clarity, try to put break points at some other line that you are so sure would have a hit.
Henrik Enquist
on 27 Jan 2020
Ganesh Regoti
on 27 Jan 2020
Did you test by putting the break point at definitive code?
It's hard to come up with the solution without understanding the problem.
Can you go through the following links.
Henrik Enquist
on 27 Jan 2020
Adam
on 27 Jan 2020
Have you tried putting a disp instruction where the breakpoint is to make absolutely sure the code there is actually running?
Henrik Enquist
on 27 Jan 2020
Ganesh Regoti
on 28 Jan 2020
Hi,
Are you facing the issue with all the GUIDE applications? If yes, then run the following command and re-try
>>rehash toolbox
Henrik Enquist
on 28 Jan 2020
Geoff Hayes
on 28 Jan 2020
Henrik - you mention that Breakpoints are respected when running the code in the Editor window. I understand this to mean that you are in the MATLAB editor and press the green triangle (run) button and the GUI launches and you are able to step through the code when the breakpoints are hit. Is this the case? If it is, then how are you running the GUI when the breakpoints are not being hit? Are you launching the GUI from the command line or doing something else?
Henrik Enquist
on 28 Jan 2020
Geoff Hayes
on 28 Jan 2020
Interesting....when I launch the GUI using 'Run' on the main file (either from the editor or from the main MATLAB app) then the breakpoints within the GUI are respected. I'm curious as to the code that you call 'Run section' on from the MATLAB editor. Is this code that is in your GUI m-file or code that is called from your GUI (i.e. functions that your GUI calls).
Henrik Enquist
on 28 Jan 2020
Geoff Hayes
on 28 Jan 2020
Edited: Geoff Hayes
on 28 Jan 2020
yes, I can imagine it is frustrating. If the code sections whose breakpoints are not respected are in files/functions outside of your GUI m-file, could you put a breakpoint in the m-file at the point where those functions are called and then step in to that function (that has the breakpoint that is not respected) with the debugger? Or are all breakpoints, regardless of location, ignored?
(To be honest, I feel that I've seen this behaviour before but can't remember what the real problem was or how to get around it.)
Allen
on 29 Jan 2020
Have to ask since I have gotten bitten by this on more than one occasion, but is there only one copy of the *.m file that you are trying to apply breakpoints too? Often I will create copies of all of my files I am incorporating into my GUI and put them into a new folder and add that directory location to the active paths. From there I will edit the copy in the folder and try to add breakpoints when debugging, however, the main directory is searched first when the function is called, for which no breakpoints currently exist.
Henrik Enquist
on 29 Jan 2020
Adam
on 29 Jan 2020
Have you tried resetting your path to the minimum of just Matlab toolboxes plus what you need for your GUI (although it if fails on every GUI you could try with only Matlab stuff on the path and create a basic GUI to test). I don't know what function it is that is triggered internally to hit a breakpoint, but maybe you have some 3rd party code on your path that is over-riding that function? Would be a bit surprising though if that were the case.
Answers (1)
Image Analyst
on 29 Jan 2020
Edited: Image Analyst
on 29 Jan 2020
0 votes
I do remember seeing that several versions ago but only for the situation where the breakpoints were in a sub-GUI created by GUIDE. It would stop at locations in the main GUI but not in the sub-GUI. However it seems like they fixed that problem with more recent versions. Do you have your breakpoints in code in a separate .m file (& .fig file) that gets called by the main GUI?
2 Comments
Henrik Enquist
on 29 Jan 2020
Image Analyst
on 29 Jan 2020
Yes, that was almost my situation. It would stop at the breakpoints in the main gui but not the sub-gui. But I don't see that anymore so I think they fixed it 2 or 3 years ago and you should not see it in your release. When you run the program, are all files saved (no asterisk after the name on the editor tab)? They must be saved so make sure there are no asterisks. So, assuming that doesn't fix it, call them. I just called them last week about GUIDE not allowing me to have a callback with a pulldown menu item and they told me it was a known bug that will be fixed in Update 4, accessible from the Add Ons button on the tool ribbon, but it's not out yet, as of Jan 25, 2020. So maybe your issue is a known bug, though I can't reproduce it.
Categories
Find more on Startup and Shutdown 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!