简体   繁体   English

如何在GDB中将断点设置为类成员变量

[英]How set breakpoint to class member variable in gdb

How can I set breakpoint (or watchpoint) to member variable in class for all instances of this class? 如何为此类的所有实例在类中的成员变量上设置断点(或监视点)?

I have tried set breakpoint on line in class with this member variable but this is not working. 我尝试使用此成员变量在类中的行上设置断点,但这不起作用。

You can set breakpoint to the setter and getter function as shown below 您可以将断点设置为setter和getter函数,如下所示

break TestClass::setVal(int)
break TestClass::getVal()

Note that, we have to specify the type of arguments that the function is receiving. 请注意,我们必须指定函数要接收的参数的类型。

Find more details here 在这里找到更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM