Open Source Automation Development Lab
You are here: Home / OSADL / News / 
2014-04-24 - 11:55

Next OSADL Events:

Breaking News:

2014-04-09 12:00

First LCA certificate issued

Major automation provider passed OSADL License Compliance Audit


2014-01-20 12:00

Good news from OIN

The Linux Defense Department


2013-11-06 12:00

SIL2LinuxMP ...

why Open Source/Open Proof is the right way to go for safety



2011-08-21 12:00 Age: 3 Years

How to determine code coverage of a running program on the fly?

By: Carsten Emde

A new HOWTO at the OSADL Website knows more

Is your code covered?

It is well known that the gcov utility can be used to dump coverage data at the end of a program run - given that the program was compiled and linked with the related options. Sometimes, however, such data must be generated on the fly while the program is running. This may be the case in servers and, more generally, in devices that start a primary application when the device is switched on and its main function never stops unless the device is switched off. Embedded systems may come to mind.

Coverage data are needed for debugging and general testing and - more importantly - for specific testing in the case of a safety-critical application. Optimization can even go that far and feed coverage data back to the compiler using the -fbranch-probabilities option to further improve a program's performance.

Okay, but how does it work to obtain coverage data while the program is running? Well, we need to explicitly do what the program implicitly does when it exits. OSADL's Safety Coordinator Der Herr Hofrat analyzed how this works, created a small program to exemplify his solution and was kind enough to share his insight by providing an OSADL HOWTO article on this topic which is now online and accessible through the OSADL HOWTOs page.

Thank you, Nicholas.