LLDB: Beyond "po"

Description: LLDB is a powerful tool for exploring and debugging your app at runtime. Discover the various ways to display values in your app, how to format custom data types, and how to extend LLDB using your own Python 3 scripts.

po, Print Object Description

  • Textual representation of the instance at hand.
  • The runtime system provides a default representation, however we can customize it for any type by conforming to the CustomDebugStringConvertible protocol.
  • Conforming to this protocol changes only the top level description of that type (not the nested properties)
  • po is actually an alias to expression --object-description

p, print

  • In p we can see that the result of the expression is assigned to a $Rx value that later we can use to reference that object in our debugging.

v, frame variable

  • v doesn’t compile any code, and has a different syntax than the language that you’re debugging

po vs. p vs. v

Missing anything? Corrections? Contributions are welcome 😃

Related

Written by

Federico Zanetello

Federico Zanetello

Software engineer with a strong passion for well-written code, thought-out composable architectures, automation, tests, and more.