]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Simplify windows_nat_target::resume
authorHannes Domani <ssbssa@yahoo.de>
Fri, 23 Jan 2026 19:07:04 +0000 (20:07 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 23 Jan 2026 19:07:04 +0000 (20:07 +0100)
Now the thread context is only needed for setting the trace bit, so move
the rest out of the with_context lambda.

Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
gdb/windows-nat.c

index a6fd199530cf101c576b128504c701c27d7180b9..32bb8b1cd3ab72fe01eeab10f4ca99ac76e35386 100644 (file)
@@ -1366,18 +1366,15 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 
   /* Get context for currently selected thread.  */
   th = windows_process.thread_rec (inferior_ptid, DONT_INVALIDATE_CONTEXT);
-  if (th)
+  if (th != nullptr && step)
     {
+      /* Single step by setting t bit.  */
+      regcache *regcache = get_thread_regcache (inferior_thread ());
+      struct gdbarch *gdbarch = regcache->arch ();
+      fetch_registers (regcache, gdbarch_ps_regnum (gdbarch));
       windows_process.with_context (th, [&] (auto *context)
        {
-         if (step)
-           {
-             /* Single step by setting t bit.  */
-             regcache *regcache = get_thread_regcache (inferior_thread ());
-             struct gdbarch *gdbarch = regcache->arch ();
-             fetch_registers (regcache, gdbarch_ps_regnum (gdbarch));
-             context->EFlags |= FLAG_TRACE_BIT;
-           }
+         context->EFlags |= FLAG_TRACE_BIT;
        });
     }