This commit moves the target_async_permitted check out of each targets
::can_async_p method and into the target_can_async_p wrapper function.
I've left some asserts in the two ::can_async_p methods that I
changed, which will hopefully catch any direct calls to these methods
that might be added in the future.
There should be no user visible changes after this commit.
bool
linux_nat_target::can_async_p ()
{
- /* We're always async, unless the user explicitly prevented it with the
- "maint set target-async" command. */
- return target_async_permitted;
+ /* This flag should be checked in the common target.c code. */
+ gdb_assert (target_async_permitted);
+
+ /* Otherwise, this targets is always able to support async mode. */
+ return true;
}
bool
bool
remote_target::can_async_p ()
{
- struct remote_state *rs = get_remote_state ();
-
- /* We don't go async if the user has explicitly prevented it with the
- "maint set target-async" command. */
- if (!target_async_permitted)
- return false;
+ /* This flag should be checked in the common target.c code. */
+ gdb_assert (target_async_permitted);
- /* We're async whenever the serial device is. */
+ /* We're async whenever the serial device can. */
+ struct remote_state *rs = get_remote_state ();
return serial_can_async_p (rs->remote_desc);
}
bool
target_can_async_p (struct target_ops *target)
{
+ if (!target_async_permitted)
+ return false;
return target->can_async_p ();
}