]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: LoongArch: Add basic process record/replay support
authorHui Li <lihui@loongson.cn>
Mon, 25 Nov 2024 07:40:03 +0000 (15:40 +0800)
committerTiezhu Yang <yangtiezhu@loongson.cn>
Mon, 25 Nov 2024 11:15:02 +0000 (19:15 +0800)
commit886ebc2b1f226d1ca06a3f0192cd1663c46428b0
tree0585acc88adca47e983c52a81c4f9e980d53e384
parent19b5accc3f85734e381d381d38f028c3379fa3a3
gdb: LoongArch: Add basic process record/replay support

GDB provides a special process record and replay target that can
record a log of the process execution, and replay it later with
both forward and reverse execution commands. This patch adds the
basic support of process record and replay on LoongArch, it allows
users to debug basic LoongArch instructions and provides reverse
debugging support.

Here is a simple example on LoongArch:

$ cat test.c
int a = 0;
int main()
  {
    a = 1;
    a = 2;
    return 0;
  }
$ gdb test
...
(gdb) start
...
Temporary breakpoint 1, main () at test.c:4
4     a = 1;
(gdb) record
(gdb) p a
$1 = 0
(gdb) n
5     a = 2;
(gdb) n
6     return 0;
(gdb) p a
$2 = 2
(gdb) rn
5     a = 2;
(gdb) rn

Reached end of recorded history; stopping.
Backward execution from here not possible.
main () at test.c:4
4     a = 1;
(gdb) p a
$3 = 0
(gdb) record stop
Process record is stopped and all execution logs are deleted.
(gdb) c
Continuing.
[Inferior 1 (process 129178) exited normally]

Signed-off-by: Hui Li <lihui@loongson.cn>
Approved-By: Guinevere Larsen <guinevere@redhat.com> (record-full)
Approved-By: Tom Tromey <tom@tromey.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
gdb/configure.tgt
gdb/loongarch-linux-tdep.c
gdb/loongarch-tdep.c
gdb/loongarch-tdep.h
gdb/testsuite/lib/gdb.exp