aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_bsd.h
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@freebsd.org>2019-01-12 18:22:40 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-01-14 09:50:07 +0100
commit9eb9389ab9e0a65eae640bae6b879f60267cee0f (patch)
tree2fc7e2cba43bb0bd70fe6fe4dd5b3168514d894e /executor/executor_bsd.h
parent95f1d718cf5c336e13375fbeb28d3ef63d64ac97 (diff)
executor: update KCOV support for FreeBSD
KCOV support has been added to FreeBSD in r342962. Use the header file and update the code to latest changes introduced in the review process.
Diffstat (limited to 'executor/executor_bsd.h')
-rw-r--r--executor/executor_bsd.h21
1 files changed, 4 insertions, 17 deletions
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h
index 298f22d95..e0fce2c1e 100644
--- a/executor/executor_bsd.h
+++ b/executor/executor_bsd.h
@@ -40,18 +40,8 @@ static long execute_syscall(const call_t* c, long a[kMaxArgs])
#if GOOS_freebsd
-// TODO(mptre): once kcov is merged to FreeBSD[1], just include sys/kcov.h for
-// both FreeBSD and OpenBSD.
-//
-// [1] https://reviews.freebsd.org/D14599
-
-#define KIOENABLE _IOWINT('c', 2) // Enable coverage recording
-#define KIODISABLE _IO('c', 3) // Disable coverage recording
-#define KIOSETBUFSIZE _IOWINT('c', 4) // Set the buffer size
-
-#define KCOV_MODE_NONE -1
-#define KCOV_MODE_TRACE_PC 0
-#define KCOV_MODE_TRACE_CMP 1
+// KCOV support was added in https://svnweb.freebsd.org/changeset/base/342962
+#include <sys/kcov.h>
#elif GOOS_openbsd
@@ -74,8 +64,7 @@ static void cover_open(cover_t* cov)
close(fd);
#if GOOS_freebsd
- // On FreeBSD provide the size in bytes, not in number of entries.
- if (ioctl(cov->fd, KIOSETBUFSIZE, kCoverSize * sizeof(uint64_t)))
+ if (ioctl(cov->fd, KIOSETBUFSIZE, kCoverSize))
fail("ioctl init trace write failed");
#elif GOOS_openbsd
unsigned long cover_size = kCoverSize;
@@ -84,9 +73,7 @@ static void cover_open(cover_t* cov)
#endif
#if GOOS_freebsd
- // FreeBSD only supports kcov on 64-bit platforms and always uses
- // entries of type uint64_t.
- size_t mmap_alloc_size = kCoverSize * sizeof(uint64_t);
+ size_t mmap_alloc_size = kCoverSize * KCOV_ENTRY_SIZE;
#else
size_t mmap_alloc_size = kCoverSize * (is_kernel_64_bit ? 8 : 4);
#endif