RR Debug Replay
Table of Contents
1. RR Debug Replay
// 2019-02-12 17:42 #include <string.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> #include <time.h> void foo () { printf("hello foo\n"); printf("%d\n", time(0)); } int main(int argc, char *argv[]) { foo(); }
$> gcc test.c -O0 -g $> rr record ./a.out rr: Saving execution to trace directory `/home/sunway/.local/share/rr/a.out-2'. hello foo 1549968509 $> rr replay ~/.local/share/rr/a.out-2 (rr) b main (rr) c Continuing. Breakpoint 1, main (argc=1, argv=0x7ffe86272f88) at test.c:15 15 foo(); (rr) c Continuing. hello foo 1549968509 $> rr replay ~/.local/share/rr/a.out-2 (rr) c Continuing. hello foo 1549968509
rr 每次 replay 时, `执行` 的结果都是相同的, 因为它只是模拟 `执行` 的过程, 结果都是从 replay 时获得的.