Set conditional breakpoint in lldb for integer variable

38 Views Asked by At

ALL,

I'm trying to debug a failure in the unit test.

The code is running a loop of 1000 iterations and the failure occur in the step 140.

I'm on OSX and so using lldb.

I tried to do:

break set -f textctrltest.cpp -l 681 -c i == 139

but the code still stopped at the line with the i == 1.

Unfortunately it looks like all similar question refer to the string conditional breakpoint and no basic integer check.

Could someone please explain how to do that properly?

TIA!!

1

There are 1 best solutions below

1
On

The lldb command line is space delimited. So the actual condition text your command set when doing:

break set -f textctrltest.cpp -l 681 -c i == 139

was just i, and then the command had two arguments, == and 139.

If you make this mistake in a recent lldb, the command will generate the error:

(lldb) break set -f textctrltest.cpp -l 681 -c i == 139
error: 'breakpoint set' doesn't take any arguments.

though in older lldb's the command parser had a bug where it just ignored extra arguments, which is probably why you didn't notice this.

The correct command is:

(lldb) break set -f textctrltest.cpp -l 681 -c "i == 139"
Breakpoint 1: no locations (pending).

You can also verify that this worked with break list, which lists the condition among other details:

(lldb) break list 1
1: file = 'textctrltest.cpp', line = 681, exact_match = 0, locations = 0 (pending)
Condition: i == 139