gas: always add dummy symbols when creating XCOFF sections.
[binutils-gdb.git] / gdb / bsd-uthread.c
index 11ce0f439bfe2458d2b513780227103ac1525dec..f8353f070419c46770d934057a2f9aceed83cfce 100644 (file)
@@ -1,6 +1,6 @@
 /* BSD user-level threads support.
 
-   Copyright (C) 2005-2020 Free Software Foundation, Inc.
+   Copyright (C) 2005-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -53,7 +53,7 @@ struct bsd_uthread_target final : public target_ops
   void fetch_registers (struct regcache *, int) override;
   void store_registers (struct regcache *, int) override;
 
-  ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
+  ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
   void resume (ptid_t, int, enum gdb_signal) override;
 
   bool thread_alive (ptid_t ptid) override;
@@ -231,7 +231,7 @@ bsd_uthread_activate (struct objfile *objfile)
   bsd_uthread_thread_ctx_offset =
     bsd_uthread_lookup_offset ("_thread_ctx_offset", objfile);
 
-  push_target (&bsd_uthread_ops);
+  current_inferior ()->push_target (&bsd_uthread_ops);
   bsd_uthread_active = 1;
   return 1;
 }
@@ -259,11 +259,11 @@ bsd_uthread_deactivate (void)
   if (!bsd_uthread_active)
     return;
 
-  unpush_target (&bsd_uthread_ops);
+  current_inferior ()->unpush_target (&bsd_uthread_ops);
 }
 
 static void
-bsd_uthread_inferior_created (struct target_ops *ops, int from_tty)
+bsd_uthread_inferior_created (inferior *inf)
 {
   bsd_uthread_activate (NULL);
 }
@@ -370,14 +370,14 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
   else
     {
       /* Updating the thread that is currently running; pass the
-         request to the layer beneath.  */
+        request to the layer beneath.  */
       beneath ()->store_registers (regcache, regnum);
     }
 }
 
 ptid_t
 bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
-                         int options)
+                         target_wait_flags options)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   CORE_ADDR addr;
@@ -401,9 +401,9 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
       gdb_byte buf[4];
 
       /* FIXME: For executables linked statically with the threads
-         library, we end up here before the program has actually been
-         executed.  In that case ADDR will be garbage since it has
-         been read from the wrong virtual memory image.  */
+        library, we end up here before the program has actually been
+        executed.  In that case ADDR will be garbage since it has
+        been read from the wrong virtual memory image.  */
       if (target_read_memory (addr, buf, 4) == 0)
        {
          ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
@@ -550,7 +550,10 @@ _initialize_bsd_uthread ()
 {
   bsd_uthread_data = gdbarch_data_register_pre_init (bsd_uthread_init);
 
-  gdb::observers::inferior_created.attach (bsd_uthread_inferior_created);
-  gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded);
-  gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded);
+  gdb::observers::inferior_created.attach (bsd_uthread_inferior_created,
+                                          "bsd-uthread");
+  gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded,
+                                      "bsd-uthread");
+  gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded,
+                                        "bsd-uthread");
 }