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

1 次查看(过去 30 天)
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?

采纳的回答

Roberto Olmi
Roberto Olmi 2017-3-22
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by