mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 21:03:55 +08:00
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:

committed by
Pedro Alves

parent
7571f7f297
commit
72aded8673
@ -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)
|
||||
|
Reference in New Issue
Block a user