[PATCHv2,4/6] gdb: simplify remote_target::is_async_p

Message ID 73d6c2efd1d5c1a8bbd26e30d7eecef176ff463a.1637756330.git.aburgess@redhat.com
State New
Headers show
Series
  • Improve 'maint set target-async off' for remote targets
Related show

Commit Message

Mike Frysinger via Gdb-patches Nov. 24, 2021, 12:22 p.m.
This commit simplifies remote_target::is_async_p by removing the
target_async_permitted check.

In previous commits I have added additional assertions around the
target_async_permitted flag into target.c, as a result we should now
be confident that if target_can_async_p returns false, a target will
never have async mode enabled.  Given this, it should not be necessary
to check target_async_permitted in remote_target::is_async_p, if this
flag is false ::is_async_p should return false anyway.  There is an
assert to this effect in target_is_async_p.

There should be no user visible change after this commit.
---
 gdb/remote.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

-- 
2.25.4

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index 6ecea5b7fd7..25a4d3cab6e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14390,13 +14390,8 @@  remote_target::can_async_p ()
 bool
 remote_target::is_async_p ()
 {
-  struct remote_state *rs = get_remote_state ();
-
-  if (!target_async_permitted)
-    /* We only enable async when the user specifically asks for it.  */
-    return false;
-
   /* We're async whenever the serial device is.  */
+  struct remote_state *rs = get_remote_state ();
   return serial_is_async_p (rs->remote_desc);
 }