You can call PureCoverage functions directly from your program or from your debugger.
Use #include <purecov.h> to include the file purecov.h in your C or C++ programs.
The header file is located in the PureCoverage home directory. Add the compiler option -I<purecovhome> in your makefile, if necessary.
If you add calls to the PureCoverage functions to your code, you can add the library <purecovhome>/purecov_stub.a to your link line. This is a small library that stubs out all the API functions. When you are not using PureCoverage, these stubs satisfy the linker; when you are using PureCoverage, these stubs are ignored.
PFLAGS
= -force-merge
PDIR = `purecov -print-home-dir`
PURECOV = purecov $(PFLAGS)
PSTUBS = $(PDIR)/purecov_stubs.a
#
General flags
CC = cc
CFLAGS = -g -I$(PDIR)
#
Targets
all: a.out a.out.pure
a.out:
hello_world.c
$(CC) $(CFLAGS) -o $@ $? $(PSTUBS)
a.out.pure:
hello_world.c
$(PURECOV) $(CC) $(CFLAGS) -o $@ $? $(PSTUBS)
You can use the PureCoverage API functions by setting breakpoints in the debugger running your instrumented program and then calling the appropriate function when the breakpoint is reached.
(gdb)
call purecov_clear_data()
(dbx) print purecov_clear_data()