First, compile codes with DSYM:

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

then, launch with LLDB Debugger:

1
lldb test

print codes:

1
list(l) numbers

set breakpoint:

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

enable breakpoint:

1
breakpoint enable 1

run program:

1
run

print variable:

1
po varX

debug step-in:

1
n

continue to end:

1
c