You are here: Home / OSADL / News / 
2024-07-22 - 03:43

Dates and Events:

OSADL Articles:

2023-11-12 12:00

Open Source License Obligations Checklists even better now

Import the checklists to other tools, create context diffs and merged lists

2023-03-01 12:00

Embedded Linux distributions

Results of the online "wish list"

2022-01-13 12:00

Phase #3 of OSADL project on OPC UA PubSub over TSN successfully completed

Another important milestone on the way to interoperable Open Source real-time Ethernet has been reached

2021-02-09 12:00

Open Source OPC UA PubSub over TSN project phase #3 launched

Letter of Intent with call for participation is now available

2011-08-21 12:00 Age: 13 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.