Target Testing: The BITCOV Workflow
BITCOV is a further specialized variant of HOTA. It is meant for very small targets where the HOTA arrangement can not be used, usually because of small memory size. To use BITCOV, the HOTA add-on has to be installed.
With BITCOV, a global, zero-initialized vector CTC_array[]
is used to
store counter data, link-visible to all instrumented files. In the initial BITCOV design
the CTC_array[]
is treated as a bit-array where each probe has a
dedicated bit offset. The instrumented code just sets bits to 1 in
CTC_array[]
representing the code location that was executed. Thus,
the coverage is reported as "executed"/"not executed" without actual counters.
In another mode called BYTECOV, the CTC_array[]
elements are bytes, and
each byte carries the 0/1 information. In most instruction sets, setting a byte to 1 can
be done with fewer instructions than setting an individual bit in memory. Expected
memory saving (BYTECOV versus BITCOV) in instructions is many times more than is lost in
the increased CTC_array[]
size. But BITCOV is the better choice if code
memory is not a problem, but data memory is extremely short.
The CTC_array[]
element modeling and usage is the following:
- The element can be one bit, one byte (unsigned char), or any natural integral type of the cross-compiler.
- In the elements the probes can maintain either the executed/ not executed information, or the information about the number of executions. The true execution counters may be practical only with element type unsigned int, assuming that it is a 32-bit value. Smaller integral types lead to counter overflow earlier. Bigger integral types are a waste of memory, because when the coverage data comes to host, only a 32-bit value of it survives.
When the test program has run some reasonable time, the CTC_array[] memory area has to be captured to host to a file MON.dmp. Normally the program is run under debugger and it can be used to do the memory area capture.
At the host MON.dmp is fed to dmp2txt utility, which converts the CTC_array[] binary data to HOTA toolchain’s MON.txt format. dmp2txt needs also MON.aux file. It was born when the code was instrumented in BITCOV-style, at the same time the symbol file MON.sym was created. MON.aux contains information of the instrumented files and how the CTC_array[] vector offsets map to the probes.
After that, the usage proceeds as in HOTA toolchain.