Re: Insert Code Into Every Function
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.
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