First, compile codes with DSYM:

plaintext
1
g++ -g test.cpp -o test

then, launch with LLDB Debugger:

plaintext
1
lldb test

print codes:

plaintext
1
list(l) numbers

set breakpoint:

plaintext
1
breakpoint set --file test.cpp --line 13

enable breakpoint:

plaintext
1
breakpoint enable 1

run program:

plaintext
1
run

print variable:

plaintext
1
po varX

debug step-in:

plaintext
1
n

continue to end:

plaintext
1
c