aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/executor_linux.h')
-rw-r--r--executor/executor_linux.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h
index f2e9d4df6..e952e6ea9 100644
--- a/executor/executor_linux.h
+++ b/executor/executor_linux.h
@@ -13,6 +13,12 @@
static bool pkeys_enabled;
+// The coverage buffer can realistically overflow. In the non-snapshot mode we cannot afford
+// very large buffer b/c there are usually multiple procs, and each of them consumes
+// significant amount of memory. In snapshot mode we have only one proc, so we can have
+// larger coverage buffer.
+const int kSnapshotCoverSize = 1024 << 10;
+
const unsigned long KCOV_TRACE_PC = 0;
const unsigned long KCOV_TRACE_CMP = 1;
@@ -101,7 +107,8 @@ static void cover_open(cover_t* cov, bool extra)
failmsg("filed to dup cover fd", "from=%d, to=%d", fd, cov->fd);
close(fd);
const int kcov_init_trace = is_kernel_64_bit ? KCOV_INIT_TRACE64 : KCOV_INIT_TRACE32;
- const int cover_size = extra ? kExtraCoverSize : kCoverSize;
+ const int cover_size = extra ? kExtraCoverSize : flag_snapshot ? kSnapshotCoverSize
+ : kCoverSize;
if (ioctl(cov->fd, kcov_init_trace, cover_size))
fail("cover init trace write failed");
cov->mmap_alloc_size = cover_size * (is_kernel_64_bit ? 8 : 4);