From patchwork Mon Oct 14 16:15:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34948 Received: (qmail 124309 invoked by alias); 14 Oct 2019 16:16:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123568 invoked by uid 89); 14 Oct 2019 16:15:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=STATE, Non X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Oct 2019 16:15:47 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E56875604C; Mon, 14 Oct 2019 12:15:24 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OjK8kzdqAKOz; Mon, 14 Oct 2019 12:15:24 -0400 (EDT) Received: from murgatroyd.Home (174-29-53-230.hlrn.qwest.net [174.29.53.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 921BB56043; Mon, 14 Oct 2019 12:15:24 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 6/9] Change two windows_thread_info members to "bool" Date: Mon, 14 Oct 2019 10:15:17 -0600 Message-Id: <20191014161520.13150-7-tromey@adacore.com> In-Reply-To: <20191014161520.13150-1-tromey@adacore.com> References: <20191014161520.13150-1-tromey@adacore.com> MIME-Version: 1.0 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. 2019-10-14 Tom Tromey * windows-nat.c (thread_rec) (windows_nat_target::fetch_registers): Update. * nat/windows-nat.h (struct windows_thread_info) : Update comment. : Now bool. gdb/gdbserver/ChangeLog 2019-10-14 Tom Tromey * win32-i386-low.c (update_debug_registers) (i386_prepare_to_resume, i386_thread_added): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/gdbserver/ChangeLog | 5 +++++ gdb/gdbserver/win32-i386-low.c | 6 +++--- gdb/nat/windows-nat.h | 8 +++++--- gdb/windows-nat.c | 4 ++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c index 3fc0cf1cd03..b834b160d9a 100644 --- a/gdb/gdbserver/win32-i386-low.c +++ b/gdb/gdbserver/win32-i386-low.c @@ -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 diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 2fe2a2f0e88..0cfc0716f26 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -46,7 +46,9 @@ 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, 1 means it was called, and + 0 means it was not. */ int suspended = 0; #ifdef _WIN32_WCE @@ -59,11 +61,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; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 210bcfb6f7f..b38ff402cb5 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -400,7 +400,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; } @@ -604,7 +604,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)