]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Don't enable async mode at the end of target ::resume methods.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 22 Feb 2022 19:22:14 +0000 (11:22 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 22 Feb 2022 19:22:14 +0000 (11:22 -0800)
commit34c9b2b49be0bb0ea3efdc193fc0a8f615775f09
treed0a40b9e917242d4e1de24a08622c4acd89ae547
parent38ba82db783e7dde2e73212be71c92872d875e4d
Don't enable async mode at the end of target ::resume methods.

Now that target_resume always enables async mode after target::resume
returns, these calls are redundant.

The other place that target resume methods are invoked outside of
target_resume are as the beneath target in record_full_wait_1.  In
this case, async mode should already be enabled when supported by the
target before the resume method is invoked due to the following:

  In general, targets which support async mode run as async until
  ::wait returns TARGET_WAITKIND_NO_RESUMED to indicate that there are
  no unwaited for children (either they have exited or are stopped).
  When that occurs, the loop in wait_one disables async mode.  Later
  if a stopped child is resumed, async mode is re-enabled in
  do_target_resume before waiting for the next event.

  In the case of record_full_wait_1, this function is invoked from the
  ::wait target method when fetching an event.  If the underlying
  target supports async mode, then an earlier call to do_target_resume
  to resume the child reporting an event in the loop in
  record_full_wait_1 would have already enabled async mode before
  ::wait was invoked.  In addition, nothing in the code executed in
  the loop in record_full_wait_1 disables async mode.  Async mode is
  only disabled higher in the call stack in wait_one after ::wait
  returns.

  It is also true that async mode can be disabled by an
  INF_EXEC_COMPLETE event passed to inferior_event_handle, but all of
  the places that invoke that are in the gdb core which is "above" a
  target ::wait method.

Note that there is an earlier call to enable async mode in
linux_nat_target::resume.  That call also marks the async event pipe
to report an existing event after enabling async mode, so it needs to
stay.
gdb/linux-nat.c
gdb/record-full.c
gdb/remote.c