Why I can't add breakpoints while paused in debugger inside a timer callback function

2 views (last 30 days)
If I've a function "test":
function test(callerObj,callerEvent)
pause(0.001);
justToDoSomething = 1;
end
and I create a timer to call it:
ctimer = timer('TimerFcn', @test,...
'Period', 5,...
'ExecutionMode', 'fixedSpacing',...
'BusyMode', 'drop');
start(ctimer)
If I set a breakpoint in "test" the execution pauses correctly, but then if try to
  • remove current breakpoint
  • add more breakpoints
by clicking near to line number in the editor window, those changes does not appear in the editor until the function does not return. Breakpoints additions/removals appear in the editor only at next execution of the timer callback. The only way I have to set or remove breakpoint immediately is by using "dbstop" and "dbclear" commands: in this case changes take effects immediately without having to wait for next function call. But this is very unconfortable.
This happens with Matlab 2016b but not with version 2012a.
What can I do to be able to add/remove brakpoints (with mouse clicks) while paused in debugger?

Accepted Answer

Roberto Olmi
Roberto Olmi on 22 Mar 2017
I made a support request to Mathworks and they told me that this is a known bug. It seems that it has been introduced since version 2016a.
Here is what they wrote to me:
They are working on fixing it for a future release but we have no time line for when it will be fixed. Your workaround of setting breakpoint explicitly in the command window is the best we can offer for now.

More Answers (0)

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!