-finstrument-functions and program startup
-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