citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 1ed8bba8d142e8ac8382d346c0be4f8f3334f59f
parent 8ab1ffcd45d13cab4915d752a2d10c9c65944c2e
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu,  4 Aug 2016 20:14:00 -0600

use CITRUN_COVERAGE to turn on coverage build features

Diffstat:
MJamrules | 8++++++++
Mbin/gcov.sh | 5++++-
Msrc/Jamfile | 4+++-
Msrc/inst_main.cc | 4++++
4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Jamrules b/Jamrules @@ -38,6 +38,14 @@ if $(OS) = LINUX { LINKLIBS on citrun-inst = -lstdc++ -lbsd ; } +if $(CITRUN_COVERAGE) { + LIBEGCOV = /usr/local/lib/gcc/x86_64-unknown-openbsd6.0/4.9.3/libgcov.a ; + LINKLIBS on citrun-gl += $(LIBEGCOV) ; + LINKLIBS on citrun-inst += $(LIBEGCOV) ; + LINKLIBS on citrun-term += $(LIBEGCOV) ; + LinkLibraries libcitrun : /usr/lib/gcc-lib/amd64-unknown-openbsd6.0/4.2.1/libgcov.a ; +} + actions Test { prove ; } diff --git a/bin/gcov.sh b/bin/gcov.sh @@ -1,6 +1,9 @@ #!/bin/sh -e -export COVERAGE=1 +export CITRUN_COVERAGE=1 CFLAGS="-coverage -O0 -ggdb" jam -j4 + +prove + gcov -o lib lib/runtime.c egcov -r src/*.cc diff --git a/src/Jamfile b/src/Jamfile @@ -59,7 +59,9 @@ INST_SRCS = Stringize runtime_h.h : $(TOP)/lib/runtime.h ; ObjectC++Flags $(INST_SRCS) : `llvm-config --cxxflags` ; -ObjectC++Flags $(INST_SRCS) : -DCITRUN_LIB=$(CITRUN_LIB) -DCITRUN_PATH=$(CITRUN_PATH) ; +ObjectC++Flags $(INST_SRCS) : -DCITRUN_LIB=$(CITRUN_LIB) + -DCITRUN_PATH=$(CITRUN_PATH) + -DCITRUN_COVERAGE=$(CITRUN_COVERAGE) ; LINKFLAGS on citrun-inst = `llvm-config --ldflags` ; diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -247,6 +247,10 @@ CitrunInst::process_cmdline() m_args.push_back(const_cast<char *>("-pthread")); m_log << m_args.back() << " "; #endif +#ifdef CITRUN_COVERAGE + // Needed because libcitrun.a will be instrumented with gcov. + m_args.push_back(const_cast<char *>("-coverage")); +#endif m_args.push_back(const_cast<char *>(STR(CITRUN_LIB))); m_log << m_args.back() << "' to command line.\n"; }