I am trying to figure out why my C++ program is failing an assertion. 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:
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. What am I doing wrong?
I ended up modifying the code and saving the function call return value to a bool, and then creating the conditional breakpoint using the bool variable instead.