From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677583826; x=1709119826; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=zvj2Fhn3k+GHwCYjRNLMtMiuqcFW5jegQ5L4VFberuA=; b=BjMQv/OvuMo0pcm2AeKxYn35Xmd90ZvwYYdmERvXuCglSP1yBzJCAmF7 G5WBwGwt96TxBcsxn0JyRkBAphSwBeZKxNfO1ugBp/ATLboqUIPUkPYAx gnAxeo5X78GxzdVQX7dih3l52FOS+hFP4RxKIdIpEDey5+DcVn34VkNfO mZalPCEuHX1LDuYr8O6fvKW2khwlCD+YwmULnou0Fz3XIXamBlaKReZKE 3FrUarIAlHkKLC6SRmVwV1gzO5N1sKr4QGzcSqjHT8x+dF5GCXbrgprtX N/yqnpEVGQeJnwhbEO2IrbR1zq4vn9lifkZT/Eo4fFkx08WaCKQoLkc6y g==; 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 From: Tankut Baris Aktemur 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-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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