• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: debugging on Intel macs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging on Intel macs


  • Subject: Re: debugging on Intel macs
  • From: Aurélien Hugelé <email@hidden>
  • Date: Sat, 08 Apr 2006 07:57:46 +0200

Thanks albert, trying to play with GDB and using your explanations, i've succeeded to get what i want!

just a last question, is it possible to create some gdb macros ?
for exemple instead of typing
gdb) po *(int *) ($esp + 8)
to get self
i would just have to type po SELF or something like that.
Of course i want the macros to be saved and usable in all my projects...

do not bother to read the doc for me if you do not know how to do this immediatly ;-)

Aurelien, happy to be *very* productive with its new Core Duo iMac...

On 7 avr. 06, at 10:28, Eric Albert wrote:

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
  • Follow-Ups:
    • Re: debugging on Intel macs
      • From: Chris Espinosa <email@hidden>
References: 
 >Re: debugging on Intel macs (From: Aurélien Hugelé <email@hidden>)
 >Re: debugging on Intel macs (From: Eric Albert <email@hidden>)
 >Re: debugging on Intel macs (From: Aurélien Hugelé <email@hidden>)
 >Re: debugging on Intel macs (From: Eric Albert <email@hidden>)

  • Prev by Date: Re: built app not unzippable
  • Next by Date: Re: debugging on Intel macs
  • Previous by thread: Re: debugging on Intel macs
  • Next by thread: Re: debugging on Intel macs
  • Index(es):
    • Date
    • Thread