sreplay is a tool that performs system call replay of strace logs on UNIX-like operating systems. The project is written in assembly and C, and is free software licensed under the LGPL. It supports simple dynamically-linked application replay under i386 and ppc64 Linux at present.
sreplay can be thought of as a virtual application. It is a freestanding program that has just enough logic to get itself running and then parse and replay a trace of system calls. It understands the trace format produced by the standard strace utility. Note that it does not attempt to preserve any timing information or trap loads and stores; it just takes an strace log and executes the system calls recorded therein.
It is mostly useful for bringup of experimental operating systems. Since it is an entirely free-standing program (no libgcc or libc), the kernel can blast it into memory with the desired trace and leap at its entry point. In this way, a kernel designer can make sure his kernel properly supports the common code paths through a proprietary database management system (for example) by obtaining a trace thereof.
A freestanding program is one that does not rely on code provided by the compiler runtime library or the system C library. Operating system kernels, hypervisors and bootloaders are freestanding for obvious reasons, but sreplay is so because the code provided by libc makes system calls before handing control to main. Because our goal is to make sreplay execute only those system calls provided in a trace, it must be freestanding. For similar reasons, the trace is accepted as a literal command line argument, because opening a file would involve one or more system calls. The alternative is to embed the trace as a seperate ELF section in the sreplay binary, similar to Linux's zImage format, but we have chosen to pursue the simplicity of the argv approach for now.
In the following, we record and replay a simple dynamically-linked program:
$ strace /bin/echo 'Hello, world!' 2> hello.strace
$ sreplay --dry-run $(cat hello.strace)
$ sreplay $(cat hello.strace)
What's New in This Release:
· Support for the lstat64, readlink, gettimeofday, and stat system calls.