From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yOvjF7jl/WPLeAAAWB0awg (envelope-from ) for ; Tue, 28 Feb 2023 06:30:00 -0500 Received: by simark.ca (Postfix, from userid 112) id 5D5281E222; Tue, 28 Feb 2023 06:30:00 -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=BAZA2oQP; 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 0F85D1E128 for ; Tue, 28 Feb 2023 06:30:00 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD7F3385843E for ; Tue, 28 Feb 2023 11:29:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD7F3385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677583799; bh=Q2/yHy0xtrnmXxGPHPM2BZLgcPHmjQaX5utx0UUewO0=; 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=BAZA2oQPByDHvH8Z/d3uuN+LYApuk6C3GusqUeqAA5MuaHCaZ4mCYRrfxMSJwMDvG DtaQ165LYCs6Zx24gUATP9P+On3ccxcHb1pcmM8W7kRaawb5eQHRzsslQCyJCy5x5p IzoUPbMHmUE4i0BvX3MbC8Dgn3tkQUHIC+FEzXKs= Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by sourceware.org (Postfix) with ESMTPS id 6896E3858401 for ; Tue, 28 Feb 2023 11:29:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6896E3858401 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="314536342" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="314536342" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:29:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="738120503" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="738120503" Received: from ultl2604.iul.intel.com (HELO localhost) ([172.28.48.47]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:29:10 -0800 To: gdb-patches@sourceware.org Subject: [PATCH 05/26] gdbserver: add a pointer to the owner thread in regcache Date: Tue, 28 Feb 2023 12:28:03 +0100 Message-Id: <5e9fc384d9456c05d12037a4f2f1999b675c19f5.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" Add a back-link in regcache to the thread that owns the regcache. This will help us in future patches to refer to the right thread object without having to rely on the global current_thread pointer. --- gdbserver/regcache.cc | 1 + gdbserver/regcache.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc index 21c2207822c..2a8dc17ed6a 100644 --- a/gdbserver/regcache.cc +++ b/gdbserver/regcache.cc @@ -45,6 +45,7 @@ get_thread_regcache (struct thread_info *thread, bool fetch) regcache = new struct regcache (proc->tdesc); set_thread_regcache_data (thread, regcache); + regcache->thread = thread; } if (fetch && regcache->registers_valid == 0) diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h index 5b2066ced4d..053ed08b20f 100644 --- a/gdbserver/regcache.h +++ b/gdbserver/regcache.h @@ -33,6 +33,9 @@ struct regcache : public reg_buffer_common /* The regcache's target description. */ const struct target_desc *tdesc = nullptr; + /* Back-link to the thread to which this regcache belongs. */ + thread_info *thread = nullptr; + /* Whether the REGISTERS buffer's contents are valid. If false, we haven't fetched the registers from the target yet. Not that this register cache is _not_ pass-through, unlike GDB's. Note that -- 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