Breakpoints are ignored when running a GUI

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

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.
Hi Ganesh
I have set breakpoints and they are active (red) but they are ingored (skipped) when running the application in Matlab.
Future apps will be developed in appdesigner, but we have no plans to migrate existing ones from GUIDE to appdesigner (yet).
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.
Hi,
Code with breakpoints is executed. Breakpoints have been re-assigned, both by clicking in the code window side bar and by using the menu option. No success.
The application is quite large and it's unfortunately not easy to break out a "sample application" for others to test.
I agree that it's difficult to come up with a solution. That's the reason I posted the question here.
What does 'definitive code' mean?
As per the original post, I have no 'clear all' or similar commands in the code, so the first link is not helpful.
The second link provides info about how to set breakpoints, which I already know.
The code executes without error, so I 'dbstop if error' is not really an option.
Have you tried putting a disp instruction where the breakpoint is to make absolutely sure the code there is actually running?
Yes.
The code runs (disp prints message to command window) and the breakpoint is still set and activce (red) but ignored/skipped.
Hi,
Are you facing the issue with all the GUIDE applications? If yes, then run the following command and re-try
>>rehash toolbox
Hello,
rehash toolbox
didn't solve my issue unfortunately.
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?
Sorry for the confusion, Geoff.
I mean that if I run parts of the code using 'Run section' in the MATLAB editor, breakpoints are respected.
When I launch the GUI using 'Run' on the main file, the same breakpoints are not respected.
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).
Interesting but frustrating.
It is the same behaviour for both of the cases you mentioned (main file and called functions in other files).
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.)
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.
Geoff,
all breakpoints, regardless of location, are ignored.
Allen,
good point and something to be watchful of, but sadly not the case for me.
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.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 29 Jan 2020
Edited: Image Analyst on 29 Jan 2020
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

As a matter of fact, I use a sub-GUI in this case. However, I have set breakpoints in both the main-GUI .m file, in the sub-GUI file, and in other files containing called functions. All breakpoints are ignored/skipped but still present and active in the editor.
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.

Sign in to comment.

Categories

Products

Release

R2019a

Asked:

on 21 Jan 2020

Commented:

on 29 Jan 2020

Community Treasure Hunt

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

Start Hunting!