[英]GDB conditional breakpoint syntax error
I am trying to figure out why my C++ program is failing an assertion. 我试图弄清楚为什么我的C ++程序无法通过断言。 I want to analyze the current variable values at the time of the failure, but the program exits when the assertion fails and so the scope is lost. 我想分析失败时的当前变量值,但是断言失败时程序会退出,因此会丢失作用域。 I therefore want to set a conditional breakpoint with the assertion condition negated. 因此,我想在断言条件为否的情况下设置条件断点。 The assertion looks like this: 该断言如下所示:
assert( AddrRange(pkt->getAddr(),
pkt->getAddr() + pkt->getSize() - 1).isSubset(range) );
In GDB, I do: 在GDB中,我这样做:
break filename.cc:linenum if (AddrRange(pkt->getAddr(), pkt->getAddr() + pkt->getSize() - 1).isSubset(range) == false )
but this results in: 但这导致:
A syntax error in expression, near `pkt->getAddr(), pkt->getAddr() + pkt->getSize() - 1).isSubset(range) == false )'.
I tried creating the breakpoint first and then using cond, but I get the same syntax error. 我尝试先创建断点,然后再使用cond,但遇到相同的语法错误。 What am I doing wrong? 我究竟做错了什么?
我最终修改了代码,并将函数调用返回值保存到bool中,然后使用bool变量创建了条件断点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.