Yos Riady software craftsman 🌱

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.

Author

Yos is a software craftsman based in Singapore.

📬 Subscribe to my newsletter

Get notified of my latest articles by providing your email below.


Going Serverless book

Interested to find out more about serverless? Going Serverless 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 →