• 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: Chris Espinosa <email@hidden>
  • Date: Sat, 15 Mar 2008 00:28:55 -0700

On Mar 14, 2008, at 11:48 PM, Dave Keck wrote:

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.


If what you're trying to do is to gather runtime statistics, you should look into DTrave.

http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/InstrumentsUserGuide/CreatingaCustomInstrument/chapter_8_section_1.html

Right now it looks as if I'm going to be taking a not-so-elegant
approach of using regular expressions to identify the functions in a
source file, and manually inserting the assembly code into the C &
Objective-C functions using an Xcode build phase prior to compilation.
Before I start on this time-consuming tangent, does anyone have any
suggestions as far as more elegant means of accomplishing such a task,
or any pointers for such a project?


If I do take this route, does anyone know if there's a way to harness
Xcode's ability to identify every function within a source file, as
they appear in the pull-down menu in the bar above the source file?

The only way I know of going about this is to create a Class Model of the project, then access that model through AppleScript.  You can get all the methods of every class, down to the line of code in which it's declared, that way.  But not straight C functions.  I don't think that the function popup's data is accessible via AppleScript.

Chris
 _______________________________________________
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: Insert Code Into Every Function
  • Next by Date: Re: Insert Code Into Every Function
  • Previous by thread: Re: Insert Code Into Every Function
  • Next by thread: Re: Insert Code Into Every Function
  • Index(es):
    • Date
    • Thread