• 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
-finstrument-functions and program startup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-finstrument-functions and program startup


  • Subject: -finstrument-functions and program startup
  • From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
  • Date: Wed, 28 Jan 2009 13:33:32 -0500
  • Thread-topic: -finstrument-functions and program startup

First off, I know this question is going to the wrong list, but I have NO idea which list would be best.  If anyone wants to jump in and tell me a better list, I'll gladly move there.

Background:
I have an application that is working very, very hard to drive me insane.  It is multithreaded, lazy, and has my broken attempt at trampoline code.  Now, it crashes once in a while, but I'm not sure what the trail of broken bits are that causes the crash.  If only I had a way of instrumenting every single entry and exit of each function, I could log it all… which is exactly what -finstrument-functions does.  For those of you that don't know about it, when you compile your code using -finstrument-functions, just after the entry point of each instrumented function the function __cyg_profile_func_enter() will be called, and __cyg_profile_func_exit() will be called just before function exit.  You define those functions as you wish.

The tricky part is that there are certain functions that must not be instrumented like that, so you need to set the attribute no_instrument_function on those functions.  In my case, I want to run some startup code before either of those methods ever get called.  I put my code into main(), but, IIRC, there is some function that gets called before main() does.  If that is a library function, I'm OK since __cyg*() won't get compiled into anything I don't have the source for, but if gcc is generating some code that calls __cyg*() before I get the chance to do the setup, I'm going to have another crash.  So, is there anything called before main()?  What about just before main() returns?

Thanks,
Cem Karan
_______________________________________________

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

  • Follow-Ups:
    • Re: -finstrument-functions and program startup
      • From: Greg Parker <email@hidden>
  • Prev by Date: Re: Multiple NSTabViewItems that can't fit in a Single NSTabView
  • Next by Date: Drag and drop from NSCollectionView
  • Previous by thread: Re: getting WindowRef for focus window in other applications
  • Next by thread: Re: -finstrument-functions and program startup
  • Index(es):
    • Date
    • Thread