From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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=1677583751; x=1709119751; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HnpBZvqKcDR9uI2pMM35I5AvxnfJixMpX9aEcpF5ttU=; b=AFDpuVGasZa/AD9OTSLEnKQkFMsnflEPqVPeFIAc+dZ1n+vztCYbV6r8 y/iF+ZoWeDrt0wqaX8uw+uJ3mtojSFe7jsGf+2s6UMKJ8p6aqq+d6duxQ ARMjbjGg5SPdW4GFEG/A09Wiz4hRInFAo4L5p/kvAbLihTxThG/wgnYCM YPQKYxdI+6Wov6iC9exlibw79ZCs6Mlez9wzqtoTeuBpO9Ohv6XB9FgrL 800kZ5eFXSaYBImr++bBdvz8GpgxSw+T6PqQ2fiMKlZCuxPpOFlsWKjS5 BrUau4z6nsGz2pNdd+uVJLoSCaRBft3EuQM/y/+eDm+KTiMcB51kDqSYq w==; 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 From: Tankut Baris Aktemur 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-Spam-Status: No, score=-10.4 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: 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