public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Use bool in thread_events
Date: Mon, 27 May 2024 15:47:16 -0600	[thread overview]
Message-ID: <20240527214716.98382-1-tom@tromey.com> (raw)

This changes target_ops::thread_events and target_thread_events to use
'bool'.  The callers were already doing this.

Tested by rebuilding.
---
 gdb/amd-dbgapi-target.c |  4 ++--
 gdb/linux-nat.c         |  4 ++--
 gdb/linux-nat.h         |  2 +-
 gdb/remote.c            |  4 ++--
 gdb/target-delegates.c  | 12 ++++++------
 gdb/target.c            |  2 +-
 gdb/target.h            |  4 ++--
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index fcde6d27ffb..073270f0c21 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -269,7 +269,7 @@ struct amd_dbgapi_target final : public target_ops
 
   struct gdbarch *thread_architecture (ptid_t) override;
 
-  void thread_events (int enable) override;
+  void thread_events (bool enable) override;
 
   std::string pid_to_str (ptid_t ptid) override;
 
@@ -1805,7 +1805,7 @@ amd_dbgapi_target::thread_architecture (ptid_t ptid)
 }
 
 void
-amd_dbgapi_target::thread_events (int enable)
+amd_dbgapi_target::thread_events (bool enable)
 {
   m_report_thread_events = enable;
   beneath ()->thread_events (enable);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 48ecd3627ca..c95d420d416 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -279,7 +279,7 @@ struct simple_pid_list
 static struct simple_pid_list *stopped_pids;
 
 /* Whether target_thread_events is in effect.  */
-static int report_thread_events;
+static bool report_thread_events;
 
 static int kill_lwp (int lwpid, int signo);
 
@@ -4618,7 +4618,7 @@ linux_nat_target::fileio_unlink (struct inferior *inf, const char *filename,
 /* Implementation of the to_thread_events method.  */
 
 void
-linux_nat_target::thread_events (int enable)
+linux_nat_target::thread_events (bool enable)
 {
   report_thread_events = enable;
 }
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 4dcbe9e170a..92b16f7414e 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -78,7 +78,7 @@ class linux_nat_target : public inf_ptrace_target
   bool stopped_by_hw_breakpoint () override;
   bool supports_stopped_by_hw_breakpoint () override;
 
-  void thread_events (int) override;
+  void thread_events (bool) override;
 
   bool supports_set_thread_options (gdb_thread_options options) override;
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 42b446c7e27..965427c96a0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -965,7 +965,7 @@ class remote_target : public process_stratum_target
 
   int async_wait_fd () override;
 
-  void thread_events (int) override;
+  void thread_events (bool) override;
 
   bool supports_set_thread_options (gdb_thread_options) override;
 
@@ -15191,7 +15191,7 @@ remote_target::async (bool enable)
 /* Implementation of the to_thread_events method.  */
 
 void
-remote_target::thread_events (int enable)
+remote_target::thread_events (bool enable)
 {
   struct remote_state *rs = get_remote_state ();
   size_t size = get_remote_packet_size ();
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 5fb1c80a9c3..dd20e1404c3 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -105,7 +105,7 @@ struct dummy_target : public target_ops
   void async (bool arg0) override;
   int async_wait_fd () override;
   bool has_pending_events () override;
-  void thread_events (int arg0) override;
+  void thread_events (bool arg0) override;
   bool supports_set_thread_options (gdb_thread_options arg0) override;
   bool supports_non_stop () override;
   bool always_non_stop_p () override;
@@ -282,7 +282,7 @@ struct debug_target : public target_ops
   void async (bool arg0) override;
   int async_wait_fd () override;
   bool has_pending_events () override;
-  void thread_events (int arg0) override;
+  void thread_events (bool arg0) override;
   bool supports_set_thread_options (gdb_thread_options arg0) override;
   bool supports_non_stop () override;
   bool always_non_stop_p () override;
@@ -2165,24 +2165,24 @@ debug_target::has_pending_events ()
 }
 
 void
-target_ops::thread_events (int arg0)
+target_ops::thread_events (bool arg0)
 {
   this->beneath ()->thread_events (arg0);
 }
 
 void
-dummy_target::thread_events (int arg0)
+dummy_target::thread_events (bool arg0)
 {
 }
 
 void
-debug_target::thread_events (int arg0)
+debug_target::thread_events (bool arg0)
 {
   target_debug_printf_nofunc ("-> %s->thread_events (...)", this->beneath ()->shortname ());
   this->beneath ()->thread_events (arg0);
   target_debug_printf_nofunc ("<- %s->thread_events (%s)",
 	      this->beneath ()->shortname (),
-	      target_debug_print_int (arg0).c_str ());
+	      target_debug_print_bool (arg0).c_str ());
 }
 
 bool
diff --git a/gdb/target.c b/gdb/target.c
index a5c92a8a511..ddf10c28e1c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4286,7 +4286,7 @@ target_async (bool enable)
 /* See target.h.  */
 
 void
-target_thread_events (int enable)
+target_thread_events (bool enable)
 {
   current_inferior ()->top_target ()->thread_events (enable);
 }
diff --git a/gdb/target.h b/gdb/target.h
index 394e377d034..81de4a678c3 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -755,7 +755,7 @@ struct target_ops
        potential optimization is missed.  */
     virtual bool has_pending_events ()
       TARGET_DEFAULT_RETURN (false);
-    virtual void thread_events (int)
+    virtual void thread_events (bool)
       TARGET_DEFAULT_IGNORE ();
     /* Returns true if the target supports setting thread options
        OPTIONS, false otherwise.  */
@@ -1920,7 +1920,7 @@ extern bool target_is_async_p ();
 extern void target_async (bool enable);
 
 /* Enables/disables thread create and exit events.  */
-extern void target_thread_events (int enable);
+extern void target_thread_events (bool enable);
 
 /* Returns true if the target supports setting thread options
    OPTIONS.  */
-- 
2.44.0


             reply	other threads:[~2024-05-27 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27 21:47 Tom Tromey [this message]
2024-05-28 13:56 ` Simon Marchi
2024-05-28 19:59 ` Lancelot SIX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240527214716.98382-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).