GDB is the debugging system built into Xcode. Xcode handles much of the
interaction with GDB to provide support for breakpoints, stepping
through/over code, however, GBD also provides a command line that you
can use to work directly with the debugger.
Have a look to the following tutorial
Have a look to the following tutorial