Code coverage in C
It would be very helpful if you update your question to describe the platforms and compilers you are using.
The strategy I have used is to run the system on an emulator that can track all instructions. This trace can then be used to develop code coverage.
On UNIX, you can also start a process using ptrace () one step in the application and thereby capture the executable instructions.
If you just want to keep track of function calls, you can do some nasty hacking of the procedure linkage table to jump into some specialized registration code, but that is probably going crazy.
Again, you need more details about the runtime and level of detail to get a useful answer.
source to share
Do you have so much platform-specific code that you want to measure the unit test coverage on each platform? What I mean is that unless you have very much platform-specific code, your unit testing coverage should be the same across all of your goals, so you might not need to measure it against every goal you have. It might be interesting to port your platform-specific code to platform-specific modules so that the coverage of the common code is not diminished by specific code.
Are you looking at branch coverage or feature coverage? If the latter you can just use gcc to encode your code so that each function will output its name or its address to a file and write a script to aggregate the results from all platforms.
Sorry for answering questions only ... HTH
source to share
A page on Code Coverage Tools says that something called GCT by Brian Marik implements code coverage by translating source to source, so you can transform your C code and then build it with your platform-specific compiler. I haven't tracked the details.
source to share