• 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: Application entry point
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Application entry point


  • Subject: Re: Application entry point
  • From: Aron-Zvi <email@hidden>
  • Date: Mon, 13 Jul 2009 08:50:57 +0300

Thanks for the quick reply Greg.

How do I scan the load commands?

On Mon, Jul 13, 2009 at 8:16 AM, Greg Parker <email@hidden> wrote:
On Jul 12, 2009, at 8:58 PM, Aron-Zvi wrote:
I'd like to know if it's possible to retrieve an application's entry point programatically on OS X.

More specifically, I'd like to retrieve the thread state in the LC_UNIXTHREAD load command  and extract eip's value.

I've found  getsectdatafromheader() which requires a mach header.  I've only found _dyld_get_image_header to get the mach header, however, I found nothing that retrieves a regular executable's (not a loaded shared library...) mach header.

_dyld_get_image_header() should provide the executable's header itself in addition to all dylibs and bundles.

If your code is compiled as part of the executable, you can use _mh_execute_header from mach-o/ldsyms.h. But that won't work if your code is part of a library or bundle.

Note that the functions in mach-o/getsect.h will only look up LC_SEGMENT contents. You probably need to scan the load commands manually to find LC_UNIXTHREAD.


--
Greg Parker     email@hidden     Runtime Wrangler



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Application entry point
      • From: Greg Parker <email@hidden>
References: 
 >Application entry point (From: Aron-Zvi <email@hidden>)
 >Re: Application entry point (From: Greg Parker <email@hidden>)

  • Prev by Date: Re: Application entry point
  • Next by Date: kernel settings for networkings
  • Previous by thread: Re: Application entry point
  • Next by thread: Re: Application entry point
  • Index(es):
    • Date
    • Thread