Re: debugging on Intel macs
Re: debugging on Intel macs
- Subject: Re: debugging on Intel macs
- From: Eric Albert <email@hidden>
- Date: Fri, 7 Apr 2006 01:28:05 -0700
On Apr 6, 2006, at 11:36 AM, Aurélien Hugelé wrote:
I'm really sorry to bother you with this, but i don't understand
anything...
(gdb) po *(int *) ($esp + 4)
sometimes display "self" (objC speaking), which is equivalent to $r3
on PPC
sometimes causes a KERN_PROTECTION_FAILURE
sometimes display "something" which is not self nor an argument.
Can you please describe the rule (i hope it is simple, but i fear that
it's a total mess) if there is one, I'm only interested in objC/Cocoa
debugging...
i want the self argument
the _cmd argument (current selector)
and the possible folowing arguments
Thanks a lot, i'm totally lost and unproductive with my new iMac :(
The expression I described above will give you self if you do a 'b
objc_msgSend'. That's because
a) objc_msgSend doesn't use a frame pointer, so ëp isn't set to
anything useful
and
b) %esp hasn't been changed yet at the point in objc_msgSend where 'b
objc_msgSend' sets its breakpoint.
The standard rule is as I described originally -- the first argument is
at ëp + 8, the second is at ëp + 12, etc. objc_msgSend is one of
the exceptions, where on the first instruction arguments are at %esp +
4, %esp + 8, etc.
There's obviously more to know, but this isn't really the right place
to describe the x86 calling convention. See
<http://developer.apple.com/documentation/DeveloperTools/Conceptual/
LowLevelABI/Articles/IA32.html> for details on that. Note that the
"saved frame pointer" described on that page is optional, which is
what's happening in the objc_msgSend case.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden