From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lt7qI3/l/WNbeAAAWB0awg (envelope-from ) for ; Tue, 28 Feb 2023 06:29:03 -0500 Received: by simark.ca (Postfix, from userid 112) id 834591E222; Tue, 28 Feb 2023 06:29:03 -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=PbdFwOuF; 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 B8F4B1E128 for ; Tue, 28 Feb 2023 06:29:02 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 099583858025 for ; Tue, 28 Feb 2023 11:29:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 099583858025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677583742; bh=KtZnyhSosg8Eln8dCR30G5b68iO5LChxZNMEe/OLiPI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PbdFwOuF79ecmYoYJS0ZuVOZz/83jyFwHTqFj/g3Meg/99dZmfYOdCW9LcqLMjgVK CX3J7j8N94lgDt2ojkGmha4vEh9hZh0Xt3ZfQIYcnqCncSH1jaq1ngNWBdcWd8Ovj+ +qDICD5RzydmYTm2X/dFx8dvXMnCjcvJvPLIrIhI= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by sourceware.org (Postfix) with ESMTPS id A93843858D33 for ; Tue, 28 Feb 2023 11:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A93843858D33 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="335597971" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="335597971" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:28:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="706541625" X-IronPort-AV: E=Sophos;i="5.98,221,1673942400"; d="scan'208";a="706541625" Received: from ultl2604.iul.intel.com (HELO localhost) ([172.28.48.47]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2023 03:28:36 -0800 To: gdb-patches@sourceware.org Subject: [PATCH 00/26] gdbserver: refactor regcache and allow gradually populating Date: Tue, 28 Feb 2023 12:27:58 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 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" Hello, Gdbserver's regcache is defined and used in a way that it is either invalid or fetches all the registers from the target prior to being used. It also seems some regcache functions have two different contracts based on argument values (e.g. a buffer being nullptr). This is an attempt to refactor the regcache in gdbserver to - convert several free functions to methods. - use and update register statuses more consistently. - allow populating register values gradually, instead of having to fetch all register values from the target. The last item above is utilized in our (Intel) downstream debugger. No gdbserver low target is modified to utilize that feature in this series. Regression-tested on X86_64 Linux using the native-gdbserver and native-extended-gdbserver board files. Tankut Baris Aktemur (26): gdbserver: convert init_register_cache into regcache::initialize gdbserver: convert new_register_cache into a regcache constructor gdbserver: by-pass regcache to access tdesc only gdbserver: boolify and defaultize the 'fetch' parameter of get_thread_regcache gdbserver: add a pointer to the owner thread in regcache gdbserver: turn part of get_thread_regcache into regcache::fetch gdbserver: convert regcache_cpy into regcache::copy_from gdbserver: convert free_register_cache into a destructor of regcache gdbserver: extract out regcache::invalidate and regcache::discard gdbserver: convert registers_to_string into regcache::registers_to_string gdbserver: convert registers_from_string into regcache::registers_from_string gdbserver: convert supply_regblock to regcache::supply_regblock gdbserver: convert register_data into regcache::register_data gdbserver: introduce and use regcache::set_register_status gdbserver: check for nullptr condition in regcache::get_register_status gdbserver: boolify regcache fields gdbserver: rename regcache's registers_valid to registers_fetched gdbsupport: fix a typo in a comment in common-regcache.h gdbserver: fix the declared type of register_status in regcache gdbserver: make some regcache fields private gdbserver: use REG_UNKNOWN for a regcache's register statuses gdbserver: zero-out register values in regcache-discard gdbserver: set register statuses in registers_from_string gdbserver: return tracked register status in regcache_raw_read_unsigned gdbserver: refuse null argument in regcache::supply_regblock gdbserver: allow gradually populating and selectively storing a regcache gdbserver/gdbthread.h | 2 +- gdbserver/linux-aarch32-low.cc | 2 +- gdbserver/linux-low.cc | 18 +- gdbserver/linux-ppc-low.cc | 12 +- gdbserver/linux-s390-low.cc | 14 +- gdbserver/linux-x86-low.cc | 9 +- gdbserver/mem-break.cc | 4 +- gdbserver/proc-service.cc | 2 +- gdbserver/regcache.cc | 305 ++++++++++++++++++++------------- gdbserver/regcache.h | 92 ++++++---- gdbserver/remote-utils.cc | 2 +- gdbserver/server.cc | 16 +- gdbserver/tracepoint.cc | 25 ++- gdbserver/win32-low.cc | 2 +- gdbsupport/common-regcache.h | 11 +- 15 files changed, 302 insertions(+), 214 deletions(-) -- 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