[binutils-gdb] Enable async mode on supported targets in target_resume.

John Baldwin jhb@sourceware.org
Tue Feb 22 19:33:35 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38ba82db783e7dde2e73212be71c92872d875e4d

commit 38ba82db783e7dde2e73212be71c92872d875e4d
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Tue Feb 22 11:22:14 2022 -0800

    Enable async mode on supported targets in target_resume.
    
    Enabling async mode above the target layer removes duplicate code in
    ::resume methods of async-capable targets.  Commit 5b6d1e4fa4f
    ("Multi-target support") enabled async mode in do_target_resume after
    target_resume returns which is a step in this direction.  However,
    other callers of target_resume such as target_continue do not enable
    async mode.  Rather than enabling async mode in each of the callers
    after target_resume returns, enable async mode at the end of
    target_resume.

Diff:
---
 gdb/infrun.c | 3 ---
 gdb/target.c | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index a3438d1e5c2..5311822fcb8 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2186,9 +2186,6 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
     target_pass_signals (signal_pass);
 
   target_resume (resume_ptid, step, sig);
-
-  if (target_can_async_p ())
-    target_async (1);
 }
 
 /* Resume the inferior.  SIG is the signal to give the inferior
diff --git a/gdb/target.c b/gdb/target.c
index 548cfad06b2..658698b4e2b 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2673,6 +2673,9 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
      thread's stop_pc as side effect.  */
   set_executing (curr_target, ptid, true);
   clear_inline_frame_state (curr_target, ptid);
+
+  if (target_can_async_p ())
+    target_async (1);
 }
 
 /* See target.h.  */


More information about the Gdb-cvs mailing list