From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eGSiNa3l/WNbeAAAWB0awg (envelope-from ) for ; Tue, 28 Feb 2023 06:29:49 -0500 Received: by simark.ca (Postfix, from userid 112) id D9C891E9EE; Tue, 28 Feb 2023 06:29:49 -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=yozbjEPV; 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=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 2AE511E128 for ; Tue, 28 Feb 2023 06:29:49 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CDBB33858407 for ; Tue, 28 Feb 2023 11:29:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDBB33858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677583788; bh=nfHlk5N12fQU2lkwlwJ6aiSsQkzwQ7LGpnhqtUbnf90=; 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=yozbjEPVZ7qNa7cxrqE+sie0sIktqq8L+/NbWRWe/5tA428a8HVRvRU9I6q4zwVDJ 1r25vM1+LP/1L4QqP/1hj3haG7VMNSQYxCleAYy8k2OUytFbXwg8auleXCHV7zV9si ZBDIzjGSxk+PhbWSWNkGo/TI+emkF82rL0cGpgsU= Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by sourceware.org (Postfix) with ESMTPS id 5FF9C3851409 for ; Tue, 28 Feb 2023 11:29:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FF9C3851409 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="396679464" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="396679464" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:29:23 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="919748174" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="919748174" Received: from ultl2604.iul.intel.com (HELO localhost) ([172.28.48.47]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:29:23 -0800 To: gdb-patches@sourceware.org Subject: [PATCH 07/26] gdbserver: convert regcache_cpy into regcache::copy_from Date: Tue, 28 Feb 2023 12:28:05 +0100 Message-Id: <4e915141249ac9e6f38b414f702d68755344ff70.1677582744.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" Convert the free `regcache_cpy` function to a method of the regcache struct. --- gdbserver/regcache.cc | 16 ++++++++-------- gdbserver/regcache.h | 5 +++-- gdbserver/tracepoint.cc | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc index 89ecdfec6f3..be01df342bb 100644 --- a/gdbserver/regcache.cc +++ b/gdbserver/regcache.cc @@ -180,19 +180,19 @@ free_register_cache (struct regcache *regcache) #endif void -regcache_cpy (struct regcache *dst, struct regcache *src) +regcache::copy_from (regcache *src) { - gdb_assert (src != NULL && dst != NULL); - gdb_assert (src->tdesc == dst->tdesc); - gdb_assert (src != dst); + gdb_assert (src != nullptr); + gdb_assert (src->tdesc == this->tdesc); + gdb_assert (src != this); - memcpy (dst->registers, src->registers, src->tdesc->registers_size); + memcpy (this->registers, src->registers, src->tdesc->registers_size); #ifndef IN_PROCESS_AGENT - if (dst->register_status != NULL && src->register_status != NULL) - memcpy (dst->register_status, src->register_status, + if (this->register_status != nullptr && src->register_status != nullptr) + memcpy (this->register_status, src->register_status, src->tdesc->reg_defs.size ()); #endif - dst->registers_valid = src->registers_valid; + this->registers_valid = src->registers_valid; } /* Return a reference to the description of register N. */ diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h index 7eae6cb724a..32b3a8dccfc 100644 --- a/gdbserver/regcache.h +++ b/gdbserver/regcache.h @@ -70,9 +70,10 @@ struct regcache : public reg_buffer_common /* Fetch the registers from the target, if not done already. */ void fetch (); -}; -void regcache_cpy (struct regcache *dst, struct regcache *src); + /* Copy the contents of SRC into this regcache. */ + void copy_from (regcache *src); +}; regcache *get_thread_regcache (thread_info *thread, bool fetch = true); diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 82bb74addd1..26003422a70 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -4802,7 +4802,7 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, tregcache.initialize (context_regcache->tdesc, regspace + 1); /* Copy the register data to the regblock. */ - regcache_cpy (&tregcache, context_regcache); + tregcache.copy_from (context_regcache); #ifndef IN_PROCESS_AGENT /* On some platforms, trap-based tracepoints will have the PC -- 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