* solib-sunos.c (sunos_relocate_main_executable): Remove function.
[deliverable/binutils-gdb.git] / gdb / amd64obsd-tdep.c
index c1574cd9f4ac8d9b69bc44b983615056fb7c9c1e..f97b9a6c57e2e9007ccaf79135658b3a219d5071 100644 (file)
@@ -90,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
@@ -104,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;
@@ -136,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.023671 seconds and 4 git commands to generate.