Clark Cox wrote the best explanation of this I have ever seen. I link to this page all the time and made a local copy in case it ever disappears.
http://www.clarkcox.com/blog/2009/02/04/inspecting-obj-c-parameters-in-gdb/
Fast version for x86_64 and non-floating-point options:
first ObjC arg => $rdx second ObjC arg => $rcx third ObjC arg => $r8 fourth ObjC arg => $r9
Remember that the first two things passed to the method (in $ rdi and $ rsi) are self and _cmd . I do not consider them here.
If you pass floating points, structures, or more than four arguments, things get complicated and you should read the calling conventions in the AMD64 ABI 3.2.3 section. If you are dealing with i386, PPC or ARM, see Clark's post, which describes these cases well for general cases.
Rob napier
source share