## Enable coverage
-Test coverage support can be turned on compiling Xen with the `CONFIG_GCOV`
+Test coverage support can be turned on compiling Xen with the `CONFIG_COVERAGE`
option set to `y`.
Change your `.config` or run `make -C xen menuconfig`.
# CONFIG_DEBUG is not set
# CONFIG_CRASH_DEBUG is not set
# CONFIG_FRAME_POINTER is not set
-# CONFIG_GCOV is not set
+# CONFIG_COVERAGE is not set
# CONFIG_LOCK_PROFILE is not set
# CONFIG_PERF_COUNTERS is not set
# CONFIG_VERBOSE_DEBUG is not set
maybe slower, but it gives very useful debugging information
in case of any Xen bugs.
-config GCOV
- bool "Gcov Support"
+config COVERAGE
+ bool "Code coverage support"
depends on !LIVEPATCH
select SUPPRESS_DUPLICATE_SYMBOL_WARNINGS
---help---
- Enable gcov (a test coverage program in GCC) support.
+ Enable code coverage support.
If unsure, say N here.
$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
-ifeq ($(CONFIG_GCOV),y)
-$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage
+ifeq ($(CONFIG_COVERAGE),y)
+ifeq ($(clang),y)
+ COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
+else
+ COV_FLAGS := -fprofile-arcs -ftest-coverage
+endif
+$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += $(COV_FLAGS)
endif
ifeq ($(CONFIG_UBSAN),y)
obj-y := stub.o
obj-$(efi) := boot.init.o compat.o relocs-dummy.o runtime.o
extra-$(efi) += buildid.o
-nogcov-$(efi) += stub.o
+nocov-$(efi) += stub.o
tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o
obj-$(CONFIG_TMEM) += $(tmem-y)
-subdir-$(CONFIG_GCOV) += coverage
+subdir-$(CONFIG_COVERAGE) += coverage
subdir-$(CONFIG_UBSAN) += ubsan
subdir-y += libelf
-obj-y += coverage.o gcov_base.o gcov.o
+obj-y += coverage.o
+ifneq ($(clang),y)
+obj-y += gcov_base.o gcov.o
obj-y += $(call cc-ifversion,lt,0x040700, \
gcc_3_4.o, $(call cc-ifversion,lt,0x040900, \
gcc_4_7.o, $(call cc-ifversion,lt,0x050000, \
gcc_4_9.o, $(call cc-ifversion,lt,0x070000, \
gcc_5.o, gcc_7.o))))
+endif
}
break;
-#ifdef CONFIG_GCOV
case XEN_SYSCTL_coverage_op:
ret = sysctl_cov_op(&op->u.coverage_op);
copyback = 1;
break;
-#endif
#ifdef CONFIG_HAS_PCI
case XEN_SYSCTL_pcitopoinfo:
#ifndef _XEN_COV_H
#define _XEN_COV_H
-#ifdef CONFIG_GCOV
+#ifdef CONFIG_COVERAGE
#include <public/sysctl.h>
int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
+#else
+static inline int sysctl_cov_op(void *unused)
+{
+ return -EOPNOTSUPP;
+}
#endif
#endif /* _XEN_GCOV_H */