aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-10 10:53:36 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-10 11:02:00 -0400
commite84ffe7bcf2f718a492fc3645785a7705fde6d23 (patch)
tree986d5311b1a98354b8cda3cdedc06f93f7b2c667 /gdb/remote.c
parent92b98b378a4ab0f051342c97b3f4be561a7c89a5 (diff)
downloadgdb-e84ffe7bcf2f718a492fc3645785a7705fde6d23.zip
gdb-e84ffe7bcf2f718a492fc3645785a7705fde6d23.tar.gz
gdb-e84ffe7bcf2f718a492fc3645785a7705fde6d23.tar.bz2
gdb: add remote_state::{is_async_p,can_async_p}
A subsequent patch will want to know if the remote is async within a remote_state method. Add a helper method for that, and for "can async" as well, for symmetry. Change-Id: Id0f648ee4896736479fa942f5453eeeb0e5d4352 Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index cc767ef..5f12f93 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -439,6 +439,20 @@ public:
::delete_async_event_handler (&m_async_event_handler_token);
}
+ bool is_async_p () const
+ {
+ /* We're async whenever the serial device is. */
+ gdb_assert (this->remote_desc != nullptr);
+ return serial_is_async_p (this->remote_desc);
+ }
+
+ bool can_async_p () const
+ {
+ /* We can async whenever the serial device can. */
+ gdb_assert (this->remote_desc != nullptr);
+ return serial_can_async_p (this->remote_desc);
+ }
+
public: /* data */
/* A buffer to use for incoming packets, and its current size. The
@@ -14858,16 +14872,14 @@ remote_target::can_async_p ()
gdb_assert (target_async_permitted);
/* We're async whenever the serial device can. */
- struct remote_state *rs = get_remote_state ();
- return serial_can_async_p (rs->remote_desc);
+ return get_remote_state ()->can_async_p ();
}
bool
remote_target::is_async_p ()
{
/* We're async whenever the serial device is. */
- struct remote_state *rs = get_remote_state ();
- return serial_is_async_p (rs->remote_desc);
+ return get_remote_state ()->is_async_p ();
}
/* Pass the SERIAL event on and up to the client. One day this code