Yos Riady optimize for learning

Hands-On XCode Debugging

Having used the interactive python debugger ipdb for my Python projects, I missed having a REPL in the standard Objective-C IDE. Fortunately, XCode comes equipped with a REPL called LLDB.

After adding a breakpoint in your code, you can interact with your code using LLDB commands in the bottom right window as shown in the following screenshot:

LLDB is in the bottom right window

Here are a couple basic LLDB commands that I’ve found useful:

po (prints output)
n/next (step over)
s/step (step into)
c/continue (continues execution)
expr (for functions and expressions)

You can also define new breakpoints dynamically, add watchlists to monitor variables, and more. See the full command reference.

For a good look at how to use Xcode’s debugging features, all powered by the LLDB debugging engine, see the WWDC 2013 session video for Tools #407 WWDC 2013: Debugging with Xcode.

To see the latest advanced techniques to help you efficiently track down bugs with LLDB, view the WWDC 2013 session video for Tools #413 WWDC 2013: Advanced Debugging with LLDB.


You should follow him on Twitter.

📬 Get updates straight to your inbox!

Subscribe to my newsletter to make sure you don't miss anything.

Here's something you might be interested in...

Going Serverless book

Have you heard about the Serverless programming model? The Going Serverless book teaches you how to build scalable applications with the Serverless framework and AWS Lambda. You'll learn how to design, develop, test, deploy, and secure Serverless applications from planning to production.

Learn more →