gdb/doc/
[deliverable/binutils-gdb.git] / gdb / amd64-linux-tdep.c
index f249d5dcd17041c83e8ead0ac321f157c2c8f072..acc7303b88f72d8f3b0e2ab4de8f25a619d47c84 100644 (file)
@@ -1,7 +1,6 @@
 /* Target-dependent code for GNU/Linux x86-64.
 
-   Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003-2012 Free Software Foundation, Inc.
    Contributed by Jiri Smid, SuSE Labs.
 
    This file is part of GDB.
@@ -39,6 +38,7 @@
 #include "amd64-tdep.h"
 #include "solib-svr4.h"
 #include "xml-syscall.h"
+#include "glibc-tdep.h"
 
 #include "features/i386/amd64-linux.c"
 #include "features/i386/amd64-avx-linux.c"
@@ -52,7 +52,7 @@
 /* Supported register note sections.  */
 static struct core_regset_section amd64_linux_regset_sections[] =
 {
-  { ".reg", 144, "general-purpose" },
+  { ".reg", 27 * 8, "general-purpose" },
   { ".reg2", 512, "floating-point" },
   { ".reg-xstate", I386_XSTATE_MAX_SIZE, "XSAVE extended state" },
   { NULL, 0 }
@@ -62,7 +62,7 @@ static struct core_regset_section amd64_linux_regset_sections[] =
    format and GDB's register cache layout.  */
 
 /* From <sys/reg.h>.  */
-static int amd64_linux_gregset_reg_offset[] =
+int amd64_linux_gregset_reg_offset[] =
 {
   10 * 8,                      /* %rax */
   5 * 8,                       /* %rbx */
@@ -72,7 +72,7 @@ static int amd64_linux_gregset_reg_offset[] =
   14 * 8,                      /* %rdi */
   4 * 8,                       /* %rbp */
   19 * 8,                      /* %rsp */
-  9 * 8,                       /* %r8 ... */
+  9 * 8,                       /* %r8 ...  */
   8 * 8,
   7 * 8,
   6 * 8,
@@ -157,7 +157,7 @@ static int
 amd64_linux_sigtramp_p (struct frame_info *this_frame)
 {
   CORE_ADDR pc = get_frame_pc (this_frame);
-  char *name;
+  const char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
 
@@ -339,9 +339,9 @@ amd64_all_but_ip_registers_record (struct regcache *regcache)
    process record.  */
 
 static enum gdb_syscall
-amd64_canonicalize_syscall (enum amd64_syscall syscall)
+amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
 {
-  switch (syscall) {
+  switch (syscall_number) {
   case amd64_sys_read:
     return gdb_sys_read;
 
@@ -1174,25 +1174,24 @@ amd64_linux_syscall_record (struct regcache *regcache)
       break;
 
     case amd64_sys_arch_prctl:
-      if (syscall_native == amd64_sys_arch_prctl)
-        {
-          ULONGEST arg3;
-
-          regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3,
-                                      &arg3);
-          if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
-            {
-             CORE_ADDR addr;
-
-             regcache_raw_read_unsigned (regcache,
-                                          amd64_linux_record_tdep.arg2,
-                                          &addr);
-             if (record_arch_list_add_mem (addr,
-                                            amd64_linux_record_tdep.size_ulong))
-                return -1;
-            }
-          goto record_regs;
-        }
+      {
+       ULONGEST arg3;
+
+       regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3,
+                                   &arg3);
+       if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
+         {
+           CORE_ADDR addr;
+
+           regcache_raw_read_unsigned (regcache,
+                                       amd64_linux_record_tdep.arg2,
+                                       &addr);
+           if (record_arch_list_add_mem (addr,
+                                         amd64_linux_record_tdep.size_ulong))
+             return -1;
+         }
+       goto record_regs;
+      }
       break;
     }
 
@@ -1227,7 +1226,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
 #define AMD64_LINUX_xstate     512
 #define AMD64_LINUX_frame_size 560
 
-int
+static int
 amd64_linux_record_signal (struct gdbarch *gdbarch,
                            struct regcache *regcache,
                            enum target_signal signal)
@@ -1269,18 +1268,15 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch,
                                  struct target_ops *target,
                                  bfd *abfd)
 {
-  asection *section = bfd_get_section_by_name (abfd, ".reg2");
-  uint64_t xcr0;
-
-  if (section == NULL)
-    return NULL;
-
   /* Linux/x86-64.  */
-  xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
-  if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
-    return tdesc_amd64_avx_linux;
-  else
-    return tdesc_amd64_linux;
+  uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
+  switch ((xcr0 & I386_XSTATE_AVX_MASK))
+    {
+    case I386_XSTATE_AVX_MASK:
+      return tdesc_amd64_avx_linux;
+    default:
+      return tdesc_amd64_linux;
+    }
 }
 
 static void
@@ -1294,6 +1290,8 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   gdb_assert (tdesc_data);
 
+  linux_init_abi (info, gdbarch);
+
   tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
   tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
   tdep->sizeof_gregset = 27 * 8;
@@ -1345,6 +1343,9 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* GNU/Linux uses SVR4-style shared libraries.  */
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
+  /* GNU/Linux uses the dynamic linker included in the GNU C Library.  */
+  set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
+
   /* Install supported register note sections.  */
   set_gdbarch_core_regset_sections (gdbarch, amd64_linux_regset_sections);
 
@@ -1545,7 +1546,7 @@ _initialize_amd64_linux_tdep (void)
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
                          GDB_OSABI_LINUX, amd64_linux_init_abi);
 
-  /* Initialize the Linux target description  */
+  /* Initialize the Linux target description.  */
   initialize_tdesc_amd64_linux ();
   initialize_tdesc_amd64_avx_linux ();
 }
This page took 0.025895 seconds and 4 git commands to generate.