Updated set of patches for coverage. Changes: - remove small outdated note on commit text - add signature where missing - rebased Frediano Ziglio (5): gcov: Call constructors during initialization gcov: Adding support for coverage information gcov: Implement code to read coverage informations gcov: Add small utility to deal with test coverage information from Xen gcov: Add documentation for coverage .gitignore | 3 + .hgignore | 3 + Config.mk | 3 + docs/misc/coverage.markdown | 39 ++++++++ tools/misc/Makefile | 8 +- tools/misc/xencov.c | 152 +++++++++++++++++++++++++++++ xen/Rules.mk | 2 + xen/arch/arm/setup.c | 2 + xen/arch/arm/xen.lds.S | 7 ++ xen/arch/x86/setup.c | 2 + xen/arch/x86/xen.lds.S | 7 ++ xen/common/Makefile | 2 + xen/common/gcov/Makefile | 2 + xen/common/gcov/gcov.c | 225 +++++++++++++++++++++++++++++++++++++++++++ xen/common/lib.c | 14 +++ xen/common/sysctl.c | 6 ++ xen/include/public/gcov.h | 115 ++++++++++++++++++++++ xen/include/public/sysctl.h | 38 ++++++++ xen/include/xen/gcov.h | 93 ++++++++++++++++++ xen/include/xen/lib.h | 2 + 20 files changed, 723 insertions(+), 2 deletions(-) create mode 100644 docs/misc/coverage.markdown create mode 100644 tools/misc/xencov.c create mode 100644 xen/common/gcov/Makefile create mode 100644 xen/common/gcov/gcov.c create mode 100644 xen/include/public/gcov.h create mode 100644 xen/include/xen/gcov.h -- 1.7.9.5
Frediano Ziglio
2013-Feb-21 16:13 UTC
[PATCH v10 1/5] gcov: Call constructors during initialization
This allow modules to set initializer functions. This is used by Gcc instrumentation code for profiling arcs and test coverage. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> --- xen/arch/arm/setup.c | 2 ++ xen/arch/arm/xen.lds.S | 7 +++++++ xen/arch/x86/setup.c | 2 ++ xen/arch/x86/xen.lds.S | 7 +++++++ xen/common/lib.c | 14 ++++++++++++++ xen/include/xen/lib.h | 2 ++ 6 files changed, 34 insertions(+) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 5a86f90..a21ae41 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -442,6 +442,8 @@ void __init start_xen(unsigned long boot_phys_offset, scrub_heap_pages(); */ + init_constructors(); + console_endboot(); /* Hide UART from DOM0 if we''re using it */ diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 410d7db..50e0c4b 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -84,6 +84,13 @@ SECTIONS *(.init.data) *(.init.data.rel) *(.init.data.rel.*) + + . = ALIGN(4); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; } :text . = ALIGN(32); .init.setup : { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 83335ad..a13b681 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1378,6 +1378,8 @@ void __init __start_xen(unsigned long mbi_p) init_trace_bufs(); + init_constructors(); + console_endboot(); /* Hide UART from DOM0 if we''re using it */ diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d324afd..5570389 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -108,6 +108,13 @@ SECTIONS __trampoline_seg_start = .; *(.trampoline_seg) __trampoline_seg_stop = .; + + . = ALIGN(8); + __CTOR_LIST__ = .; + QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) + *(.ctors) + QUAD(0) + __CTOR_END__ = .; } :text . = ALIGN(32); .init.setup : { diff --git a/xen/common/lib.c b/xen/common/lib.c index 03c8b8b..1344038 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -2,6 +2,7 @@ #include <xen/ctype.h> #include <xen/lib.h> #include <xen/types.h> +#include <xen/init.h> #include <asm/byteorder.h> /* for ctype.h */ @@ -478,6 +479,19 @@ unsigned long long parse_size_and_unit(const char *s, const char **ps) return ret; } +extern const struct +{ + unsigned long count; + void (*funcs[1])(void); +} __CTOR_LIST__; + +void __init init_constructors(void) +{ + unsigned long n; + for ( n = 0; n < __CTOR_LIST__.count; ++n ) + __CTOR_LIST__.funcs[n](); +} + /* * Local variables: * mode: C diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 31e1117..74b34eb 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -127,4 +127,6 @@ extern void add_taint(unsigned); struct cpu_user_regs; void dump_execstate(struct cpu_user_regs *); +void init_constructors(void); + #endif /* __LIB_H__ */ -- 1.7.9.5
Frediano Ziglio
2013-Feb-21 16:13 UTC
[PATCH v10 2/5] gcov: Adding support for coverage information
This patch introduce coverage support to Xen. Currently it allows to compile Xen with coverage support but there is no way to extract them. The declarations came from Linux source files (as you can see from file headers). The idea is to have some operations mainly - get coverage information size - read coverage information - reset coverage counters Linux use a file system to export these information. The information will be a blob to handle with some tools (as usually tools require a bunch of files but Xen does not handle files at all). I''ll pack them to make things simpler as possible. These information cannot be put in a specific section (allowing a safe mapping) as gcc use .rodata, .data, .text and .ctors sections. I added code to handle constructors used in this case to initialize a linked list of files. I used a "coverage" configuration option to mimic the "debug" one. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> --- .gitignore | 2 ++ .hgignore | 2 ++ Config.mk | 3 ++ xen/Rules.mk | 2 ++ xen/common/Makefile | 2 ++ xen/common/gcov/Makefile | 2 ++ xen/common/gcov/gcov.c | 72 +++++++++++++++++++++++++++++++++++++++ xen/include/xen/gcov.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 169 insertions(+) create mode 100644 xen/common/gcov/Makefile create mode 100644 xen/common/gcov/gcov.c create mode 100644 xen/include/xen/gcov.h diff --git a/.gitignore b/.gitignore index 125a582..96a7a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ *.tmp *.spot *.spit +*.gcno +*.gcda TAGS GTAGS GRTAGS diff --git a/.hgignore b/.hgignore index 74fd424..a4466d2 100644 --- a/.hgignore +++ b/.hgignore @@ -17,6 +17,8 @@ .*\.rej$ .*\.spot$ .*\.spit$ +.*\.gcno$ +.*\.gcda$ .*/a\.out$ .*/Modules\.symvers$ .*/cscope\..*$ diff --git a/Config.mk b/Config.mk index 21274eb..281fc2b 100644 --- a/Config.mk +++ b/Config.mk @@ -13,6 +13,9 @@ realpath = $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) && echo " debug ?= y debug_symbols ?= $(debug) +# Test coverage support +coverage ?= n + XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \ -e s/i86pc/x86_32/ -e s/amd64/x86_64/ \ -e s/armv7.*/arm32/) diff --git a/xen/Rules.mk b/xen/Rules.mk index c2db449..3f0b262 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -103,6 +103,8 @@ subdir-all := $(subdir-y) $(subdir-n) $(filter %.init.o,$(obj-y) $(obj-bin-y)): CFLAGS += -DINIT_SECTIONS_ONLY +$(obj-$(coverage)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE + ifeq ($(lto),y) # Would like to handle all object files as bitcode, but objects made from # pure asm are in a different format and have to be collected separately. diff --git a/xen/common/Makefile b/xen/common/Makefile index 1677342..8a0c506 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -59,5 +59,7 @@ subdir-$(CONFIG_COMPAT) += compat subdir-$(x86_64) += hvm +subdir-$(coverage) += gcov + subdir-y += libelf subdir-$(HAS_DEVICE_TREE) += libfdt diff --git a/xen/common/gcov/Makefile b/xen/common/gcov/Makefile new file mode 100644 index 0000000..c9efe6c --- /dev/null +++ b/xen/common/gcov/Makefile @@ -0,0 +1,2 @@ +obj-y += gcov.o + diff --git a/xen/common/gcov/gcov.c b/xen/common/gcov/gcov.c new file mode 100644 index 0000000..4de4b58 --- /dev/null +++ b/xen/common/gcov/gcov.c @@ -0,0 +1,72 @@ +/* + * This code maintains a list of active profiling data structures. + * + * Copyright IBM Corp. 2009 + * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com> + * + * Uses gcc-internal data definitions. + * Based on the gcov-kernel patch by: + * Hubertus Franke <frankeh@us.ibm.com> + * Nigel Hinds <nhinds@us.ibm.com> + * Rajan Ravindran <rajancr@us.ibm.com> + * Peter Oberparleiter <oberpar@linux.vnet.ibm.com> + * Paul Larson + */ + +#include <xen/config.h> +#include <xen/init.h> +#include <xen/lib.h> +#include <xen/hypercall.h> +#include <xen/gcov.h> +#include <xen/errno.h> + +static struct gcov_info *info_list; + +/* + * __gcov_init is called by gcc-generated constructor code for each object + * file compiled with -fprofile-arcs. + * + * Although this function is called only during initialization is called from + * a .text section which is still present after initialization so not declare + * as __init. + */ +void __gcov_init(struct gcov_info *info) +{ + /* add new profiling data structure to list */ + info->next = info_list; + info_list = info; +} + +/* + * These functions may be referenced by gcc-generated profiling code but serve + * no function for Xen. + */ +void __gcov_flush(void) +{ + /* Unused. */ +} + +void __gcov_merge_add(gcov_type *counters, unsigned int n_counters) +{ + /* Unused. */ +} + +void __gcov_merge_single(gcov_type *counters, unsigned int n_counters) +{ + /* Unused. */ +} + +void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters) +{ + /* Unused. */ +} + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/xen/gcov.h b/xen/include/xen/gcov.h new file mode 100644 index 0000000..d695919 --- /dev/null +++ b/xen/include/xen/gcov.h @@ -0,0 +1,84 @@ +/* + * Profiling infrastructure declarations. + * + * This file is based on gcc-internal definitions. Data structures are + * defined to be compatible with gcc counterparts. For a better + * understanding, refer to gcc source: gcc/gcov-io.h. + * + * Copyright IBM Corp. 2009 + * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com> + * + * Uses gcc-internal data definitions. + */ + +#ifndef __XEN_GCOV_H__ +#define __XEN_GCOV_H__ __XEN_GCOV_H__ + +/* + * Profiling data types used for gcc 3.4 and above - these are defined by + * gcc and need to be kept as close to the original definition as possible to + * remain compatible. + */ + +typedef uint64_t gcov_type; + +/** + * struct gcov_fn_info - profiling meta data per function + * @ident: object file-unique function identifier + * @checksum: function checksum + * @n_ctrs: number of values per counter type belonging to this function + * + * This data is generated by gcc during compilation and doesn''t change + * at run-time. + */ +struct gcov_fn_info +{ + unsigned int ident; + unsigned int checksum; + unsigned int n_ctrs[0]; +}; + +/** + * struct gcov_ctr_info - profiling data per counter type + * @num: number of counter values for this type + * @values: array of counter values for this type + * @merge: merge function for counter values of this type (unused) + * + * This data is generated by gcc during compilation and doesn''t change + * at run-time with the exception of the values array. + */ +struct gcov_ctr_info +{ + unsigned int num; + gcov_type *values; + void (*merge)(gcov_type *, unsigned int); +}; + +/** + * struct gcov_info - profiling data per object file + * @version: gcov version magic indicating the gcc version used for compilation + * @next: list head for a singly-linked list + * @stamp: time stamp + * @filename: name of the associated gcov data file + * @n_functions: number of instrumented functions + * @functions: function data + * @ctr_mask: mask specifying which counter types are active + * @counts: counter data per counter type + * + * This data is generated by gcc during compilation and doesn''t change + * at run-time with the exception of the next pointer. + */ +struct gcov_info +{ + unsigned int version; + struct gcov_info *next; + unsigned int stamp; + const char *filename; + unsigned int n_functions; + const struct gcov_fn_info *functions; + unsigned int ctr_mask; + struct gcov_ctr_info counts[0]; +}; + + +#endif /* __XEN_GCOV_H__ */ -- 1.7.9.5
Frediano Ziglio
2013-Feb-21 16:13 UTC
[PATCH v10 3/5] gcov: Implement code to read coverage informations
Operations are handled by a sysctl specific operation. Implement 4 operations - check if coverage is compiled in - read size of coverage information - read coverage information - reset coverage counters Information are stored in a single blob in a format specific to Xen designed to make code that generate coverage as small as possible. This patch add a public header with the structure of blob exported by Xen. This avoid problems distributing header which is GPL2. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> --- xen/common/gcov/gcov.c | 153 +++++++++++++++++++++++++++++++++++++++++++ xen/common/sysctl.c | 6 ++ xen/include/public/gcov.h | 115 ++++++++++++++++++++++++++++++++ xen/include/public/sysctl.h | 38 +++++++++++ xen/include/xen/gcov.h | 9 +++ 5 files changed, 321 insertions(+) create mode 100644 xen/include/public/gcov.h diff --git a/xen/common/gcov/gcov.c b/xen/common/gcov/gcov.c index 4de4b58..01d5b10 100644 --- a/xen/common/gcov/gcov.c +++ b/xen/common/gcov/gcov.c @@ -19,6 +19,9 @@ #include <xen/hypercall.h> #include <xen/gcov.h> #include <xen/errno.h> +#include <xen/guest_access.h> +#include <public/xen.h> +#include <public/gcov.h> static struct gcov_info *info_list; @@ -61,6 +64,156 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters) /* Unused. */ } +static inline int counter_active(const struct gcov_info *info, unsigned int type) +{ + return (1 << type) & info->ctr_mask; +} + +typedef struct write_iter_t +{ + XEN_GUEST_HANDLE(uint8) ptr; + int real; + uint32_t write_offset; +} write_iter_t; + +static int write_raw(struct write_iter_t *iter, const void *data, + size_t data_len) +{ + if ( iter->real && + copy_to_guest_offset(iter->ptr, iter->write_offset, + (const unsigned char *) data, data_len) ) + return -EFAULT; + + iter->write_offset += data_len; + return 0; +} + +#define chk(v) do { ret=(v); if ( ret ) return ret; } while(0) + +static inline int write32(write_iter_t *iter, uint32_t val) +{ + return write_raw(iter, &val, sizeof(val)); +} + +static int write_string(write_iter_t *iter, const char *s) +{ + int ret; + size_t len = strlen(s); + + chk(write32(iter, len)); + return write_raw(iter, s, len); +} + +static inline int next_type(const struct gcov_info *info, int *type) +{ + while ( ++*type < XENCOV_COUNTERS && !counter_active(info, *type) ) + continue; + return *type; +} + +static inline void align_iter(write_iter_t *iter) +{ + iter->write_offset + (iter->write_offset + sizeof(uint64_t) - 1) & -sizeof(uint64_t); +} + +static int write_gcov(write_iter_t *iter) +{ + struct gcov_info *info; + int ret; + + /* reset offset */ + iter->write_offset = 0; + + /* dump all files */ + for ( info = info_list ; info; info = info->next ) + { + const struct gcov_ctr_info *ctr; + int type; + size_t size_fn = sizeof(struct gcov_fn_info); + + align_iter(iter); + chk(write32(iter, XENCOV_TAG_FILE)); + chk(write32(iter, info->version)); + chk(write32(iter, info->stamp)); + chk(write_string(iter, info->filename)); + + /* dump counters */ + ctr = info->counts; + for ( type = -1; next_type(info, &type) < XENCOV_COUNTERS; ++ctr ) + { + align_iter(iter); + chk(write32(iter, XENCOV_TAG_COUNTER(type))); + chk(write32(iter, ctr->num)); + chk(write_raw(iter, ctr->values, + ctr->num * sizeof(ctr->values[0]))); + + size_fn += sizeof(unsigned); + } + + /* dump all functions together */ + align_iter(iter); + chk(write32(iter, XENCOV_TAG_FUNC)); + chk(write32(iter, info->n_functions)); + chk(write_raw(iter, info->functions, info->n_functions * size_fn)); + } + + /* stop tag */ + align_iter(iter); + chk(write32(iter, XENCOV_TAG_END)); + return 0; +} + +static int reset_counters(void) +{ + struct gcov_info *info; + + for ( info = info_list ; info; info = info->next ) + { + const struct gcov_ctr_info *ctr; + int type; + + /* reset counters */ + ctr = info->counts; + for ( type = -1; next_type(info, &type) < XENCOV_COUNTERS; ++ctr ) + memset(ctr->values, 0, ctr->num * sizeof(ctr->values[0])); + } + + return 0; +} + +int sysctl_coverage_op(xen_sysctl_coverage_op_t *op) +{ + int ret = -EINVAL; + write_iter_t iter; + + switch ( op->cmd ) + { + case XEN_SYSCTL_COVERAGE_get_total_size: + iter.real = 0; + + write_gcov(&iter); + op->u.total_size = iter.write_offset; + ret = 0; + break; + + case XEN_SYSCTL_COVERAGE_read_and_reset: + case XEN_SYSCTL_COVERAGE_read: + iter.ptr = op->u.raw_info; + iter.real = 1; + + ret = write_gcov(&iter); + if ( ret || op->cmd != XEN_SYSCTL_COVERAGE_read_and_reset ) + break; + + /* fall through */ + case XEN_SYSCTL_COVERAGE_reset: + ret = reset_counters(); + break; + } + return ret; +} + /* * Local variables: * mode: C diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 20bb864..182cb23 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -26,6 +26,7 @@ #include <xen/nodemask.h> #include <xsm/xsm.h> #include <xen/pmstat.h> +#include <xen/gcov.h> long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) { @@ -357,6 +358,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) } break; +#ifdef TEST_COVERAGE + case XEN_SYSCTL_coverage_op: + ret = sysctl_coverage_op(&op->u.coverage_op); + break; +#endif default: ret = arch_do_sysctl(op, u_sysctl); diff --git a/xen/include/public/gcov.h b/xen/include/public/gcov.h new file mode 100644 index 0000000..1b29b48 --- /dev/null +++ b/xen/include/public/gcov.h @@ -0,0 +1,115 @@ +/****************************************************************************** + * gcov.h + * + * Coverage structures exported by Xen. + * Structure is different from Gcc one. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright (c) 2013, Citrix Systems R&D Ltd. + */ + +#ifndef __XEN_PUBLIC_GCOV_H__ +#define __XEN_PUBLIC_GCOV_H__ __XEN_PUBLIC_GCOV_H__ + +#define XENCOV_COUNTERS 5 +#define XENCOV_TAG_BASE 0x58544300u +#define XENCOV_TAG_FILE (XENCOV_TAG_BASE+0x46u) +#define XENCOV_TAG_FUNC (XENCOV_TAG_BASE+0x66u) +#define XENCOV_TAG_COUNTER(n) (XENCOV_TAG_BASE+0x30u+((n)&0xfu)) +#define XENCOV_TAG_END (XENCOV_TAG_BASE+0x2eu) +#define XENCOV_IS_TAG_COUNTER(n) \ + ((n) >= XENCOV_TAG_COUNTER(0) && (n) < XENCOV_TAG_COUNTER(XENCOV_COUNTERS)) +#define XENCOV_COUNTER_NUM(n) ((n)-XENCOV_TAG_COUNTER(0)) + +/* + * The main structure for the blob is + * BLOB := FILE.. END + * FILE := TAG_FILE VERSION STAMP FILENAME COUNTERS FUNCTIONS + * FILENAME := LEN characters + * characters are padded to 32 bit + * LEN := 32 bit value + * COUNTERS := TAG_COUNTER(n) NUM COUNTER.. + * NUM := 32 bit valie + * COUNTER := 64 bit value + * FUNCTIONS := TAG_FUNC NUM FUNCTION.. + * FUNCTION := IDENT CHECKSUM NUM_COUNTERS + * + * All tagged structures are aligned to 8 bytes + */ + +/** + * File information + * Prefixed with XENCOV_TAG_FILE and a string with filename + * Aligned to 8 bytes + */ +struct xencov_file +{ + uint32_t tag; /* XENCOV_TAG_FILE */ + uint32_t version; + uint32_t stamp; + uint32_t fn_len; + char filename[1]; +}; + + +/** + * Counters information + * Prefixed with XENCOV_TAG_COUNTER(n) where n is 0..(XENCOV_COUNTERS-1) + * Aligned to 8 bytes + */ +struct xencov_counter +{ + uint32_t tag; /* XENCOV_TAG_COUNTER(n) */ + uint32_t num; + uint64_t values[1]; +}; + +/** + * Information for each function + * Number of counter is equal to the number of counter structures got before + */ +struct xencov_function +{ + uint32_t ident; + uint32_t checksum; + uint32_t num_counters[1]; +}; + +/** + * Information for all functions + * Aligned to 8 bytes + */ +struct xencov_functions +{ + uint32_t tag; /* XENCOV_TAG_FUNC */ + uint32_t num; + struct xencov_function xencov_function[1]; +}; + +/** + * Terminator + */ +struct xencov_end +{ + uint32_t tag; /* XENCOV_TAG_END */ +}; + +#endif /* __XEN_PUBLIC_GCOV_H__ */ + diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 3225b2a..84baae4 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -596,6 +596,42 @@ struct xen_sysctl_scheduler_op { typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t); +/* XEN_SYSCTL_coverage_op */ +/* + * Get total size of information, to help allocate + * the buffer. The pointer points to a 32 bit value. + */ +#define XEN_SYSCTL_COVERAGE_get_total_size 0 + +/* + * Read coverage information in a single run + * You must use a tool to split them. + */ +#define XEN_SYSCTL_COVERAGE_read 1 + +/* + * Reset all the coverage counters to 0 + * No parameters. + */ +#define XEN_SYSCTL_COVERAGE_reset 2 + +/* + * Like XEN_SYSCTL_COVERAGE_read but reset also + * counters to 0 in a single call. + */ +#define XEN_SYSCTL_COVERAGE_read_and_reset 3 + +struct xen_sysctl_coverage_op { + uint32_t cmd; /* XEN_SYSCTL_COVERAGE_* */ + union { + uint32_t total_size; /* OUT */ + XEN_GUEST_HANDLE_64(uint8) raw_info; /* OUT */ + } u; +}; +typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t); + + struct xen_sysctl { uint32_t cmd; #define XEN_SYSCTL_readconsole 1 @@ -616,6 +652,7 @@ struct xen_sysctl { #define XEN_SYSCTL_numainfo 17 #define XEN_SYSCTL_cpupool_op 18 #define XEN_SYSCTL_scheduler_op 19 +#define XEN_SYSCTL_coverage_op 20 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ union { struct xen_sysctl_readconsole readconsole; @@ -636,6 +673,7 @@ struct xen_sysctl { struct xen_sysctl_lockprof_op lockprof_op; struct xen_sysctl_cpupool_op cpupool_op; struct xen_sysctl_scheduler_op scheduler_op; + struct xen_sysctl_coverage_op coverage_op; uint8_t pad[128]; } u; }; diff --git a/xen/include/xen/gcov.h b/xen/include/xen/gcov.h index d695919..27c5c37 100644 --- a/xen/include/xen/gcov.h +++ b/xen/include/xen/gcov.h @@ -14,6 +14,8 @@ #ifndef __XEN_GCOV_H__ #define __XEN_GCOV_H__ __XEN_GCOV_H__ +#include <public/sysctl.h> + /* * Profiling data types used for gcc 3.4 and above - these are defined by * gcc and need to be kept as close to the original definition as possible to @@ -81,4 +83,11 @@ struct gcov_info }; +/** + * Sysctl operations for coverage + */ +#ifdef TEST_COVERAGE +int sysctl_coverage_op(xen_sysctl_coverage_op_t *op); +#endif + #endif /* __XEN_GCOV_H__ */ -- 1.7.9.5
Frediano Ziglio
2013-Feb-21 16:13 UTC
[PATCH v10 4/5] gcov: Add small utility to deal with test coverage information from Xen
Currently the utility can read and reset coverage informations. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> --- .gitignore | 1 + .hgignore | 1 + tools/misc/Makefile | 8 ++- tools/misc/xencov.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xencov.c diff --git a/.gitignore b/.gitignore index 96a7a5d..71786ca 100644 --- a/.gitignore +++ b/.gitignore @@ -229,6 +229,7 @@ tools/misc/gtraceview tools/misc/gtracestat tools/misc/xenlockprof tools/misc/lowmemd +tools/misc/xencov tools/pygrub/build/* tools/python/build/* tools/python/xen/util/path.py diff --git a/.hgignore b/.hgignore index a4466d2..6b432f7 100644 --- a/.hgignore +++ b/.hgignore @@ -224,6 +224,7 @@ ^tools/misc/gtraceview$ ^tools/misc/gtracestat$ ^tools/misc/xenlockprof$ +^tools/misc/xencov$ ^tools/pygrub/build/.*$ ^tools/python/build/.*$ ^tools/python/xen/util/path\.py$ diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 22e60fd..eef9411 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -9,7 +9,7 @@ CFLAGS += $(CFLAGS_libxenstore) HDRS = $(wildcard *.h) -TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd +TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y) @@ -22,7 +22,8 @@ INSTALL_BIN-y := xencons INSTALL_BIN-$(CONFIG_X86) += xen-detect INSTALL_BIN := $(INSTALL_BIN-y) -INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xen-ringwatch +INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview \ + gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y) @@ -85,4 +86,7 @@ xen-lowmemd: xen-lowmemd.o gtraceview: gtraceview.o $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS) +xencov: xencov.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + -include $(DEPS) diff --git a/tools/misc/xencov.c b/tools/misc/xencov.c new file mode 100644 index 0000000..6645a30 --- /dev/null +++ b/tools/misc/xencov.c @@ -0,0 +1,152 @@ +/* + * xencov: handle test coverage information from Xen. + * + * Copyright (c) 2013, Citrix Systems R&D Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include <xenctrl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <err.h> +#include <sys/mman.h> + +static xc_interface *gcov_xch = NULL; + +static void gcov_init(void) +{ + gcov_xch = xc_interface_open(NULL, NULL, 0); + if ( !gcov_xch ) + err(1, "opening interface"); +} + +int gcov_get_info(int op, struct xen_sysctl *sys, void *ptr) +{ + struct xen_sysctl_coverage_op *cov; + + memset(sys, 0, sizeof(*sys)); + sys->cmd = XEN_SYSCTL_coverage_op; + + cov = &sys->u.coverage_op; + cov->cmd = op; + cov->u.raw_info.p = ptr; + + return xc_sysctl(gcov_xch, sys); +} + +static void gcov_read(const char *fn, int reset) +{ + struct xen_sysctl sys; + unsigned page_size = sysconf(_SC_PAGESIZE); + uint32_t total_len; + uint8_t *p; + size_t size; + FILE *f; + int op = reset ? XEN_SYSCTL_COVERAGE_read_and_reset : + XEN_SYSCTL_COVERAGE_read; + + /* get total length */ + if ( gcov_get_info(XEN_SYSCTL_COVERAGE_get_total_size, &sys, NULL) < 0 ) + err(1, "getting total length"); + total_len = sys.u.coverage_op.u.total_size; + fprintf(stderr, "returned %u bytes\n", (unsigned) total_len); + + /* safe check */ + if ( total_len > 16u * 1024u * 1024u ) + errx(1, "coverage size too big %u bytes\n", total_len); + + /* allocate */ + size = total_len + page_size; + size -= (size % page_size); + p = mmap(0, size, PROT_WRITE|PROT_READ, + MAP_PRIVATE|MAP_ANON|MAP_LOCKED, -1, 0); + if ( p == (uint8_t *) -1 ) + err(1, "mapping memory for coverage"); + + /* get data */ + memset(p, 0, total_len); + if ( gcov_get_info(op, &sys, p) < 0 ) + err(1, "getting coverage information"); + + /* write to a file */ + if ( strcmp(fn, "-") == 0 ) + f = stdout; + else + f = fopen(fn, "w"); + if ( !f ) + err(1, "opening output file"); + if ( fwrite(p, 1, total_len, f) != total_len ) + err(1, "writing coverage to file"); + if (f != stdout) + fclose(f); +} + +static void gcov_reset(void) +{ + struct xen_sysctl sys; + + if ( gcov_get_info(XEN_SYSCTL_COVERAGE_reset, &sys, NULL) < 0 ) + err(1, "resetting coverage information"); +} + +static void usage(int exit_code) +{ + FILE *out = exit_code ? stderr : stdout; + + fprintf(out, "xencov {reset|read|read-reset} [<filename>]\n" + "\treset reset information\n" + "\tread read information from xen to filename\n" + "\tread-reset read and reset information from xen to filename\n" + "\tfilename optional filename (default output)\n" + ); + exit(exit_code); +} + +int main(int argc, char **argv) +{ + int opt; + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case ''h'': + usage(0); + break; + default: + usage(1); + } + } + + argv += optind; + argc -= optind; + if (argc <= 0) + usage(1); + + gcov_init(); + + if ( strcmp(argv[0], "reset") == 0 ) + gcov_reset(); + else if ( strcmp(argv[0], "read") == 0 ) + gcov_read(argc > 1 ? argv[1] : "-", 0); + else if ( strcmp(argv[0], "read-reset") == 0 ) + gcov_read(argc > 1 ? argv[1] : "-", 1); + else + usage(1); + + return 0; +} + -- 1.7.9.5
Frediano Ziglio
2013-Feb-21 16:13 UTC
[PATCH v10 5/5] gcov: Add documentation for coverage
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> --- docs/misc/coverage.markdown | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 docs/misc/coverage.markdown diff --git a/docs/misc/coverage.markdown b/docs/misc/coverage.markdown new file mode 100644 index 0000000..74af665 --- /dev/null +++ b/docs/misc/coverage.markdown @@ -0,0 +1,39 @@ +# Coverage support for Xen + +Coverare support allow you to get coverage information from Xen execution. +You can see how many times a line is executed. + +The compiler have specific options that enable the collection of these +information. Every basic block in the code will be instructed by the compiler +to compute these statistics. It should not be used in production as it slow +down your hypervisor. + +## Enable coverage + +Test coverage support can be turned on compiling Xen with coverage option set +to y. + +Something like: + cd xen + make coverage=y + +(or change your `Config.mk` file). + +## Extract coverage data + +The way GCC and other tools deal with coverage information is to use some files +created during build phase (.gcno) and some files produced by executing the +*program* (.gcda). The program in this case is Xen but Xen cannot write files +so the way you can use coverage from Xen is extract coverage data from Xen and +then split these information into files. + +To extract data you use a simple utility called `xencov`. Mainly `xencore` +allow you to do 3 operations: + +* `xencov read` extract data +* `xencov reset` reset all coverage counters +* `xencov read-reset` extract data and reset counters at the same time. + +Another utility (**TODO**) is used to split extracted data file into files +needed by userspace tools. + -- 1.7.9.5
Ian Campbell
2013-Feb-22 08:50 UTC
Re: [PATCH v10 1/5] gcov: Call constructors during initialization
On Thu, 2013-02-21 at 16:13 +0000, Frediano Ziglio wrote:> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > index 410d7db..50e0c4b 100644 > --- a/xen/arch/arm/xen.lds.S > +++ b/xen/arch/arm/xen.lds.S > @@ -84,6 +84,13 @@ SECTIONS > *(.init.data) > *(.init.data.rel) > *(.init.data.rel.*) > + > + . = ALIGN(4); > + __CTOR_LIST__ = .; > + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) > + *(.ctors) > + LONG(0) > + __CTOR_END__ = .; > } :text > . = ALIGN(32); > .init.setup : {This broke my 64-bit branch (not your fault, it''s not merged yet, but I was planning to commit it shortly): prelink.o: In function `init_constructors'': /local/scratch/ianc/devel/arm/xen.git/xen/common/lib.c:491:(.init.text+0xc44): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `__CTOR_LIST__'' defined in .init.data section in /local/scratch/ianc/devel/arm/xen.git/xen/.xen-arm64-syms.0 To fixup I intend to add the following to my "xen: arm64: initial build + config changes, start of day code". Xen doesn''t have a xen/xen.lds.h header, but perhaps adding that and using it to define common things like this as macros might be an interesting future cleanup. 8<-------------------------------------- diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 9043994..5136b79 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -91,9 +91,9 @@ SECTIONS *(.init.data.rel) *(.init.data.rel.*) - . = ALIGN(4); + . = ALIGN(BYTES_PER_LONG); __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + LONG((__CTOR_END__ - __CTOR_LIST__) / BYTES_PER_LONG - 2) *(.ctors) LONG(0) __CTOR_END__ = .;
Frediano Ziglio
2013-Feb-22 09:40 UTC
Re: [PATCH v10 1/5] gcov: Call constructors during initialization
On Fri, 2013-02-22 at 08:50 +0000, Ian Campbell wrote:> On Thu, 2013-02-21 at 16:13 +0000, Frediano Ziglio wrote: > > diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > > index 410d7db..50e0c4b 100644 > > --- a/xen/arch/arm/xen.lds.S > > +++ b/xen/arch/arm/xen.lds.S > > @@ -84,6 +84,13 @@ SECTIONS > > *(.init.data) > > *(.init.data.rel) > > *(.init.data.rel.*) > > + > > + . = ALIGN(4); > > + __CTOR_LIST__ = .; > > + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) > > + *(.ctors) > > + LONG(0) > > + __CTOR_END__ = .; > > } :text > > . = ALIGN(32); > > .init.setup : { > > > This broke my 64-bit branch (not your fault, it''s not merged yet, but I > was planning to commit it shortly): > prelink.o: In function `init_constructors'': > /local/scratch/ianc/devel/arm/xen.git/xen/common/lib.c:491:(.init.text+0xc44): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `__CTOR_LIST__'' defined in .init.data section in /local/scratch/ianc/devel/arm/xen.git/xen/.xen-arm64-syms.0 > > To fixup I intend to add the following to my "xen: arm64: initial build > + config changes, start of day code". > > Xen doesn''t have a xen/xen.lds.h header, but perhaps adding that and > using it to define common things like this as macros might be an > interesting future cleanup. > > 8<-------------------------------------- > > diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > index 9043994..5136b79 100644 > --- a/xen/arch/arm/xen.lds.S > +++ b/xen/arch/arm/xen.lds.S > @@ -91,9 +91,9 @@ SECTIONS > *(.init.data.rel) > *(.init.data.rel.*) > > - . = ALIGN(4); > + . = ALIGN(BYTES_PER_LONG); > __CTOR_LIST__ = .; > - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) > + LONG((__CTOR_END__ - __CTOR_LIST__) / BYTES_PER_LONG - 2) > *(.ctors) > LONG(0) > __CTOR_END__ = .; > > > >Hi, this does not work, LONG is always 32 bit but if you use pointers should be QUAD. Or I can change structure to be just a range of pointers addressed by start and end, so in ld script . = ALIGN(8); __CTOR_LIST__ = .; *(.ctors) __CTOR_END__ = .; In code: typedef void (*ctor_func_t)(void); extern const ctor_func_t __CTOR_LIST__[1], __CTOR_END__[1]; void __init init_constructors(void) { const ctor_func_t pf = __CTOR_LIST__; for ( ; pf < __CTOR_END__; ++pf ) pf(); } This will work for both 32 and 64 bit. At this point I would rename __CTOR_LIST__ with a more "Xen" name. Frediano
Ian Campbell
2013-Feb-22 09:45 UTC
Re: [PATCH v10 1/5] gcov: Call constructors during initialization
On Fri, 2013-02-22 at 09:40 +0000, Frediano Ziglio wrote:> On Fri, 2013-02-22 at 08:50 +0000, Ian Campbell wrote: > > On Thu, 2013-02-21 at 16:13 +0000, Frediano Ziglio wrote: > > > diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > > > index 410d7db..50e0c4b 100644 > > > --- a/xen/arch/arm/xen.lds.S > > > +++ b/xen/arch/arm/xen.lds.S > > > @@ -84,6 +84,13 @@ SECTIONS > > > *(.init.data) > > > *(.init.data.rel) > > > *(.init.data.rel.*) > > > + > > > + . = ALIGN(4); > > > + __CTOR_LIST__ = .; > > > + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) > > > + *(.ctors) > > > + LONG(0) > > > + __CTOR_END__ = .; > > > } :text > > > . = ALIGN(32); > > > .init.setup : { > > > > > > This broke my 64-bit branch (not your fault, it''s not merged yet, but I > > was planning to commit it shortly): > > prelink.o: In function `init_constructors'': > > /local/scratch/ianc/devel/arm/xen.git/xen/common/lib.c:491:(.init.text+0xc44): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `__CTOR_LIST__'' defined in .init.data section in /local/scratch/ianc/devel/arm/xen.git/xen/.xen-arm64-syms.0 > > > > To fixup I intend to add the following to my "xen: arm64: initial build > > + config changes, start of day code". > > > > Xen doesn''t have a xen/xen.lds.h header, but perhaps adding that and > > using it to define common things like this as macros might be an > > interesting future cleanup. > > > > 8<-------------------------------------- > > > > diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > > index 9043994..5136b79 100644 > > --- a/xen/arch/arm/xen.lds.S > > +++ b/xen/arch/arm/xen.lds.S > > @@ -91,9 +91,9 @@ SECTIONS > > *(.init.data.rel) > > *(.init.data.rel.*) > > > > - . = ALIGN(4); > > + . = ALIGN(BYTES_PER_LONG); > > __CTOR_LIST__ = .; > > - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) > > + LONG((__CTOR_END__ - __CTOR_LIST__) / BYTES_PER_LONG - 2) > > *(.ctors) > > LONG(0) > > __CTOR_END__ = .; > > > > > > > > > > Hi, > this does not work, LONG is always 32 bitYes, I''m just discovering that ;-)> but if you use pointers should be QUAD. Or I can change structure to be just a range of pointers > addressed by start and end, so in ld script > > . = ALIGN(8); > __CTOR_LIST__ = .; > *(.ctors) > __CTOR_END__ = .; > > In code: > > typedef void (*ctor_func_t)(void); > extern const ctor_func_t __CTOR_LIST__[1], __CTOR_END__[1]; > > void __init init_constructors(void) > { > const ctor_func_t pf = __CTOR_LIST__; > for ( ; pf < __CTOR_END__; ++pf ) > pf(); > } > > This will work for both 32 and 64 bit. At this point I would rename __CTOR_LIST__ with a more "Xen" name.Let me play with something along these lines. I''ll send out a patch. Ian.
Whose ACKs do you need for this to be checked in? -George On 21/02/13 16:13, Frediano Ziglio wrote:> Updated set of patches for coverage. > > Changes: > - remove small outdated note on commit text > - add signature where missing > - rebased > > Frediano Ziglio (5): > gcov: Call constructors during initialization > gcov: Adding support for coverage information > gcov: Implement code to read coverage informations > gcov: Add small utility to deal with test coverage information from > Xen > gcov: Add documentation for coverage > > .gitignore | 3 + > .hgignore | 3 + > Config.mk | 3 + > docs/misc/coverage.markdown | 39 ++++++++ > tools/misc/Makefile | 8 +- > tools/misc/xencov.c | 152 +++++++++++++++++++++++++++++ > xen/Rules.mk | 2 + > xen/arch/arm/setup.c | 2 + > xen/arch/arm/xen.lds.S | 7 ++ > xen/arch/x86/setup.c | 2 + > xen/arch/x86/xen.lds.S | 7 ++ > xen/common/Makefile | 2 + > xen/common/gcov/Makefile | 2 + > xen/common/gcov/gcov.c | 225 +++++++++++++++++++++++++++++++++++++++++++ > xen/common/lib.c | 14 +++ > xen/common/sysctl.c | 6 ++ > xen/include/public/gcov.h | 115 ++++++++++++++++++++++ > xen/include/public/sysctl.h | 38 ++++++++ > xen/include/xen/gcov.h | 93 ++++++++++++++++++ > xen/include/xen/lib.h | 2 + > 20 files changed, 723 insertions(+), 2 deletions(-) > create mode 100644 docs/misc/coverage.markdown > create mode 100644 tools/misc/xencov.c > create mode 100644 xen/common/gcov/Makefile > create mode 100644 xen/common/gcov/gcov.c > create mode 100644 xen/include/public/gcov.h > create mode 100644 xen/include/xen/gcov.h >
On Fri, 2013-02-22 at 14:20 +0000, George Dunlap wrote:> Whose ACKs do you need for this to be checked in?It''s in now. Ian.
I don''t know. Frediano On Fri, 2013-02-22 at 14:20 +0000, George Dunlap wrote:> Whose ACKs do you need for this to be checked in? > > -George > > On 21/02/13 16:13, Frediano Ziglio wrote: > > Updated set of patches for coverage. > > > > Changes: > > - remove small outdated note on commit text > > - add signature where missing > > - rebased > > > > Frediano Ziglio (5): > > gcov: Call constructors during initialization > > gcov: Adding support for coverage information > > gcov: Implement code to read coverage informations > > gcov: Add small utility to deal with test coverage information from > > Xen > > gcov: Add documentation for coverage > > > > .gitignore | 3 + > > .hgignore | 3 + > > Config.mk | 3 + > > docs/misc/coverage.markdown | 39 ++++++++ > > tools/misc/Makefile | 8 +- > > tools/misc/xencov.c | 152 +++++++++++++++++++++++++++++ > > xen/Rules.mk | 2 + > > xen/arch/arm/setup.c | 2 + > > xen/arch/arm/xen.lds.S | 7 ++ > > xen/arch/x86/setup.c | 2 + > > xen/arch/x86/xen.lds.S | 7 ++ > > xen/common/Makefile | 2 + > > xen/common/gcov/Makefile | 2 + > > xen/common/gcov/gcov.c | 225 +++++++++++++++++++++++++++++++++++++++++++ > > xen/common/lib.c | 14 +++ > > xen/common/sysctl.c | 6 ++ > > xen/include/public/gcov.h | 115 ++++++++++++++++++++++ > > xen/include/public/sysctl.h | 38 ++++++++ > > xen/include/xen/gcov.h | 93 ++++++++++++++++++ > > xen/include/xen/lib.h | 2 + > > 20 files changed, 723 insertions(+), 2 deletions(-) > > create mode 100644 docs/misc/coverage.markdown > > create mode 100644 tools/misc/xencov.c > > create mode 100644 xen/common/gcov/Makefile > > create mode 100644 xen/common/gcov/gcov.c > > create mode 100644 xen/include/public/gcov.h > > create mode 100644 xen/include/xen/gcov.h > > >