Using GDB from the Command Line

Let’s start by learning to drive gdb from the command line. Why waste time with gdb’s command-line mode? Historically, gdb has been a command-line program. GUIs layered on top of gdb never export all of its features: to wield its full power, you must learn to use its command-line interface. From the command line, you can leverage all of gdb’s features, both common and esoteric. Luckily, Xcode gives you a console pane to interact with gdb’s command line, so you have the best of both worlds there.

Being comfortable at the gdb command line also makes gdb more useful when you want to do remote debugging, that is, running your program and the debugger on another machine over an ssh connection. Xcode has some remote ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.