• 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: How to get the name of a method at runtime?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the name of a method at runtime?


  • Subject: Re: How to get the name of a method at runtime?
  • From: John Stiles <email@hidden>
  • Date: Mon, 10 Mar 2008 08:26:50 -0700

My experience with dladdr has been that it returns junk at least half of the time.
IIRC, Tiger was worse than Leopard, but neither is as accurate as NSTask'ing out to atos (which basically works perfectly, albeit slow as dirt).
I've got an open radar on it.


stephen joseph butler wrote:
On Sun, Mar 9, 2008 at 4:45 PM, Tony Becker <email@hidden> wrote:
If you're on Leopard, there is a new backtrace(3) call.
 If you're on Tiger, it's a little more complex...

You can use the compiler function
(long)__builtin_return_address(0)
to find the address of your caller. Alas, there is no
__builtin_return_symbol()

Interesting. The manpage for backtrace mentions dladdr, which is available on 10.4. Maybe you can use that instead of launching atos. Particularly, I'm looking at the dli_sname member. _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How to get the name of a method at runtime? (From: Stuart Malin <email@hidden>)
 >Re: How to get the name of a method at runtime? (From: "Sherm Pendley" <email@hidden>)
 >Re: How to get the name of a method at runtime? (From: Stuart Malin <email@hidden>)
 >Re: How to get the name of a method at runtime? (From: Tony Becker <email@hidden>)
 >Re: How to get the name of a method at runtime? (From: "stephen joseph butler" <email@hidden>)

  • Prev by Date: FSFindFolder vs NSSearchPathForDirectoriesInDomains
  • Next by Date: Re: results in attached view
  • Previous by thread: Re: How to get the name of a method at runtime?
  • Next by thread: Re: How to get the name of a method at runtime?
  • Index(es):
    • Date
    • Thread