From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KFRaAQrm/WPLeAAAWB0awg (envelope-from ) for ; Tue, 28 Feb 2023 06:31:22 -0500 Received: by simark.ca (Postfix, from userid 112) id 037091E222; Tue, 28 Feb 2023 06:31:22 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=lyESqdkZ; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4A6531E221 for ; Tue, 28 Feb 2023 06:31:21 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F3094384841B for ; Tue, 28 Feb 2023 11:31:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3094384841B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677583881; bh=9p5+yzl4UhWrLjn5GC7CJluxXQ5kiffD9Qs2pm3clUE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lyESqdkZECg3oTa7DZQ+nFd8Xst1nOMwDwRrG8nvctwW/O23y3D1p8cbmrI8gcRYc +ffFCpauiBKGrZoW3shLITyXkKBqpc1pKI5E2l2JXOtz5USKgqq41kVp33pnhCUhge +N71krMFc8B4tSqV0l74Dxz56yR3bQwHxu5KBb18= Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id 096C8384F4AE for ; Tue, 28 Feb 2023 11:30:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 096C8384F4AE X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="420374109" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="420374109" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:30:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="848213625" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="848213625" Received: from ultl2604.iul.intel.com (HELO localhost) ([172.28.48.47]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:30:24 -0800 To: gdb-patches@sourceware.org Subject: [PATCH 16/26] gdbserver: boolify regcache fields Date: Tue, 28 Feb 2023 12:28:14 +0100 Message-Id: <9bbbc603a5966c9440bfa12484ced476bb80a3fa.1677582745.git.tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tankut Baris Aktemur via Gdb-patches Reply-To: Tankut Baris Aktemur Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The registers_valid and registers_owned fields of the regcache struct are of type int. Make them bool. --- gdbserver/regcache.cc | 12 ++++++------ gdbserver/regcache.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc index 0c6f1eb392b..4b56750d06a 100644 --- a/gdbserver/regcache.cc +++ b/gdbserver/regcache.cc @@ -57,7 +57,7 @@ get_thread_regcache (struct thread_info *thread, bool fetch) void regcache::fetch () { - if (registers_valid == 0) + if (!registers_valid) { scoped_restore_current_thread restore_thread; gdb_assert (this->thread != nullptr); @@ -66,7 +66,7 @@ regcache::fetch () /* Invalidate all registers, to prevent stale left-overs. */ memset (register_status, REG_UNAVAILABLE, tdesc->reg_defs.size ()); fetch_inferior_registers (this, -1); - registers_valid = 1; + registers_valid = true; } } @@ -128,7 +128,7 @@ regcache_invalidate (void) void regcache::discard () { - registers_valid = 0; + registers_valid = false; } void @@ -145,7 +145,7 @@ regcache::initialize (const target_desc *tdesc, this->tdesc = tdesc; this->registers = (unsigned char *) xcalloc (1, tdesc->registers_size); - this->registers_owned = 1; + this->registers_owned = true; this->register_status = (unsigned char *) xmalloc (tdesc->reg_defs.size ()); memset ((void *) this->register_status, REG_UNAVAILABLE, @@ -158,13 +158,13 @@ regcache::initialize (const target_desc *tdesc, { this->tdesc = tdesc; this->registers = regbuf; - this->registers_owned = 0; + this->registers_owned = false; #ifndef IN_PROCESS_AGENT this->register_status = nullptr; #endif } - this->registers_valid = 0; + this->registers_valid = false; } #ifndef IN_PROCESS_AGENT diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h index ceef28086ce..f155ac631eb 100644 --- a/gdbserver/regcache.h +++ b/gdbserver/regcache.h @@ -41,8 +41,8 @@ struct regcache : public reg_buffer_common register cache is _not_ pass-through, unlike GDB's. Note that "valid" here is unrelated to whether the registers are available in a traceframe. For that, check REGISTER_STATUS below. */ - int registers_valid = 0; - int registers_owned = 0; + bool registers_valid = false; + bool registers_owned = false; unsigned char *registers = nullptr; #ifndef IN_PROCESS_AGENT /* One of REG_UNAVAILABLE or REG_VALID. */ -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928