Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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];

like image 895
eric Avatar asked Nov 29 '25 16:11

eric


1 Answers

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]
like image 76
rob mayoff Avatar answered Dec 02 '25 07:12

rob mayoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!