mozilla/rr — pull request #1360 by froydnj (2014-10-24 20:53:07+00:00)
Title: X86-64 syscall buffering part 1

This series enables syscall buffering for a small set of syscalls on x86-64. It includes the fixes submitted in #1358 and #1359.

It's not quite ready for committing yet; there are a small handful of debugger-related test failures with messages like:

```
[FATAL](/home/froydnj/src/rr/src/preload/preload.c:928: errno: Function not implemented: tid 24641) Record is for 228 but trying to commit 96
```

Those syscalls are `clock_gettime` and `gettimeofday`, so there's clearly something wrong with the monkeypatching for the vdso symbols, but I'm unclear as to what.

Tests go *significantly* faster with this series; even just buffering the vdso syscalls cuts the test time by 2/3rds.

Monkeypatching the syscalls that are cancellation points is significantly trickier, since we're actually moving around libc's code, with several PC-relative references to be adjusted. I'll try to look at that next week. I'm not really sure how to take care of calls like `{,f,l}stat`; I have an idea how to do it, but it'd be pretty complex (it essentially requires moving the entire libc function, including `errno` setting and pthread cancellation, into a `librrpreload` trampoline).

Feedback appreciated.