RR Debug Replay

Table of Contents

1. RR Debug Replay

https://rr-project.org/

// 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 时获得的.

Author: [email protected]
Date: 2019-02-12 Tue 00:00
Last updated: 2022-02-06 Sun 21:58

知识共享许可协议