Re: Understanding the inner workings: getting to know how functions are called
Re: Understanding the inner workings: getting to know how functions are called
- Subject: Re: Understanding the inner workings: getting to know how functions are called
- From: Mattias Arrelid <email@hidden>
- Date: Wed, 23 Jan 2008 10:43:21 +0100
On 22 jan 2008, at 17.33, Bill Bumgarner wrote:
On Jan 22, 2008, at 8:05 AM, Mattias Arrelid wrote:
Hi everyone,
Sometimes when I subclass an existing Cocoa class, I wonder how its
methods are called; when in time, from what other function
(possible from another instance of another class) etc.
The "idiot" way of implementing this could of course be to add
_all_ method names of the class in question and then just call
[super methodName] in each method, and then use some debug macro
before and after that call that prints the name of the method in
question. That really isn't that productive and seems like a waste
of time.
Dtrace is likely a good place to start. For invocation order, you
can use the method resolving features in Leopard to build something
like what you want.
I wrote some articles on tracing method invocations sent to Nil.
Shouldn't be hard to modify to do what you describe.
http://www.friday.com/bbum/category/science/technology/objective-c/
Thanks Bill,
I just modified your custom Instrument to have a dtrace script like:
* - objc : NSScroller : *
Works like a charm. Thanks a lot, you just made my day (and made me
want to explore dtrace/Instruments even more!).
Regards
Mattias
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden