views:

42

answers:

2

Is there a way to determine the argument types of Objective-C methods traced by Instruments? I created a custom DTrace Instrument that just lists all Objective-C calls in a class. I am trying to swizzle one of the methods, but only the method name is listed.

Is there a way to determine the argument types? Or as an alternative, a way to swizzle the methods without knowing the argument types?

A: 

Use the debugger and set a breakpoint on the method you're interested in. If the arguments are object types, you can use print-object to find out what class they are. On x86, arguments are generally passed on the stack. On PPC, you'll find the arguments in register r3-r11.

codewarrior
+1  A: 

If you use classdump, then you can see C data types in the method definitions. This should be sufficient for swizzling. Once you have the routines swizzled, you can print a description of objective-C types using NSLog.

http://www.codethecode.com/projects/class-dump/

Ken Aspeslagh
tried class-dumping, and the only header file generated contained the method i was planning on swizzling, with the class type of the argument. thanks!
maranas