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.
This commit is contained in:
parent
7571f7f297
commit
72aded8673
@ -1,3 +1,22 @@
|
||||
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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user