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 comentarios

Ganesh Regoti
Ganesh Regoti el 27 de En. de 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
Henrik Enquist el 27 de En. de 2020
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).
Ganesh Regoti
Ganesh Regoti el 27 de En. de 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
Henrik Enquist el 27 de En. de 2020
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.
Ganesh Regoti
Ganesh Regoti el 27 de En. de 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
Henrik Enquist el 27 de En. de 2020
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.
Adam
Adam el 27 de En. de 2020
Have you tried putting a disp instruction where the breakpoint is to make absolutely sure the code there is actually running?
Henrik Enquist
Henrik Enquist el 27 de En. de 2020
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.
Geoff Hayes
Geoff Hayes el 28 de En. de 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
Henrik Enquist el 28 de En. de 2020
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.
Geoff Hayes
Geoff Hayes el 28 de En. de 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
Henrik Enquist el 28 de En. de 2020
Interesting but frustrating.
It is the same behaviour for both of the cases you mentioned (main file and called functions in other files).
Geoff Hayes
Geoff Hayes el 28 de En. de 2020
Editada: Geoff Hayes el 28 de En. de 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
Allen el 29 de En. de 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
Henrik Enquist el 29 de En. de 2020
Geoff,
all breakpoints, regardless of location, are ignored.
Allen,
good point and something to be watchful of, but sadly not the case for me.
Adam
Adam el 29 de En. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 29 de En. de 2020
Editada: Image Analyst el 29 de En. de 2020

0 votos

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 comentarios

Henrik Enquist
Henrik Enquist el 29 de En. de 2020
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.
Image Analyst
Image Analyst el 29 de En. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Versión

R2019a

Preguntada:

el 21 de En. de 2020

Comentada:

el 29 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by