Nerd Test

“The following gdb script will handle this:

#
# Trace objective-c messages. - nemo 2009
#
b dyld_stub_objc_msgSend
commands 
        set $id  = *(long *)($esp+4)
        set $sel = *(long *)($esp+8)
        if(*(long *)($id+8) != 0)
                printf "[%s %s]\n", *(long *)($id+8),$sel
                continue
        end
        set $isx = *(long *)($id)
        printf "[%s %s]\n", *(long *)($isx+8),$sel
        continue
end

We could also implement this with dtrace on Mac OS X quite easily.

#!/usr/sbin/dtrace -qs
/* usage: objcdump.d  */
pid$1::objc_msgSend:entry
{
    self->isa = *(long *)copyin(arg0,4);
    printf("-[%s %s]\n", 
        copyinstr(*(long *)copyin(self->isa + 8, 4)),
        copyinstr(arg1));
}

Let me correct myself on that, we /should/ be able to implement this with
dtrace on Mac OS X quite easily. However, dtrace is kind of like looking at
a beautiful painting through a kids kaleidescope toy.”
(nemo) [The Objective-C Runtime: Understanding and Abusing]

If you are only interested in the above text you are a halfling, if you just hit the link to RTFA, you are a nerd, if you think you could write the article, you are a script-kiddy, and if you go WFT, you are a n00b. But if you do read it, you might learn some new debugging techniques.