aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2015-10-30 15:51:58 +0000
committerPedro Alves <palves@redhat.com>2015-10-30 15:51:58 +0000
commit72aded8673d6cb2d0e33696e010a778e9bbfa817 (patch)
tree55921fab81b61b4c49cb70d0963bde9c2952cf55
parent7571f7f297c8d8b4fb4657f84437b1d156957e16 (diff)
downloadgdb-72aded8673d6cb2d0e33696e010a778e9bbfa817.zip
gdb-72aded8673d6cb2d0e33696e010a778e9bbfa817.tar.gz
gdb-72aded8673d6cb2d0e33696e010a778e9bbfa817.tar.bz2
gdb/linux-record: Fix readdir and getdents handling
getdents buffer size is given in bytes, not dirent entries (which have variable size anyway). We don't need size_dirent and size_dirent64 for this reason. readdir, on the other hand, needs size of old_linux_dirent, which is a somewhat different structure. Accordingly, rename size_dirent to size_old_dirent. gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_linux_init_abi): Remove size_dirent{,64}, add size_old_dirent. * amd64-linux-tdep.c (amd64_linux_init_abi): Remove size_dirent{,64}, add size_old_dirent. (amd64_x32_linux_init_abi): Remove size_dirent{,64}, add size_old_dirent. * arm-linux-tdep.c (arm_linux_init_abi): Remove size_dirent{,64}, add size_old_dirent. * i386-linux-tdep.c (i386_linux_init_abi): Remove size_dirent{,64}, add size_old_dirent. * linux-record.c (record_linux_system_call): Fix handling of readdir and getdents{,64}. * linux-record.h (struct linux_record_tdep): Remove size_dirent{,64}, add size_old_dirent. * ppc-linux-tdep.c (ppc_init_linux_record_tdep): Remove size_dirent{,64}, add size_old_dirent.
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/aarch64-linux-tdep.c3
-rw-r--r--gdb/amd64-linux-tdep.c8
-rw-r--r--gdb/arm-linux-tdep.c3
-rw-r--r--gdb/i386-linux-tdep.c3
-rw-r--r--gdb/linux-record.c19
-rw-r--r--gdb/linux-record.h3
-rw-r--r--gdb/ppc-linux-tdep.c6
8 files changed, 32 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 87a462e..296e861 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,24 @@
2015-10-30 Marcin Kościelnicki <koriakin@0x04.net>
+ * aarch64-linux-tdep.c (aarch64_linux_init_abi): Remove
+ size_dirent{,64}, add size_old_dirent.
+ * amd64-linux-tdep.c (amd64_linux_init_abi): Remove size_dirent{,64},
+ add size_old_dirent.
+ (amd64_x32_linux_init_abi): Remove size_dirent{,64}, add
+ size_old_dirent.
+ * arm-linux-tdep.c (arm_linux_init_abi): Remove size_dirent{,64},
+ add size_old_dirent.
+ * i386-linux-tdep.c (i386_linux_init_abi): Remove size_dirent{,64},
+ add size_old_dirent.
+ * linux-record.c (record_linux_system_call): Fix handling of readdir
+ and getdents{,64}.
+ * linux-record.h (struct linux_record_tdep): Remove size_dirent{,64},
+ add size_old_dirent.
+ * ppc-linux-tdep.c (ppc_init_linux_record_tdep): Remove
+ size_dirent{,64}, add size_old_dirent.
+
+2015-10-30 Marcin Kościelnicki <koriakin@0x04.net>
+
* aarch64-linux-tdep.c (aarch64_linux_init_abi): Fix size_sigaction,
size_sigset_t, size_old_sigaction, size_old_sigset_t.
* amd64-linux-tdep.c (amd64_linux_init_abi): Fix size_sigaction,
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 57cb973..0a3fbb3 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1009,8 +1009,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
aarch64_linux_record_tdep.size_old_gid_t = 2;
aarch64_linux_record_tdep.size_old_uid_t = 2;
aarch64_linux_record_tdep.size_fd_set = 128;
- aarch64_linux_record_tdep.size_dirent = 280;
- aarch64_linux_record_tdep.size_dirent64 = 280;
+ aarch64_linux_record_tdep.size_old_dirent = 280;
aarch64_linux_record_tdep.size_statfs = 120;
aarch64_linux_record_tdep.size_statfs64 = 120;
aarch64_linux_record_tdep.size_sockaddr = 16;
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 3bca3c8..0b068c3 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1905,8 +1905,8 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
but sys_getresuid. */
amd64_linux_record_tdep.size_old_uid_t = 2;
amd64_linux_record_tdep.size_fd_set = 128;
- amd64_linux_record_tdep.size_dirent = 280;
- amd64_linux_record_tdep.size_dirent64 = 280;
+ /* ADM64 doesn't need this size because it doesn't have sys_readdir. */
+ amd64_linux_record_tdep.size_old_dirent = 280;
amd64_linux_record_tdep.size_statfs = 120;
amd64_linux_record_tdep.size_statfs64 = 120;
amd64_linux_record_tdep.size_sockaddr = 16;
@@ -2121,8 +2121,8 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
but sys_getresuid. */
amd64_x32_linux_record_tdep.size_old_uid_t = 2;
amd64_x32_linux_record_tdep.size_fd_set = 128;
- amd64_x32_linux_record_tdep.size_dirent = 280;
- amd64_x32_linux_record_tdep.size_dirent64 = 280;
+ /* ADM64 doesn't need this size because it doesn't have sys_readdir. */
+ amd64_x32_linux_record_tdep.size_old_dirent = 268;
amd64_x32_linux_record_tdep.size_statfs = 120;
amd64_x32_linux_record_tdep.size_statfs64 = 120;
amd64_x32_linux_record_tdep.size_sockaddr = 16;
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 88d818d..a820e74 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1496,8 +1496,7 @@ arm_linux_init_abi (struct gdbarch_info info,
arm_linux_record_tdep.size_old_gid_t = 2;
arm_linux_record_tdep.size_old_uid_t = 2;
arm_linux_record_tdep.size_fd_set = 128;
- arm_linux_record_tdep.size_dirent = 268;
- arm_linux_record_tdep.size_dirent64 = 276;
+ arm_linux_record_tdep.size_old_dirent = 268;
arm_linux_record_tdep.size_statfs = 64;
arm_linux_record_tdep.size_statfs64 = 84;
arm_linux_record_tdep.size_sockaddr = 16;
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 0bf2cdc..8847ad3 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -815,8 +815,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_linux_record_tdep.size_old_gid_t = 2;
i386_linux_record_tdep.size_old_uid_t = 2;
i386_linux_record_tdep.size_fd_set = 128;
- i386_linux_record_tdep.size_dirent = 268;
- i386_linux_record_tdep.size_dirent64 = 276;
+ i386_linux_record_tdep.size_old_dirent = 268;
i386_linux_record_tdep.size_statfs = 64;
i386_linux_record_tdep.size_statfs64 = 84;
i386_linux_record_tdep.size_sockaddr = 16;
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index d1e02f4..e950e8d 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -689,7 +689,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_old_readdir:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_dirent))
+ tdep->size_old_dirent))
return -1;
break;
@@ -1344,14 +1344,14 @@ Do you want to stop the program?"),
break;
case gdb_sys_getdents:
+ case gdb_sys_getdents64:
{
ULONGEST count;
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_dirent * count))
+ if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, count))
return -1;
}
break;
@@ -1745,19 +1745,6 @@ Do you want to stop the program?"),
case gdb_sys_madvise:
break;
- case gdb_sys_getdents64:
- {
- ULONGEST count;
-
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
- regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_dirent64 * count))
- return -1;
- }
- break;
-
case gdb_sys_fcntl64:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest == tdep->fcntl_F_GETLK64)
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
index 839bd31..9af0bdb 100644
--- a/gdb/linux-record.h
+++ b/gdb/linux-record.h
@@ -39,8 +39,7 @@ struct linux_record_tdep
int size_old_gid_t;
int size_old_uid_t;
int size_fd_set;
- int size_dirent;
- int size_dirent64;
+ int size_old_dirent;
int size_statfs;
int size_statfs64;
int size_sockaddr;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 896f410..cf71cf3 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1432,8 +1432,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_old_gid_t = 4;
record_tdep->size_old_uid_t = 4;
record_tdep->size_fd_set = 128;
- record_tdep->size_dirent = 280;
- record_tdep->size_dirent64 = 280;
+ record_tdep->size_old_dirent = 280;
record_tdep->size_statfs = 120;
record_tdep->size_statfs64 = 120;
record_tdep->size_sockaddr = 16;
@@ -1499,8 +1498,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_old_gid_t = 4;
record_tdep->size_old_uid_t = 4;
record_tdep->size_fd_set = 128;
- record_tdep->size_dirent = 268;
- record_tdep->size_dirent64 = 280;
+ record_tdep->size_old_dirent = 268;
record_tdep->size_statfs = 64;
record_tdep->size_statfs64 = 88;
record_tdep->size_sockaddr = 16;