Code Coverage Tool Reference Manual

Usage Scenario
HP Code Coverage Tool Reference Manual for HP Integrity NonStop NS-Series Servers542684-004
8-3
Build the Application
Build the Application
The application in this example is called elfdump. It is a program that dumps
information about object files on a NonStop server.
1. This display shows the build directory for the elfdump application. The application
requires three source files (which have names ending in C) and four header files
(which have names ending in H). The application will be built and executed in the
Guardian environment.
2. These command lines invoke the compiler and linker with options related to code
coverage. The codecov option causes the compiler to create an instrumented
object file. The generated SPI file will have the name PGOSPI. The -lpgo option
is required to link instrumented object files.
3. This display shows the build directory after the build. Notice the new instrumented
object files (which have names ending in O), the SPI file PGOSPI, and the lock file
PGOSPL
$DATA05.TEST 2> files
$DATA05.TEST
ELFCOMH ELFDUMPC NSKELFH PLATDEPC PLATDEPH YOSELFC
YOSELFH
cppcomp /in elfdumpc, out elfdumpl/ elfdumpo; codecov
cppcomp /in platdepc, out platdepl/ platdepo; codecov
cppcomp /in yoselfc, out yoselfl/ yoselfo; codecov
eld /out linkout/ $system.system.ccplmain elfdumpo platdepo
yoselfo -lcrtl -lcre -lpgo -o elfdump
Note. The lock file PGOSPL is created by the compiler to ensure that concurrent compilations
do not attempt to read or write to the SPI file at the same time; access to the SPI file must be
synchronized.
$DATA05.TEST
ELFCOMH ELFDUMP ELFDUMPC ELFDUMPL ELFDUMPO LINKOUT
NSKELFH PGOSPI PGOSPL PLATDEPC PLATDEPH PLATDEPL
PLATDEPO YOSELFC YOSELFH YOSELFL YOSELFO