gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / gdb / i386-obsd-tdep.c
index 5495c54c67103505b27625c51d5f9f181ebe42c5..3f5606df006413bfedb8ed0e5975b8a3b3430bd4 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for OpenBSD/i386.
 
-   Copyright (C) 1988-2016 Free Software Foundation, Inc.
+   Copyright (C) 1988-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -99,7 +99,7 @@ i386obsd_sigtramp_p (struct frame_info *this_frame)
     {
       /* If we can't read the instructions, return zero.  */
       if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
-                                    buf, buflen))
+                                    {buf, buflen}))
        return 0;
 
       /* Check for sigreturn(2).  */
@@ -190,7 +190,7 @@ static void
 i386obsd_supply_uthread (struct regcache *regcache,
                         int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
   CORE_ADDR sp = 0;
@@ -207,10 +207,10 @@ i386obsd_supply_uthread (struct regcache *regcache,
       sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
 
       /* Adjust the stack pointer such that it looks as if we just
-         returned from _thread_machdep_switch.  */
+        returned from _thread_machdep_switch.  */
       offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
       store_unsigned_integer (buf, 4, byte_order, sp + offset);
-      regcache_raw_supply (regcache, I386_ESP_REGNUM, buf);
+      regcache->raw_supply (I386_ESP_REGNUM, buf);
     }
 
   for (i = 0; i < ARRAY_SIZE (i386obsd_uthread_reg_offset); i++)
@@ -219,13 +219,13 @@ i386obsd_supply_uthread (struct regcache *regcache,
          && (regnum == -1 || regnum == i))
        {
          /* Fetch stack pointer from thread structure (if we didn't
-             do so already).  */
+            do so already).  */
          if (sp == 0)
            sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
 
          /* Read the saved register from the stack frame.  */
          read_memory (sp + i386obsd_uthread_reg_offset[i], buf, 4);
-         regcache_raw_supply (regcache, i, buf);
+         regcache->raw_supply (i, buf);
        }
     }
 }
@@ -234,7 +234,7 @@ static void
 i386obsd_collect_uthread (const struct regcache *regcache,
                          int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
   CORE_ADDR sp = 0;
@@ -248,16 +248,16 @@ i386obsd_collect_uthread (const struct regcache *regcache,
       int offset;
 
       /* Calculate the stack pointer (frame pointer) that will be
-         stored into the thread structure.  */
+        stored into the thread structure.  */
       offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
-      regcache_raw_collect (regcache, I386_ESP_REGNUM, buf);
+      regcache->raw_collect (I386_ESP_REGNUM, buf);
       sp = extract_unsigned_integer (buf, 4, byte_order) - offset;
 
       /* Store the stack pointer.  */
       write_memory_unsigned_integer (sp_addr, 4, byte_order, sp);
 
       /* The stack pointer was (potentially) modified.  Make sure we
-         build a proper stack frame.  */
+        build a proper stack frame.  */
       regnum = -1;
     }
 
@@ -267,12 +267,12 @@ i386obsd_collect_uthread (const struct regcache *regcache,
          && (regnum == -1 || regnum == i))
        {
          /* Fetch stack pointer from thread structure (if we didn't
-             calculate it already).  */
+            calculate it already).  */
          if (sp == 0)
            sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
 
          /* Write the register into the stack frame.  */
-         regcache_raw_collect (regcache, i, buf);
+         regcache->raw_collect (i, buf);
          write_memory (sp + i386obsd_uthread_reg_offset[i], buf, 4);
        }
     }
@@ -391,6 +391,7 @@ i386obsd_trapframe_sniffer (const struct frame_unwind *self,
 }
 
 static const struct frame_unwind i386obsd_trapframe_unwind = {
+  "i386 openbsd trap",
   /* FIXME: kettenis/20051219: This really is more like an interrupt
      frame, but SIGTRAMP_FRAME would print <signal handler called>,
      which really is not what we want here.  */
@@ -442,13 +443,10 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_ilp32_fetch_link_map_offsets);
 }
-\f
-
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-void _initialize_i386obsd_tdep (void);
 
+void _initialize_i386obsd_tdep ();
 void
-_initialize_i386obsd_tdep (void)
+_initialize_i386obsd_tdep ()
 {
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD,
                          i386obsd_init_abi);
This page took 0.025304 seconds and 4 git commands to generate.