gdb/infrun: use switch_to_target_no_thread to switch the target
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 7 Sep 2020 12:40:40 +0000 (14:40 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 7 Sep 2020 13:29:05 +0000 (15:29 +0200)
Use the available `switch_to_target_no_thread` function to switch the
target.  This is a refactoring.

gdb/ChangeLog:
2020-09-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* infrun.c (fetch_inferior_event): Use
`switch_to_target_no_thread` to switch the target.

gdb/ChangeLog
gdb/infrun.c

index 65fc9550dd3e03ebbedb9d77761b8ee0f554bee7..788f4e6014d6ef36a9ebd9097b7af34f16316d01 100644 (file)
@@ -1,3 +1,8 @@
+2020-09-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       * infrun.c (fetch_inferior_event): Use
+       `switch_to_target_no_thread` to switch the target.
+
 2020-09-06  Tom Tromey  <tom@tromey.com>
 
        * symfile.h (dwarf2_free_objfile): Don't declare.
index 938bc081a1c96ab0551046b6cccc777bd40dd78e..82ec30086a96dc4fb5d1ce1031595e578ddf11d0 100644 (file)
@@ -3903,13 +3903,8 @@ fetch_inferior_event ()
     gdb_assert (ecs->ws.kind != TARGET_WAITKIND_IGNORE);
 
     /* Switch to the target that generated the event, so we can do
-       target calls.  Any inferior bound to the target will do, so we
-       just switch to the first we find.  */
-    for (inferior *inf : all_inferiors (ecs->target))
-      {
-       switch_to_inferior_no_thread (inf);
-       break;
-      }
+       target calls.  */
+    switch_to_target_no_thread (ecs->target);
 
     if (debug_infrun)
       print_target_wait_results (minus_one_ptid, ecs->ptid, &ecs->ws);