]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2011-12-17 Mark Kettenis <kettenis@gnu.org>
authorMark Kettenis <kettenis@gnu.org>
Sat, 17 Dec 2011 19:46:00 +0000 (19:46 +0000)
committerMark Kettenis <kettenis@gnu.org>
Sat, 17 Dec 2011 19:46:00 +0000 (19:46 +0000)
        * amd64obsd-tdep.c (amd64obsd_init_abi): Don't set
        regset_from_core_section.
        (amd64obsd_core_init_abi): New function that sets
        regset_from_core_section.
        (_initialize_amd64obsd_tdep): Use amd64obsd_core_init_abi for
        traditional core dumps.

2011-12-17  Mark Kettenis  <kettenis@gnu.org>

        * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Detect new signal
        trampoline to be introduced in OpenBSD 5.0.

gdb/ChangeLog
gdb/amd64obsd-tdep.c

index e8d222247dd58f00082a19cdcac91e391de6f384..83cfd5b80e402c056c4931ad5ab5f3b22a7ab013 100644 (file)
@@ -1,3 +1,17 @@
+2011-12-17  Mark Kettenis  <kettenis@gnu.org>
+
+       * amd64obsd-tdep.c (amd64obsd_init_abi): Don't set
+       regset_from_core_section.
+       (amd64obsd_core_init_abi): New function that sets
+       regset_from_core_section.
+       (_initialize_amd64obsd_tdep): Use amd64obsd_core_init_abi for
+       traditional core dumps.
+
+2011-12-17  Mark Kettenis  <kettenis@gnu.org>
+
+       * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Detect new signal
+       trampoline to be introduced in OpenBSD 5.0.
+
 2011-12-16  Tom Tromey  <tromey@redhat.com>
 
        * linespec.c (collect_symbols): Call maybe_add_address after
index 2ff5c8f91828f92c6720cf0c58d47d7a5219ce3b..4d592e2049655b5f643ecf42fdb7341558ab2d3a 100644 (file)
@@ -88,12 +88,18 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
 {
   CORE_ADDR pc = get_frame_pc (this_frame);
   CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
-  const gdb_byte sigreturn[] =
+  const gdb_byte osigreturn[] =
   {
     0x48, 0xc7, 0xc0,
     0x67, 0x00, 0x00, 0x00,    /* movq $SYS_sigreturn, %rax */
     0xcd, 0x80                 /* int $0x80 */
   };
+  const gdb_byte sigreturn[] =
+  {
+    0x48, 0xc7, 0xc0,
+    0x67, 0x00, 0x00, 0x00,    /* movq $SYS_sigreturn, %rax */
+    0x0f, 0x05                 /* syscall */
+  };
   size_t buflen = (sizeof sigreturn) + 1;
   gdb_byte *buf;
   char *name;
@@ -116,9 +122,12 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
 
   /* Check for sigreturn(2).  Depending on how the assembler encoded
      the `movq %rsp, %rdi' instruction, the code starts at offset 6 or
-     7.  */
+     7.  OpenBSD 5.0 and later use the `syscall' instruction.  Older
+     versions use `int $0x80'.  Check for both.  */
   if (memcmp (buf, sigreturn, sizeof sigreturn)
-      && memcpy (buf + 1, sigreturn, sizeof sigreturn))
+      && memcmp (buf + 1, sigreturn, sizeof sigreturn)
+      && memcmp (buf, osigreturn, sizeof osigreturn)
+      && memcmp (buf + 1, osigreturn, sizeof osigreturn))
     return 0;
 
   return 1;
@@ -457,9 +466,6 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   tdep->gregset_num_regs = ARRAY_SIZE (amd64obsd_r_reg_offset);
   tdep->sizeof_gregset = 24 * 8;
 
-  set_gdbarch_regset_from_core_section (gdbarch,
-                                       amd64obsd_regset_from_core_section);
-
   tdep->jb_pc_offset = 7 * 8;
 
   tdep->sigtramp_p = amd64obsd_sigtramp_p;
@@ -478,6 +484,17 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* Unwind kernel trap frames correctly.  */
   frame_unwind_prepend_unwinder (gdbarch, &amd64obsd_trapframe_unwind);
 }
+
+/* Traditional (a.out) NetBSD-style core dumps.  */
+
+static void
+amd64obsd_core_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  amd64obsd_init_abi (info, gdbarch);
+
+  set_gdbarch_regset_from_core_section
+    (gdbarch, amd64obsd_regset_from_core_section);
+}
 \f
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
@@ -494,5 +511,5 @@ _initialize_amd64obsd_tdep (void)
 
   /* OpenBSD uses traditional (a.out) NetBSD-style core dumps.  */
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
-                         GDB_OSABI_NETBSD_AOUT, amd64obsd_init_abi);
+                         GDB_OSABI_NETBSD_AOUT, amd64obsd_core_init_abi);
 }