From b80d067ff0a7d2fcca3f8c01abf4b7201e71b8f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20Ko=C5=9Bcielnicki?= Date: Fri, 30 Oct 2015 15:51:59 +0000 Subject: [PATCH] gdb/linux-record: Support time, waitpid, pipe syscalls gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_linux_init_abi): Add size_time_t. * amd64-linux-tdep.c (amd64_linux_init_abi): Add size_time_t. (amd64_x32_linux_init_abi): Add size_time_t. * arm-linux-tdep.c (arm_linux_init_abi): Add size_time_t. * i386-linux-tdep.c (i386_linux_init_abi): Add size_time_t. * linux-record.c (record_linux_system_call): Add time, waitpid, pipe handling. * linux-record.h (struct linux_record_tdep): Add size_time_t. * ppc-linux-tdep.c (ppc_init_linux_record_tdep): Add size_time_t. --- gdb/ChangeLog | 12 ++++++++++++ gdb/aarch64-linux-tdep.c | 1 + gdb/amd64-linux-tdep.c | 2 ++ gdb/arm-linux-tdep.c | 1 + gdb/i386-linux-tdep.c | 1 + gdb/linux-record.c | 23 +++++++++++++++++++++++ gdb/linux-record.h | 1 + gdb/ppc-linux-tdep.c | 2 ++ 8 files changed, 43 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dacfcca16a0..413e12c6c4a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2015-10-30 Marcin Kościelnicki + + * aarch64-linux-tdep.c (aarch64_linux_init_abi): Add size_time_t. + * amd64-linux-tdep.c (amd64_linux_init_abi): Add size_time_t. + (amd64_x32_linux_init_abi): Add size_time_t. + * arm-linux-tdep.c (arm_linux_init_abi): Add size_time_t. + * i386-linux-tdep.c (i386_linux_init_abi): Add size_time_t. + * linux-record.c (record_linux_system_call): Add time, waitpid, pipe + handling. + * linux-record.h (struct linux_record_tdep): Add size_time_t. + * ppc-linux-tdep.c (ppc_init_linux_record_tdep): Add size_time_t. + 2015-10-30 Marcin Kościelnicki * linux-record.c (record_linux_msghdr): Fix msg_namelen handling. diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 0a3fbb3aa36..a1dcd5b19db 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -1062,6 +1062,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) aarch64_linux_record_tdep.size_hayes_esp_config = 12; aarch64_linux_record_tdep.size_size_t = 8; aarch64_linux_record_tdep.size_iovec = 16; + aarch64_linux_record_tdep.size_time_t = 8; /* These values are the second argument of system call "sys_ioctl". They are obtained from Linux Kernel source. */ diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 0b068c3fc5f..829d9b70111 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1959,6 +1959,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) amd64_linux_record_tdep.size_hayes_esp_config = 12; amd64_linux_record_tdep.size_size_t = 8; amd64_linux_record_tdep.size_iovec = 16; + amd64_linux_record_tdep.size_time_t = 8; /* These values are the second argument of system call "sys_fcntl" and "sys_fcntl64". They are obtained from Linux Kernel source. */ @@ -2175,6 +2176,7 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) amd64_x32_linux_record_tdep.size_hayes_esp_config = 12; amd64_x32_linux_record_tdep.size_size_t = 8; amd64_x32_linux_record_tdep.size_iovec = 16; + amd64_x32_linux_record_tdep.size_time_t = 8; /* These values are the second argument of system call "sys_fcntl" and "sys_fcntl64". They are obtained from Linux Kernel source. */ diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index a820e747b5b..73e1271f546 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1550,6 +1550,7 @@ arm_linux_init_abi (struct gdbarch_info info, arm_linux_record_tdep.size_hayes_esp_config = 12; arm_linux_record_tdep.size_size_t = 4; arm_linux_record_tdep.size_iovec = 8; + arm_linux_record_tdep.size_time_t = 4; /* These values are the second argument of system call "sys_ioctl". They are obtained from Linux Kernel source. */ diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 8847ad3e301..86fe09e5d10 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -869,6 +869,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) i386_linux_record_tdep.size_hayes_esp_config = 12; i386_linux_record_tdep.size_size_t = 4; i386_linux_record_tdep.size_iovec = 8; + i386_linux_record_tdep.size_time_t = 4; /* These values are the second argument of system call "sys_ioctl". They are obtained from Linux Kernel source. */ diff --git a/gdb/linux-record.c b/gdb/linux-record.c index 8832ef4ee51..dbd8f14a79a 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c @@ -272,13 +272,31 @@ record_linux_system_call (enum gdb_syscall syscall, case gdb_sys_write: case gdb_sys_open: case gdb_sys_close: + break; + case gdb_sys_waitpid: + regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); + if (tmpulongest) + if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, + tdep->size_int)) + return -1; + break; + case gdb_sys_creat: case gdb_sys_link: case gdb_sys_unlink: case gdb_sys_execve: case gdb_sys_chdir: + break; + case gdb_sys_time: + regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); + if (tmpulongest) + if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, + tdep->size_time_t)) + return -1; + break; + case gdb_sys_mknod: case gdb_sys_chmod: case gdb_sys_lchown16: @@ -330,7 +348,12 @@ record_linux_system_call (enum gdb_syscall syscall, case gdb_sys_mkdir: case gdb_sys_rmdir: case gdb_sys_dup: + break; + case gdb_sys_pipe: + regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); + if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, + tdep->size_int * 2)) break; case gdb_sys_times: diff --git a/gdb/linux-record.h b/gdb/linux-record.h index 9af0bdbbd01..3683edcdcd7 100644 --- a/gdb/linux-record.h +++ b/gdb/linux-record.h @@ -89,6 +89,7 @@ struct linux_record_tdep int size_hayes_esp_config; int size_size_t; int size_iovec; + int size_time_t; /* The values of the second argument of system call "sys_ioctl". */ int ioctl_TCGETS; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index cf71cf3e5cb..ab20e788916 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1479,6 +1479,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, record_tdep->size_serial_icounter_struct = 80; record_tdep->size_size_t = 8; record_tdep->size_iovec = 16; + record_tdep->size_time_t = 8; } else if (wordsize == 4) { @@ -1545,6 +1546,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, record_tdep->size_serial_icounter_struct = 80; record_tdep->size_size_t = 4; record_tdep->size_iovec = 8; + record_tdep->size_time_t = 4; } else internal_error (__FILE__, __LINE__, _("unexpected wordsize")); -- 2.30.2