Chapter 21 does not fit the output

In paragraph “Exploring properties through SBValue offsets” right from the beginning the things goes wrong.

 (lldb) script print a.GetNumChildren()

gives 3 instead of 4.

(lldb) script print a.GetChildAtIndex(0)


(UICachedDeviceRGBColor *) _eyeColor = 0x0000608000070e00

instead of

(NSObject) NSObject = {
  isa = DSObjectiveCObject

but in the same time

script a.deref.size

gives same 32.

So what was happened with the SBValue? And how do i get isa property in this case?

@yasroslav, the LLDB type system and the state it gets in can sometimes be a little wonky. If you know the type you want to cast to for an evaluate expression, you can do that by hunting down the correct SBType and casting the SBValue to that type

For example:

(lldb) script k ='NSObject')
(lldb) script print lldb.frame.EvaluateExpression('UIApp').Cast(k).GetChildAtIndex(0)
(Class) isa = 0x00007f8a6201fe00

Also be aware of the GetPointerType() method (and friends) available to the SBType