Re: PATCH: Check DS segment register for x32 process

H.J. Lu
2012-05-11T20:29:02Z

On Fri, May 11, 2012 at 1:25 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> 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.

Some x32 OSes don't have any 64bit binaries nor 64bit libraries.
32-bit x32 GDB work without any problems.

--
H.J.