• 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: Insert Code Into Every Function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Insert Code Into Every Function (From: "Dave Keck" <email@hidden>)

  • Prev by Date: Re: CFBundleGetFunctionPointerForName
  • Next by Date: Re: project preferences in 3.1
  • Previous by thread: Re: Insert Code Into Every Function
  • Next by thread: Objective-C++ 2.0 - C++ valued properties
  • Index(es):
    • Date
    • Thread