]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Change target_ops::async to accept bool
authorTom Tromey <tromey@adacore.com>
Tue, 19 Jul 2022 19:07:32 +0000 (13:07 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 22 Jul 2022 17:06:51 +0000 (11:06 -0600)
This changes the parameter of target_ops::async from int to bool.
Regression tested on x86-64 Fedora 34.

15 files changed:
gdb/fbsd-nat.c
gdb/fbsd-nat.h
gdb/inf-loop.c
gdb/inf-ptrace.c
gdb/infcmd.c
gdb/infrun.c
gdb/linux-nat.c
gdb/linux-nat.h
gdb/record-btrace.c
gdb/record-full.c
gdb/remote.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h
gdb/top.c

index 32b289f3bbc1e58c99d4bc2fb74f618020d3e662..398f1c18b3325611ddc01dfd6a121cad9a5fb352 100644 (file)
@@ -971,9 +971,9 @@ handle_target_event (int error, gdb_client_data client_data)
 /* Implement the "async" target method.  */
 
 void
-fbsd_nat_target::async (int enable)
+fbsd_nat_target::async (bool enable)
 {
-  if ((enable != 0) == is_async_p ())
+  if (enable == is_async_p ())
     return;
 
   /* Block SIGCHILD while we create/destroy the pipe, as the handler
index 3a13bc8711f12a6e553e5350d2606ea22b20b477..eb7d29dd2a3e164eec2b4d28d7083eb48a9bf1b9 100644 (file)
@@ -68,7 +68,7 @@ public:
 
   bool can_async_p () override;
 
-  void async (int) override;
+  void async (bool) override;
 
   thread_control_capabilities get_thread_control_capabilities () override
   { return tc_schedlock; }
index 41ca17ad62a9e2d5871981be42ef4d7c88977575..2ae534b2f5ccc820676209534e5509c558cea4e6 100644 (file)
@@ -48,7 +48,7 @@ inferior_event_handler (enum inferior_event_type event_type)
             so that when the inferior is not running we don't get
             distracted by spurious inferior output.  */
          if (target_has_execution () && target_can_async_p ())
-           target_async (0);
+           target_async (false);
        }
 
       /* Do all continuations associated with the whole inferior (not
index b9767978744e0f4cac5edb42abf88d101ac9dbe0..8995ef517dddd4d6ee6530c0318ee375770d03bf 100644 (file)
@@ -538,7 +538,7 @@ inf_ptrace_target::close ()
 {
   /* Unregister from the event loop.  */
   if (is_async_p ())
-    async (0);
+    async (false);
 
   inf_child_target::close ();
 }
index 17d15534356ac08dd3c5718abcd3964c9328802f..69a7896b56002c48eba9872982589309a3942ebd 100644 (file)
@@ -2605,7 +2605,7 @@ attach_command (const char *args, int from_tty)
 
   /* Enable async mode if it is supported by the target.  */
   if (target_can_async_p ())
-    target_async (1);
+    target_async (true);
 
   /* Set up the "saved terminal modes" of the inferior
      based on what modes we are starting it with.  */
index a59cbe645374d40c1929d29fcb9169d49ebe66aa..543cccc531182de0094e7235b1019bfb8e3f1054 100644 (file)
@@ -2353,7 +2353,7 @@ resume_1 (enum gdb_signal sig)
 
       if (target_can_async_p ())
        {
-         target_async (1);
+         target_async (true);
          /* Tell the event loop we have an event to process. */
          mark_async_event_handler (infrun_async_inferior_event_token);
        }
@@ -4781,7 +4781,7 @@ wait_one ()
            {
              /* If nothing is resumed, remove the target from the
                 event loop.  */
-             target_async (0);
+             target_async (false);
            }
          else if (event.ws.kind () != TARGET_WAITKIND_IGNORE)
            return event;
index 0a93ab5c6ae534125d161eb59859be1fc2c48df1..a2bbd3cbfc812f2353d618e4e049daad7a3c139a 100644 (file)
@@ -1652,7 +1652,7 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
 
       if (target_can_async_p ())
        {
-         target_async (1);
+         target_async (true);
          /* Tell the event loop we have something to process.  */
          async_file_mark ();
        }
@@ -4143,9 +4143,9 @@ handle_target_event (int error, gdb_client_data client_data)
 /* target_async implementation.  */
 
 void
-linux_nat_target::async (int enable)
+linux_nat_target::async (bool enable)
 {
-  if ((enable != 0) == is_async_p ())
+  if (enable == is_async_p ())
     return;
 
   /* Block child signals while we create/destroy the pipe, as their
index 11043c4b9f64c2997dc755600c4dc5132648d894..38e253eff3643c849ff37b46d241f56142761eb3 100644 (file)
@@ -87,7 +87,7 @@ public:
   bool supports_non_stop () override;
   bool always_non_stop_p () override;
 
-  void async (int) override;
+  void async (bool) override;
 
   void stop (ptid_t) override;
 
index 3f8a69dd04f5cd4b9ddc1f713168d1b617afead2..3a56925f63e48fda1ba3c4eb66876a0c98fc00ec 100644 (file)
@@ -62,7 +62,7 @@ public:
   strata stratum () const override { return record_stratum; }
 
   void close () override;
-  void async (int) override;
+  void async (bool) override;
 
   void detach (inferior *inf, int from_tty) override
   { record_detach (this, inf, from_tty); }
@@ -456,7 +456,7 @@ record_btrace_target::close ()
 /* The async method of target record-btrace.  */
 
 void
-record_btrace_target::async (int enable)
+record_btrace_target::async (bool enable)
 {
   if (enable)
     mark_async_event_handler (record_btrace_async_inferior_event_handler);
@@ -2187,7 +2187,7 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
   /* Async support.  */
   if (target_can_async_p ())
     {
-      target_async (1);
+      target_async (true);
       mark_async_event_handler (record_btrace_async_inferior_event_handler);
     }
 }
index 38e021529c7bea19a8bd90c6919476650f153d61..48b92281fe6fcba0d0eb324e7df86eaa3fdf14cd 100644 (file)
@@ -223,7 +223,7 @@ public:
   strata stratum () const override { return record_stratum; }
 
   void close () override;
-  void async (int) override;
+  void async (bool) override;
   ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
   bool stopped_by_watchpoint () override;
   bool stopped_data_address (CORE_ADDR *) override;
@@ -1017,7 +1017,7 @@ record_full_base_target::close ()
 /* "async" target method.  */
 
 void
-record_full_base_target::async (int enable)
+record_full_base_target::async (bool enable)
 {
   if (enable)
     mark_async_event_handler (record_full_async_inferior_event_token);
index ed834228829be2f2024d7af1c52a9a9736344709..f91973458ea6ad4a61cdf36956f75e33fa38954d 100644 (file)
@@ -537,7 +537,7 @@ public:
 
   bool is_async_p () override;
 
-  void async (int) override;
+  void async (bool) override;
 
   int async_wait_fd () override;
 
@@ -4649,8 +4649,8 @@ remote_target::process_initial_stop_replies (int from_tty)
           the poll in stop_all_threads to consider events from it, so enable
           it temporarily.  */
        gdb_assert (!this->is_async_p ());
-       SCOPE_EXIT { target_async (0); };
-       target_async (1);
+       SCOPE_EXIT { target_async (false); };
+       target_async (true);
        stop_all_threads ("remote connect in all-stop");
       }
 
@@ -5018,7 +5018,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
       process_initial_stop_replies (from_tty);
 
       if (target_can_async_p ())
-       target_async (1);
+       target_async (true);
     }
 
   /* Give the target a chance to look up symbols.  */
@@ -10451,7 +10451,7 @@ extended_remote_target::create_inferior (const char *exec_file,
   /* If running asynchronously, register the target file descriptor
      with the event loop.  */
   if (target_can_async_p ())
-    target_async (1);
+    target_async (true);
 
   /* Disable address space randomization if requested (and supported).  */
   if (supports_disable_randomization ())
@@ -14495,7 +14495,7 @@ remote_target::async_wait_fd ()
 }
 
 void
-remote_target::async (int enable)
+remote_target::async (bool enable)
 {
   struct remote_state *rs = get_remote_state ();
 
index 8a9986454dd4fadc9a7c98dbe5a3b9c4af65fd79..b6628c4d0be69dd89325d171d5afd9874592a72c 100644 (file)
@@ -101,7 +101,7 @@ struct dummy_target : public target_ops
   bool attach_no_wait () override;
   bool can_async_p () override;
   bool is_async_p () override;
-  void async (int arg0) override;
+  void async (bool arg0) override;
   int async_wait_fd () override;
   bool has_pending_events () override;
   void thread_events (int arg0) override;
@@ -275,7 +275,7 @@ struct debug_target : public target_ops
   bool attach_no_wait () override;
   bool can_async_p () override;
   bool is_async_p () override;
-  void async (int arg0) override;
+  void async (bool arg0) override;
   int async_wait_fd () override;
   bool has_pending_events () override;
   void thread_events (int arg0) override;
@@ -2156,24 +2156,24 @@ debug_target::is_async_p ()
 }
 
 void
-target_ops::async (int arg0)
+target_ops::async (bool arg0)
 {
   this->beneath ()->async (arg0);
 }
 
 void
-dummy_target::async (int arg0)
+dummy_target::async (bool arg0)
 {
   tcomplain ();
 }
 
 void
-debug_target::async (int arg0)
+debug_target::async (bool arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ());
   this->beneath ()->async (arg0);
   gdb_printf (gdb_stdlog, "<- %s->async (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  target_debug_print_bool (arg0);
   gdb_puts (")\n", gdb_stdlog);
 }
 
index 18e53aa5d2768638513173243d62ec1ac459a5c8..41144901fc191bd80c2eb4714605b1a4cb06121c 100644 (file)
@@ -2675,7 +2675,7 @@ target_resume (ptid_t scope_ptid, int step, enum gdb_signal signal)
   clear_inline_frame_state (curr_target, scope_ptid);
 
   if (target_can_async_p ())
-    target_async (1);
+    target_async (true);
 }
 
 /* See target.h.  */
@@ -4352,7 +4352,7 @@ maintenance_print_target_stack (const char *cmd, int from_tty)
 /* See target.h.  */
 
 void
-target_async (int enable)
+target_async (bool enable)
 {
   /* If we are trying to enable async mode then it must be the case that
      async mode is possible for this target.  */
index 18559feef89f4d3a1f400229285d321cdc97eed9..7e52716a9e83303095b6e923bf823e1b418944d9 100644 (file)
@@ -713,7 +713,7 @@ struct target_ops
       TARGET_DEFAULT_RETURN (false);
     virtual bool is_async_p ()
       TARGET_DEFAULT_RETURN (false);
-    virtual void async (int)
+    virtual void async (bool)
       TARGET_DEFAULT_NORETURN (tcomplain ());
     virtual int async_wait_fd ()
       TARGET_DEFAULT_NORETURN (noprocess ());
@@ -1886,7 +1886,7 @@ extern bool target_can_async_p (struct target_ops *target);
 extern bool target_is_async_p ();
 
 /* Enables/disabled async target events.  */
-extern void target_async (int enable);
+extern void target_async (bool enable);
 
 /* Enables/disables thread create and exit events.  */
 extern void target_thread_events (int enable);
index 60835acd5e5d859c6e98e8f08003e85dee64a2fe..453fa236db1aa79c35da6847055a428bcbb2e5a1 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1109,7 +1109,7 @@ public:
     current_ui->secondary_prompt_depth++;
 
     if (m_target_is_async_orig)
-      target_async (0);
+      target_async (false);
   }
 
   ~gdb_readline_wrapper_cleanup ()
@@ -1138,7 +1138,7 @@ public:
     saved_after_char_processing_hook = NULL;
 
     if (m_target_is_async_orig)
-      target_async (1);
+      target_async (true);
   }
 
   DISABLE_COPY_AND_ASSIGN (gdb_readline_wrapper_cleanup);