- switch (gdbarch_ptr_bit (current_gdbarch) == 32)
- {
- case bfd_mach_i386_i386:
- case bfd_mach_i386_i386_intel_syntax:
- {
- /* The full structure is found in <asm-i386/ldt.h>. The
- second integer is the LDT's base_address and that is used
- to locate the thread's local storage. See i386-linux-nat.c
- more info. */
- unsigned int desc[4];
-
- /* This code assumes that "int" is 32 bits and that
- GET_THREAD_AREA returns no more than 4 int values. */
- gdb_assert (sizeof (int) == 4);
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
- if (ptrace (PTRACE_GET_THREAD_AREA,
- lwpid, (void *) (long) idx, (unsigned long) &desc) < 0)
- return PS_ERR;
-
- /* Extend the value to 64 bits. Here it's assumed that a
- "long" and a "void *" are the same. */
- (*base) = (void *) (long) desc[1];
- return PS_OK;
- }
-
- case bfd_mach_x86_64:
- case bfd_mach_x86_64_intel_syntax:
- /* This definition comes from prctl.h, but some kernels may not
- have it. */