diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-10-18 16:39:32 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-10-18 16:49:25 +0200 |
| commit | 296be8cc8dc8595f4d4504e3dd27f586785e0024 (patch) | |
| tree | b8ac1602d0a07d72a408237b40d76dcf7dbda469 /executor | |
| parent | 5776783af1f0851f4fd7f401ef4509c54aa9d54f (diff) | |
pkg/ipc: move fallback coverage into executor
It seems to explode linux corpus.
So make it freebsd-specific.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/executor.h | 1 | ||||
| -rw-r--r-- | executor/executor_freebsd.cc | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/executor/executor.h b/executor/executor.h index f3f0eb53a..e4bafc21e 100644 --- a/executor/executor.h +++ b/executor/executor.h @@ -93,6 +93,7 @@ struct thread_t { uint64_t* cover_data; // Pointer to the size of coverage (stored as first word of memory). uint64_t* cover_size_ptr; + uint64_t cover_buffer[1]; // fallback coverage buffer event_t ready; event_t done; diff --git a/executor/executor_freebsd.cc b/executor/executor_freebsd.cc index a009da4cb..b0d5acdec 100644 --- a/executor/executor_freebsd.cc +++ b/executor/executor_freebsd.cc @@ -65,6 +65,7 @@ int main(int argc, char** argv) setup_control_pipes(); receive_handshake(); reply_handshake(); + cover_open(); for (;;) { receive_execute(false); @@ -124,6 +125,12 @@ long execute_syscall(call_t* c, long a0, long a1, long a2, long a3, long a4, lon void cover_open() { + if (!flag_cover) + return; + for (int i = 0; i < kMaxThreads; i++) { + thread_t* th = &threads[i]; + th->cover_data = &th->cover_buffer[0]; + } } void cover_enable(thread_t* th) @@ -136,7 +143,13 @@ void cover_reset(thread_t* th) uint64_t read_cover_size(thread_t* th) { - return 0; + if (!flag_cover) + return 0; + // Fallback coverage since we have no real coverage available. + // We use syscall number or-ed with returned errno value as signal. + // At least this gives us all combinations of syscall+errno. + th->cover_data[0] = (th->call_num << 16) | ((th->res == -1 ? th->reserrno : 0) & 0x3ff); + return 1; } uint32_t* write_output(uint32_t v) |
