2
votes

After viewing the WWDC2013 LLDB Debug session, I want to add a custom type formatter for one my NSManagedObject subclasses. You can do this by typing in the debugger

type summary -add MyClass --summary-string "${var._name}"

This works but only on variables, not on methods, hence properties. I've also tried using a python script via valobj.GetChildMemberWithName without success.

How can I display a property on an NSManagedObject subclass on LLDB ?

More Info: http://lldb.llvm.org/varformats.html

1

1 Answers

3
votes

Long story short, as you realized the ${var.foo} syntax only works for ivars. Not for methods. Not for properties (which are methods, give or take syntactic sugar).

I have been thinking about a syntax to run expressions in the string summary format. It would look something like ${expr:[$var selector]} or ${expr:3+$var}

Lacking that, for now your workaround is to go to Python, and use the SBFrame.EvaluateExpression command. There are examples of Python formatters in the LLDB source code, and on the website that you can use as a starting point.