dbquit (or click "quit debugging") doesn't always seem to exit debugmode?
30 次查看(过去 30 天)
显示 更早的评论
Hi All,
I've seen this behavior, actually, my entire matlabbing live, but i've never thought about it twice until today (because it became a bit annoying).
Sometimes, when I'm debugging, and want to exit debugmode, it doesn't exit debugmode immediately when giving dbquit command. I think this probably has to do with debugging in nested functions or executing other commands in between, and the dbstop command being turned on? I'm not sure.
However, on some occassions, I really have to execute dbquit about ten or more times ('arrow up, enter, arrow up, arrow up, enter). This has happened to me on many occassions.
Today, this seemed to happen while it stopped in debugmode on a particularly line that takes a sec's to compute (input parsing). I noticed that, when trying to exit debugmode, it takes a while before it stops being "busy" and is again in debug mode, approximatly the same time this line would normally take (rough estimate, could be a coincidence). This makes me think that, after dbquit matlab is trying to execute this line again, catches and error or find the breakpoint, and stops in dbmode again.
I hope this makes some sense. Anyone have some experiences like this as well? Not sure if this would be a bug, or weird combination of debug-things i'm using (i.e. dbstop).
PFA bonus image of dbquit not doing anything
0 个评论
回答(3 个)
Prabhan Purwar
2021-3-16
编辑:Prabhan Purwar
2021-3-16
Hi,
Could you please provide us the code along with the reproduction steps you have tried in a sequential manner so that we can replicate the issue.
Thanks
0 个评论
Walter Roberson
2021-3-16
dbquit('all') ends debugging for all files at once.
(Requires a somewhat new MATLAB release.)
However... in practice:
- if you managed to put a breakpoint in a timer interrupt and the timer busyaction was not set to cancel, then the timers are still set to be debugged
- if you have dbstop if naninf in effect and you have background plotting going on, such as fplot(), you are probably going to have a rough time. It turns out that some of the graphics routines are careless about using inf sometimes, such as some that compare values to inf instead of using isfinite(), and some that only need the inf on specific paths but set inf on the common path and then overwrite it on the more specific paths
- if you have dbstop if caught error in effect and you made any of a number of kinds of plot interactions, you are in for "fun". It turns out that parts of the interactions routinely go through paths that are expected to usually trigger errors (unless certain undocumented internal conditions have been set up, hooks to permit substituting alternative routines in places for development purposes, for example.) And it turns out that the relevant routines can get triggered over and over again while you are working in the debugger, because they are triggering on things like you not being in the expected window, which you are not because you are talking to the debugger...
If dbquit all does not work, then clear dbstop if error, dbstop if caught error, dbstop if warning, and dbstop if naninf . These will not always be enough, but they help .
Eddie
2024-7-12
The issue has troubled me for eons too. It's usually caused by graphics interactions whose errors got triggered a gazillion times before MATLAB throws the error and stops in debugger. For example, if you have a error prone callback detecting mouse motions, you'll get a very long stack of 'stops' in the debugger at the same line where the error throws. On one occasion, I probably had clicked 'Stop' debugging for like a hundred times to get out of the debugger!
Frustratingly, 'dbquit all' did nothing but exiting one stop at a time. I still had to execute dbquit for many times before it finally quit the debugger. Then I had an idea - what if I could copy and paste a bunch of 'dbquit all' and let MATLAB do the drudgery? It worked! Here is my hack solution -
Use an autocompletion program like AutoHotKey, try inserting these lines in the command window by pressing a hotkey or simply copy&paste -
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
dbquit all
... (you can repeat more lines if you like)
Press enter. Now with one go, MATLAB clears the very long debugger stack that would otherwise take you forever to clear.
Still hoping Mathworks can engineer a more elegant solution!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!