views:

605

answers:

2

I'm trying to setup my Xcode project to be instrumented with gcov so I can determine the code coverage of my unit tests. All of the documentation I find online talks about settings that I don't find in Xcode 3.1, though. An example:

To work with Coverstory, first you need to set up your target to work with gcov. This requires turning on "Instrument Program Flow", "Generate Test Coverage Files" and linking with the gcov library. (Using Coverstory)

The closest thing I can find to "Instrument Program Flow" and "Generate Test Coverage Files" in my build settings is "Generate Profiling Code", which doesn't appear to do what I want it to do.

Am I looking in the wrong place for these settings or are all of the examples I'm finding online stale?

+4  A: 

Update: I've looked back at my notes when I first set this up - your "Base SDK" has to be the same as your current build target, otherwise the options you need won't appear:
http://iphonesdkdev.blogspot.com/2009/05/xcode-gcc-section-missing-in-build.html

FYI, my "Instrument Program Flow" and "Generate Test Coverage Files" options show up underneath heading "GCC 4.0 - Code Generation".

I remember similar problems with build settings being hidden - usually it is because of a dependency on another build setting, e.g. two from my project that I know matter are:
-C/C++ Compiler Version = GCC 4.0
-Base SDK = iPhone Simulator 2.1 (missing)

Dan J
A: 

You may also want to check out the Google Toolbox For Mac Xcode Plugin which adds menu items for easily setting up code coverage:

http://code.google.com/p/google-toolbox-for-mac/wiki/GTMXcodePlugin

dmaclach