From: Simon Marchi Date: Tue, 10 Oct 2023 14:53:36 +0000 (-0400) Subject: gdb: add remote_state::{is_async_p,can_async_p} X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e84ffe7bcf2f718a492fc3645785a7705fde6d23;p=binutils-gdb.git 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 --- diff --git a/gdb/remote.c b/gdb/remote.c index cc767ef6a8a..5f12f93ef4f 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