Move construction of IA-32 vector types to i386-tdep.c.
[deliverable/binutils-gdb.git] / gdb / amd64obsd-tdep.c
index 01cc559575fe15a589d4ba44809e027e50879942..f97b9a6c57e2e9007ccaf79135658b3a219d5071 100644 (file)
@@ -42,7 +42,7 @@ amd64obsd_supply_regset (const struct regset *regset,
                         struct regcache *regcache, int regnum,
                         const void *regs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = regset->descr;
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
 
@@ -63,8 +63,7 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
       && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE)
     {
       if (tdep->gregset == NULL)
-        tdep->gregset = regset_alloc (gdbarch, tdep,
-                                      amd64obsd_supply_regset, NULL);
+        tdep->gregset = regset_alloc (gdbarch, amd64obsd_supply_regset, NULL);
       return tdep->gregset;
     }
 
@@ -91,6 +90,7 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
     0x67, 0x00, 0x00, 0x00,    /* movq $SYS_sigreturn, %rax */
     0xcd, 0x80                 /* int $0x80 */
   };
+  size_t buflen = (sizeof sigreturn) + 1;
   char *name, *buf;
 
   /* If the function has a valid symbol name, it isn't a
@@ -105,12 +105,15 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
     return 0;
 
   /* If we can't read the instructions at START_PC, return zero.  */
-  buf = alloca (sizeof sigreturn);
-  if (target_read_memory (start_pc + 7, buf, sizeof sigreturn))
+  buf = alloca ((sizeof sigreturn) + 1);
+  if (!safe_frame_unwind_memory (next_frame, start_pc + 6, buf, buflen))
     return 0;
 
-  /* Check for sigreturn(2).  */
-  if (memcmp (buf, sigreturn, sizeof sigreturn))
+  /* Check for sigreturn(2).  Depending on how the assembler encoded
+     the `movq %rsp, %rdi' instruction, the code starts at offset 6 or
+     7.  */
+  if (memcmp (buf, sigreturn, sizeof sigreturn)
+      && memcpy (buf + 1, sigreturn, sizeof sigreturn))
     return 0;
 
   return 1;
@@ -137,7 +140,7 @@ amd64obsd_sigcontext_addr (struct frame_info *next_frame)
      (see /usr/src/sys/arch/amd64/amd64/locore.S).  The `pushq'
      instruction clobbers %rsp, but its value is saved in `%rdi'.  */
 
-  if (offset > 6)
+  if (offset > 5)
     return frame_unwind_register_unsigned (next_frame, AMD64_RDI_REGNUM);
   else
     return frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
This page took 0.024614 seconds and 4 git commands to generate.