mozilla/rr — pull request #77 by cgjones (2013-06-01 04:54:04+00:00)
Title: Refactor rep_process_syscall() to be more data-oriented, to simplify upcoming inversion of control flow.

This a semantics-preserving refactoring, but still a pretty large change. Probably a good idea to have someone take a look over it. The substantial changes are
* turn syscall-running macros into functions
* extract syscall definitions into client-neutral file, syscall_defs.h. Idea is to share this with the recorder in the near future.
* do some cpp magic and `#include "syscall_defs.h"` to define the syscall table, which says what to do with each syscall
* instead of a large switch statement for all syscalls in rep_process_syscall, we now handle the "regular" syscalls with a few lines of common helpers which call `enter_syscall_emu`/`exit_syscall_emu`, and same for `*_exec`)
* fall back on a switch statement for the oddball syscalls
* in hand-rolled syscall code, replace repeated patterns with calls to `enter_syscall_*`/`exit_syscall_*` where possible
* some of the hand-rolled syscall-processing code for complicated syscalls is factored out into helper functions, for legibility

And some "noise" along with the "signal"
* removal of dead/commented code that I didn't understand :)
* replace `fprintf(stderr); exit(1)` pattern with `fatal()`
* normalization of some style
* casts etc. to get number of warnings down to 0

All the tests pass, but I've almost certainly broken some stuff. Enjoy! :)