public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Use bool in thread_events
@ 2024-05-27 21:47 Tom Tromey
  2024-05-28 13:56 ` Simon Marchi
  2024-05-28 19:59 ` Lancelot SIX
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2024-05-27 21:47 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use bool in thread_events
  2024-05-27 21:47 [PATCH] Use bool in thread_events Tom Tromey
@ 2024-05-28 13:56 ` Simon Marchi
  2024-05-28 19:59 ` Lancelot SIX
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2024-05-28 13:56 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 5/27/24 5:47 PM, Tom Tromey wrote:
> This changes target_ops::thread_events and target_thread_events to use
> 'bool'.  The callers were already doing this.
> 
> Tested by rebuilding.

LGTM.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use bool in thread_events
  2024-05-27 21:47 [PATCH] Use bool in thread_events Tom Tromey
  2024-05-28 13:56 ` Simon Marchi
@ 2024-05-28 19:59 ` Lancelot SIX
  1 sibling, 0 replies; 3+ messages in thread
From: Lancelot SIX @ 2024-05-28 19:59 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Mon, May 27, 2024 at 03:47:16PM -0600, Tom Tromey wrote:
> This changes target_ops::thread_events and target_thread_events to use
> 'bool'.  The callers were already doing this.
> 
> Tested by rebuilding.

Hi,

Just FYI, I did also rebuild with the amdgpu support (to catch
amd-dbgapi-target.c), and all looks good to me.

Reviewed-by: Lancelot Six <lancelot.six@amd.com>

Best,
Lancelot.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-28 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-27 21:47 [PATCH] Use bool in thread_events Tom Tromey
2024-05-28 13:56 ` Simon Marchi
2024-05-28 19:59 ` Lancelot SIX

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).