[PATCH v2 04/13] gdb/linux-record: Fix sizes of sigaction and sigset_t

Marcin Kościelnicki
2015-10-22T13:39:50Z

The values were mistakenly set to size of glibc's sigset_t (128 bytes)
and sigaction (140 or 152 bytes) instead of the kernel ones. The kernel
has 4 or 8 byte old_sigset_t, 8 byte sigset_t, 16 or 32 byte old_sigaction,
20 or 32 byte sigaction.

gdb/ChangeLog:

* 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,
size_sigset_t, size_old_sigaction, size_old_sigset_t.
(amd64_x32_linux_init_abi): Fix size_sigaction, size_sigset_t,
size_old_sigaction, size_old_sigset_t.
* arm-linux-tdep.c (arm_linux_init_abi): Fix size_sigaction,
size_old_sigaction, size_old_sigset_t.
* i386-linux-tdep.c (i386_linux_init_abi): Fix size_sigaction,
size_old_sigaction, size_old_sigset_t.
* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Fix size_sigaction,
size_sigset_t, size_old_sigaction, size_old_sigset_t.
---
gdb/ChangeLog | 15 +++++++++++++++
gdb/aarch64-linux-tdep.c | 8 ++++----
gdb/amd64-linux-tdep.c | 16 ++++++++--------
gdb/arm-linux-tdep.c | 6 +++---
gdb/i386-linux-tdep.c | 6 +++---
gdb/ppc-linux-tdep.c | 16 ++++++++--------
6 files changed, 41 insertions(+), 26 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c88a331..e3e446c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2015-10-22 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,
+ size_sigset_t, size_old_sigaction, size_old_sigset_t.
+ (amd64_x32_linux_init_abi): Fix size_sigaction, size_sigset_t,
+ size_old_sigaction, size_old_sigset_t.
+ * arm-linux-tdep.c (arm_linux_init_abi): Fix size_sigaction,
+ size_old_sigaction, size_old_sigset_t.
+ * i386-linux-tdep.c (i386_linux_init_abi): Fix size_sigaction,
+ size_old_sigaction, size_old_sigset_t.
+ * ppc-linux-tdep.c (ppc_init_linux_record_tdep): Fix size_sigaction,
+ size_sigset_t, size_old_sigaction, size_old_sigset_t.
+
+2015-10-22 Marcin KoÅ›cielnicki <koriakin@0x04.net>
+
* arm-linux-tdep.c (arm_linux_init_abi): Fix size_[ug]id.
* i386-linux-tdep.c (i386_linux_init_abi): Fix size_[ug]id.

diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 4169200..57cb973 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1000,8 +1000,8 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
aarch64_linux_record_tdep.size_flock = 32;
aarch64_linux_record_tdep.size_oldold_utsname = 45;
aarch64_linux_record_tdep.size_ustat = 32;
- aarch64_linux_record_tdep.size_old_sigaction = 152;
- aarch64_linux_record_tdep.size_old_sigset_t = 128;
+ aarch64_linux_record_tdep.size_old_sigaction = 32;
+ aarch64_linux_record_tdep.size_old_sigset_t = 8;
aarch64_linux_record_tdep.size_rlimit = 16;
aarch64_linux_record_tdep.size_rusage = 144;
aarch64_linux_record_tdep.size_timeval = 16;
@@ -1037,8 +1037,8 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
aarch64_linux_record_tdep.size_NFS_FHSIZE = 32;
aarch64_linux_record_tdep.size_knfsd_fh = 132;
aarch64_linux_record_tdep.size_TASK_COMM_LEN = 16;
- aarch64_linux_record_tdep.size_sigaction = 152;
- aarch64_linux_record_tdep.size_sigset_t = 128;
+ aarch64_linux_record_tdep.size_sigaction = 32;
+ aarch64_linux_record_tdep.size_sigset_t = 8;
aarch64_linux_record_tdep.size_siginfo_t = 128;
aarch64_linux_record_tdep.size_cap_user_data_t = 8;
aarch64_linux_record_tdep.size_stack_t = 24;
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 59c318d..3bca3c8 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1890,10 +1890,10 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_linux_record_tdep.size_ustat = 32;
/* ADM64 doesn't need this size because it doesn't have sys_sigaction
but sys_rt_sigaction. */
- amd64_linux_record_tdep.size_old_sigaction = 152;
+ amd64_linux_record_tdep.size_old_sigaction = 32;
/* ADM64 doesn't need this size because it doesn't have sys_sigpending
but sys_rt_sigpending. */
- amd64_linux_record_tdep.size_old_sigset_t = 128;
+ amd64_linux_record_tdep.size_old_sigset_t = 8;
amd64_linux_record_tdep.size_rlimit = 16;
amd64_linux_record_tdep.size_rusage = 144;
amd64_linux_record_tdep.size_timeval = 16;
@@ -1933,8 +1933,8 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_linux_record_tdep.size_NFS_FHSIZE = 32;
amd64_linux_record_tdep.size_knfsd_fh = 132;
amd64_linux_record_tdep.size_TASK_COMM_LEN = 16;
- amd64_linux_record_tdep.size_sigaction = 152;
- amd64_linux_record_tdep.size_sigset_t = 128;
+ amd64_linux_record_tdep.size_sigaction = 32;
+ amd64_linux_record_tdep.size_sigset_t = 8;
amd64_linux_record_tdep.size_siginfo_t = 128;
amd64_linux_record_tdep.size_cap_user_data_t = 8;
amd64_linux_record_tdep.size_stack_t = 24;
@@ -2106,10 +2106,10 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_x32_linux_record_tdep.size_ustat = 32;
/* ADM64 doesn't need this size because it doesn't have sys_sigaction
but sys_rt_sigaction. */
- amd64_x32_linux_record_tdep.size_old_sigaction = 152;
+ amd64_x32_linux_record_tdep.size_old_sigaction = 16;
/* ADM64 doesn't need this size because it doesn't have sys_sigpending
but sys_rt_sigpending. */
- amd64_x32_linux_record_tdep.size_old_sigset_t = 128;
+ amd64_x32_linux_record_tdep.size_old_sigset_t = 4;
amd64_x32_linux_record_tdep.size_rlimit = 16;
amd64_x32_linux_record_tdep.size_rusage = 144;
amd64_x32_linux_record_tdep.size_timeval = 16;
@@ -2149,8 +2149,8 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_x32_linux_record_tdep.size_NFS_FHSIZE = 32;
amd64_x32_linux_record_tdep.size_knfsd_fh = 132;
amd64_x32_linux_record_tdep.size_TASK_COMM_LEN = 16;
- amd64_x32_linux_record_tdep.size_sigaction = 152;
- amd64_x32_linux_record_tdep.size_sigset_t = 128;
+ amd64_x32_linux_record_tdep.size_sigaction = 20;
+ amd64_x32_linux_record_tdep.size_sigset_t = 8;
amd64_x32_linux_record_tdep.size_siginfo_t = 128;
amd64_x32_linux_record_tdep.size_cap_user_data_t = 8;
amd64_x32_linux_record_tdep.size_stack_t = 24;
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 940f01f..88d818d 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1487,8 +1487,8 @@ arm_linux_init_abi (struct gdbarch_info info,
arm_linux_record_tdep.size_flock = 16;
arm_linux_record_tdep.size_oldold_utsname = 45;
arm_linux_record_tdep.size_ustat = 20;
- arm_linux_record_tdep.size_old_sigaction = 140;
- arm_linux_record_tdep.size_old_sigset_t = 128;
+ arm_linux_record_tdep.size_old_sigaction = 16;
+ arm_linux_record_tdep.size_old_sigset_t = 4;
arm_linux_record_tdep.size_rlimit = 8;
arm_linux_record_tdep.size_rusage = 72;
arm_linux_record_tdep.size_timeval = 8;
@@ -1524,7 +1524,7 @@ arm_linux_init_abi (struct gdbarch_info info,
arm_linux_record_tdep.size_NFS_FHSIZE = 32;
arm_linux_record_tdep.size_knfsd_fh = 132;
arm_linux_record_tdep.size_TASK_COMM_LEN = 16;
- arm_linux_record_tdep.size_sigaction = 140;
+ arm_linux_record_tdep.size_sigaction = 20;
arm_linux_record_tdep.size_sigset_t = 8;
arm_linux_record_tdep.size_siginfo_t = 128;
arm_linux_record_tdep.size_cap_user_data_t = 12;
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index af9c28a..0bf2cdc 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -806,8 +806,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_linux_record_tdep.size_flock = 16;
i386_linux_record_tdep.size_oldold_utsname = 45;
i386_linux_record_tdep.size_ustat = 20;
- i386_linux_record_tdep.size_old_sigaction = 140;
- i386_linux_record_tdep.size_old_sigset_t = 128;
+ i386_linux_record_tdep.size_old_sigaction = 16;
+ i386_linux_record_tdep.size_old_sigset_t = 4;
i386_linux_record_tdep.size_rlimit = 8;
i386_linux_record_tdep.size_rusage = 72;
i386_linux_record_tdep.size_timeval = 8;
@@ -843,7 +843,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_linux_record_tdep.size_NFS_FHSIZE = 32;
i386_linux_record_tdep.size_knfsd_fh = 132;
i386_linux_record_tdep.size_TASK_COMM_LEN = 16;
- i386_linux_record_tdep.size_sigaction = 140;
+ i386_linux_record_tdep.size_sigaction = 20;
i386_linux_record_tdep.size_sigset_t = 8;
i386_linux_record_tdep.size_siginfo_t = 128;
i386_linux_record_tdep.size_cap_user_data_t = 12;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 79d115e..896f410 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1423,8 +1423,8 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_flock = 32;
record_tdep->size_oldold_utsname = 45;
record_tdep->size_ustat = 32;
- record_tdep->size_old_sigaction = 152;
- record_tdep->size_old_sigset_t = 128;
+ record_tdep->size_old_sigaction = 32;
+ record_tdep->size_old_sigset_t = 8;
record_tdep->size_rlimit = 16;
record_tdep->size_rusage = 144;
record_tdep->size_timeval = 16;
@@ -1457,8 +1457,8 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_NFS_FHSIZE = 32;
record_tdep->size_knfsd_fh = 132;
record_tdep->size_TASK_COMM_LEN = 32;
- record_tdep->size_sigaction = 152;
- record_tdep->size_sigset_t = 128;
+ record_tdep->size_sigaction = 32;
+ record_tdep->size_sigset_t = 8;
record_tdep->size_siginfo_t = 128;
record_tdep->size_cap_user_data_t = 8;
record_tdep->size_stack_t = 24;
@@ -1490,8 +1490,8 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_flock = 16;
record_tdep->size_oldold_utsname = 45;
record_tdep->size_ustat = 20;
- record_tdep->size_old_sigaction = 152;
- record_tdep->size_old_sigset_t = 128;
+ record_tdep->size_old_sigaction = 16;
+ record_tdep->size_old_sigset_t = 4;
record_tdep->size_rlimit = 8;
record_tdep->size_rusage = 72;
record_tdep->size_timeval = 8;
@@ -1524,8 +1524,8 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_NFS_FHSIZE = 32;
record_tdep->size_knfsd_fh = 132;
record_tdep->size_TASK_COMM_LEN = 32;
- record_tdep->size_sigaction = 140;
- record_tdep->size_sigset_t = 128;
+ record_tdep->size_sigaction = 20;
+ record_tdep->size_sigset_t = 8;
record_tdep->size_siginfo_t = 128;
record_tdep->size_cap_user_data_t = 4;
record_tdep->size_stack_t = 12;
--
2.6.1