我正在尝试在 MATLAB R2011b 中调试不是我自己编写的面向对象的应用程序。为此,我想在 classdef
的方法中放置一个断点。据我所知,这是允许的。然而,当我运行该应用程序时,断点神秘地消失了。
我在 clear
中配置了一个断点,如下所示:
dbstop in clear
查看何时调用 clear
。在运行应用程序之前,我使用 dbstatus 检查断点是否存在:
>> dbstatus
Breakpoint for Processor>Processor.setResult is on line 114.
Breakpoint for inputCompute is on line 30.
Breakpoint is set for m_interpreter>clear.
(有问题的断点是列表中的第一个。)当我运行应用程序时,classdef 中的断点在调用第一个清除之前消失了:
>> rootFunction('configuration')
417 clear('Data');
K>> dbstatus
Breakpoint for inputCompute is on line 30.
Breakpoint is set for m_interpreter>clear.
为了确定断点在哪里被清除,我逐渐将断点移动到离根函数开始越来越近的位置,并找到了有问题的代码行:
cd('./configs');
果然 - 任何 cd
调用,即使是间接调用,都会清除 classdef
中的断点。这意味着 run
做完全相同的事情。这是令人愤怒的行为。为什么 MATLAB 会这样做?我如何防止它这样做?
最佳答案
我发现了相同的错误并将其报告给 Matlab。他们说:
Unfortunately, this is a known bug with the editor. Development department is aware of the problem and plans to fix it in a future release. As a workaround, you could use a line containing the single statement
keyboard
rather than set a breakpoint. You can easily comment in/out this line.
建和会
关于matlab - 为什么 MATLAB 会删除我的 classdef 中的断点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17836523/