Re: Insert Code Into Every Function
Re: Insert Code Into Every Function
- Subject: Re: Insert Code Into Every Function
- From: Marshall Clow <email@hidden>
- Date: Sat, 15 Mar 2008 10:09:16 -0700
At 1:48 AM -0500 3/15/08, Dave Keck wrote:
Hello,
I've got some simple assembly code that I'd like to insert into every
function of a C & Objective-C application at compile time. It's for my
own purposes of helping identify bugs, profiling, flow control, etc.
and it may develop into a larger public project. I've done extensive
research into projects that accomplish similar tasks (Gprof and other
projects) but none of them do what I need to, so I'm prepared to do it
myself.
A long time ago, in a compiler far, far away, I accomplished
this by turning on profiling, and then noticing that the compiler
inserted a call to __enterfunc at the start of each routine and
__exitfunc at the end of each routine. I wrote my own versions of
those functions, linked them into the executable, and I was done.
Will this work with the gcc that ships with Xcode? I have no
idea. But if I were you, I'd look into it before I started mucking
with my source code.
If that didn't work, I would look into writing a simple tool
that inserted those calls into object files after compilation and
before linking.
--
-- Marshall
Marshall Clow Idio Software <mailto:email@hidden>
It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.
_______________________________________________
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