From 2db17c87bd67099921ae78f90f839122041f284a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 27 May 2024 14:12:33 -0600 Subject: Use bool in thread_events This changes target_ops::thread_events and target_thread_events to use 'bool'. The callers were already doing this. Tested by rebuilding. Approved-By: Simon Marchi --- 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 fcde6d2..073270f 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 48ecd36..c95d420 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 4dcbe9e..92b16f7 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -78,7 +78,7 @@ public: 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 42b446c..965427c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -965,7 +965,7 @@ public: 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 5fb1c80..dd20e14 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 a5c92a8..ddf10c2 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 394e377..81de4a6 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. */ -- cgit v1.1