eric
eric

Reputation: 4951

How to send a message to an object in lldb console?

Say that I have the pointer to an object '0x20c28010'. How can I send this object a message in the debugger console (lldb)? As in: [0x20c28010 doSomething];

Upvotes: 2

Views: 1830

Answers (1)

rob mayoff
rob mayoff

Reputation: 385600

If the message doesn't return anything, or returns a pointer, an integer or a floating-point type that you don't care about, you can do this:

p (void)[0x20c28010 doSomething]

If you care about the return type, or the return type is a struct, you need to cast to the correct return type. Examples:

p (int)[0x20c28010 length]
p (float)[0x20c28010 scale]
p (CGPoint)[0x20c28010 origin]

If the message returns a pointer to an Objective-C object or Core Foundation type, you can use po to print the returned object's description:

po [0x20c28010 doSomething]

Upvotes: 9

Related Questions