2013-12-06

lldb and Objective C: printing structs contained in objects.

I'm tired of looking up how to do this.

Wrong:
(lldb) expr -- self.scrollView.frame
error: unsupported expression with unknown type
error: unsupported expression with unknown type
error: 2 errors parsing expression
(lldb) expr -- (CGRect)self.scrollView.frame 
error: unsupported expression with unknown type
error: unsupported expression with unknown type
error: C-style cast from 'unknown type' to 'CGRect' is not allowed
error: 3 errors parsing expression

Correct:
(lldb) expr -- (CGRect)[[self scrollView]frame]
(CGRect) $5 = origin=(x=0, y=0) size=(width=768, height=607)

You'll notice I don't bother with gdb aliases like p. Please accept my apologies.

No comments:

Post a Comment