Re: [PATCH 2/3] PR gdb/16304: Add amd64_x32_linux_record_tdep and amd64_x32_sys_xxx

Mark Kettenis
2013-12-08T21:59:50Z

> Date: Sun, 8 Dec 2013 11:44:19 -0800
> From: "H.J. Lu" <hongjiu.lu@intel.com>
>
> Hi,
>
> X32 Linux system calls are diffferent from amd64 Linux system calls
> in system call numbers as well as parameter types/values. We can't use
> amd64_linux_record_tdep for x32. This patch adds x32 system call
> numbers. It also adds linux_record_tdep_p to gdbarch_tdep so that
> we can use different linux_record_tdeps for x32 and amd64.
> linux_record_tdep_p will be unused for other x86 targets. Tested on
> Linux/x86-64. OK to install?

No.

There is no reason to add this linux_record_tdep_pmember to the
generic struct gdbarch_tdep. If the system calls are different, you
need to add an amd64_x32_linux_syscall_record() function and make sure
that gets used for x32.

> 2013-12-08 H.J. Lu <hongjiu.lu@intel.com>
>
> PR gdb/16304
> * amd64-linux-tdep.c (amd64_canonicalize_syscall): Handle x32
> system calls.
> (amd64_x32_linux_record_tdep): New.
> (amd64_linux_syscall_record): Handle amd64_x32_sys_rt_sigreturn
> and amd64_x32_sys_arch_prctl. Use tdep->linux_record_tdep_p
> instead of amd64_linux_record_tdep.
> (amd64_linux_init_abi_common): Move amd64_linux_record_tdep
> initialization to ...
> (amd64_linux_init_abi): Here. Set tdep->linux_record_tdep_p
> to amd64_linux_record_tdep.
> (amd64_x32_linux_init_abi): Initialize
> amd64_x32_linux_record_tdep. Set tdep->linux_record_tdep_p to
> amd64_x32_linux_record_tdep.
> * amd64-linux-tdep.h (amd64_x32_syscall): New enum.
> * i386-linux-tdep.c (i386_linux_init_abi): Set
> tdep->linux_record_tdep_p to 386_linux_record_tdep.
> * i386-tdep.c (i386_gdbarch_init): Set tdep->linux_record_tdep_p
> to NULL.
> * i386-tdep.h (gdbarch_tdep): Add linux_record_tdep_p.
>
> ---
> gdb/amd64-linux-tdep.c | 557 ++++++++++++++++++++++++++++++++++++++++++++-----
> gdb/amd64-linux-tdep.h | 280 +++++++++++++++++++++++++
> gdb/i386-linux-tdep.c | 1 +
> gdb/i386-tdep.c | 1 +
> gdb/i386-tdep.h | 3 +
> 5 files changed, 785 insertions(+), 57 deletions(-)