Re: PATCH: Check DS segment register for x32 process

Mark Kettenis
2012-05-11T20:25:22Z

> Date: Fri, 11 May 2012 12:31:14 -0700
> From: "H.J. Lu" <hongjiu.lu@intel.com>
>
> Hi,
>
> This patch checks DS segment register for x32 process. Tested on
> Linux/x86-64. OK to install?
>
> Thanks.
>
> H.J.
> ---
> * amd64-linux-nat.c (AMD64_LINUX_X32_DS): New.
> (amd64_linux_read_description): Check DS segment register for
> x32 process.
>
> diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
> index 3be8404..97c9a49 100644
> --- a/gdb/amd64-linux-nat.c
> +++ b/gdb/amd64-linux-nat.c

> + if (sizeof (void *) == 4 && is_64bit && !is_x32)
> + error (_("Can't debug 64-bit process with 32-bit GDB"));

I really think we should refuse to even build a GDB as an X32 binary.