From within xcode, gdb gives the following:
> po self
<SomeClassName: 0x6672e50>
So far so good... But:
> po super
No symbol "super" in current context.
In the interest of clarity, what I really want to do is send a message to super
while debugging. For example, I want to do something like this:
> po [super doSomething]
But how do I reference super
from within the gdb environment? Thanks!
Something to keep in mind here, is that super == self
. It's the same object pointer, but the super
keyword tells the message dispatch code to start looking for an implementation one level back in the class hierarchy.
Hey, we were just talking about this! The word super
doesn't have any effect except as the receiver of a message, i.e., [super doSomething]
. It's just a note to the compiler that it should search for the implementation of a method in the superclass rather than the current class object.
If you want an object's actual superclass object, use the NSObject
protocol's superclass
method: [self superclass]
.
I don't know how to do exactly what you want. How about a debugger hook? Put this into your class:
- (void) callSupersDoSomething {
[super doSomething];
}
and then you can call [self callSupersDoSomething]
from the debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With