Change two windows_thread_info members to "bool"
authorTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:47:57 +0000 (14:47 -0600)
This changes a couple of fields of windows_thread_info to have type
"bool".  It also updates the comment of another field, to clarify the
possible values it can hold.

gdb/ChangeLog
2020-04-08  Tom Tromey  <tromey@adacore.com>

* windows-nat.c (thread_rec)
(windows_nat_target::fetch_registers): Update.
* nat/windows-nat.h (struct windows_thread_info) <suspended>:
Update comment.
<debug_registers_changed, reload_context>: Now bool.

gdbserver/ChangeLog
2020-04-08  Tom Tromey  <tromey@adacore.com>

* win32-i386-low.c (update_debug_registers)
(i386_prepare_to_resume, i386_thread_added): Update.

gdb/ChangeLog
gdb/nat/windows-nat.h
gdb/windows-nat.c
gdbserver/ChangeLog
gdbserver/win32-i386-low.cc

index f0b1f334850ef06fd8f1ea01eb9d7d9cb4a48d0d..6fce48c09a08ca24a6687243fa5a7e21532b5a03 100644 (file)
@@ -1,3 +1,11 @@
+2020-04-08  Tom Tromey  <tromey@adacore.com>
+
+       * windows-nat.c (thread_rec)
+       (windows_nat_target::fetch_registers): Update.
+       * nat/windows-nat.h (struct windows_thread_info) <suspended>:
+       Update comment.
+       <debug_registers_changed, reload_context>: Now bool.
+
 2020-04-08  Tom Tromey  <tromey@adacore.com>
 
        * windows-nat.c (windows_add_thread): Use new.
index a3da268642210e88475541af7074a6948d30b7c9..27fd7ed19dacb15b684e1c773921107935978110 100644 (file)
@@ -48,7 +48,10 @@ struct windows_thread_info
   /* Thread Information Block address.  */
   CORE_ADDR thread_local_base;
 
-  /* Non zero if SuspendThread was called on this thread.  */
+  /* This keeps track of whether SuspendThread was called on this
+     thread.  -1 means there was a failure or that the thread was
+     explicitly not suspended, 1 means it was called, and 0 means it
+     was not.  */
   int suspended = 0;
 
 #ifdef _WIN32_WCE
@@ -67,11 +70,11 @@ struct windows_thread_info
 
   /* Whether debug registers changed since we last set CONTEXT back to
      the thread.  */
-  int debug_registers_changed = 0;
+  bool debug_registers_changed = false;
 
   /* Nonzero if CONTEXT is invalidated and must be re-read from the
      inferior thread.  */
-  int reload_context = 0;
+  bool reload_context = false;
 
   /* The name of the thread, allocated by xmalloc.  */
   char *name = nullptr;
index 715cf602a070f7d0662e0af957ad5d2b9a3e0b95..b7f21cb741d06319a90526f74eab47e1d4ea9f27 100644 (file)
@@ -439,7 +439,7 @@ thread_rec (DWORD id, int get_context)
              }
            else if (get_context < 0)
              th->suspended = -1;
-           th->reload_context = 1;
+           th->reload_context = true;
          }
        return th;
       }
@@ -695,7 +695,7 @@ windows_nat_target::fetch_registers (struct regcache *regcache, int r)
              dr[7] = th->context.Dr7;
            }
        }
-      th->reload_context = 0;
+      th->reload_context = false;
     }
 
   if (r < 0)
index be2f7676628af69307391acda6f8f9563187d772..25b57685d2284e599bdf7e1fc0b222114467cbaa 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-08  Tom Tromey  <tromey@adacore.com>
+
+       * win32-i386-low.c (update_debug_registers)
+       (i386_prepare_to_resume, i386_thread_added): Update.
+
 2020-04-08  Tom Tromey  <tromey@adacore.com>
 
        * win32-low.c (child_add_thread): Use new.
index 29ee49fcd03515f00505ceb7075809a379e875ee..1b78cf98b33bc9b0958a171fe850620815e8aece 100644 (file)
@@ -44,7 +44,7 @@ update_debug_registers (thread_info *thread)
 
   /* The actual update is done later just before resuming the lwp,
      we just mark that the registers need updating.  */
-  th->debug_registers_changed = 1;
+  th->debug_registers_changed = true;
 }
 
 /* Update the inferior's debug register REGNUM from STATE.  */
@@ -253,14 +253,14 @@ i386_prepare_to_resume (windows_thread_info *th)
         FIXME: should we set dr6 also ?? */
       th->context.Dr7 = dr->dr_control_mirror;
 
-      th->debug_registers_changed = 0;
+      th->debug_registers_changed = false;
     }
 }
 
 static void
 i386_thread_added (windows_thread_info *th)
 {
-  th->debug_registers_changed = 1;
+  th->debug_registers_changed = true;
 }
 
 static void
This page took 0.037786 seconds and 4 git commands to generate.