aboutsummaryrefslogtreecommitdiff
path: root/gdb/loongarch-linux-tdep.c
diff options
context:
space:
mode:
authorHui Li <lihui@loongson.cn>2024-11-25 15:40:03 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2024-11-25 19:15:02 +0800
commit886ebc2b1f226d1ca06a3f0192cd1663c46428b0 (patch)
tree0585acc88adca47e983c52a81c4f9e980d53e384 /gdb/loongarch-linux-tdep.c
parent19b5accc3f85734e381d381d38f028c3379fa3a3 (diff)
downloadbinutils-886ebc2b1f226d1ca06a3f0192cd1663c46428b0.zip
binutils-886ebc2b1f226d1ca06a3f0192cd1663c46428b0.tar.gz
binutils-886ebc2b1f226d1ca06a3f0192cd1663c46428b0.tar.bz2
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>
Diffstat (limited to 'gdb/loongarch-linux-tdep.c')
-rw-r--r--gdb/loongarch-linux-tdep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index 7157806..86e7ed8 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -602,6 +602,9 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Get the syscall number from the arch's register. */
set_gdbarch_get_syscall_number (gdbarch, loongarch_linux_get_syscall_number);
+
+ /* Reversible debugging, process record. */
+ set_gdbarch_process_record (gdbarch, loongarch_process_record);
}
/* Initialize LoongArch Linux target support. */