0

从理论上讲,如果我们中断应用程序的执行,并右键单击调试区域的变量部分中列出的变量,我们会得到一个带有选项“Watch variableName”的上下文菜单,如果我们点击它,一个为该变量设置了观察点...但是...我总是收到这条讨厌的消息:“错误:在此帧中找不到名为'$R#'的变量”,其中#因我尝试观察的变量而异。

我在这里做错了吗?

4

1 回答 1

0

My bad: I hadn't realized that in order to set a watchpoint for a variable, the execution must be stopped at the module WHERE THE VARIABLE IS DECLARED. Which makes no sense in the case of global variables, since their scope is the entire application. I stop execution at a point in another module where I'm actually using that variable, but since it's a module where it was not DECLARED, I get that weird error. So, I set a breakpoint at the very line where I declare the variable, and I'm able to set the watchpoint.

Thanks, @Rob, 'cos your question about the scope of the variable made me think about it :)

于 2019-01-09T22:58:03.773 回答