From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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=1677583718; x=1709119718; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=S7avPfuSAYp0k7x9l0+7q+NnqBQyDU3LpmNJUjgsP0s=; b=E+UnWyYB75llxrWHkP/uAHD5vvj683ey7wVDWWWRaBkfI+hll2fsqYO2 sG5sRweoYDBgvcyFnS+nSPRlbFRkKFAc92C++0/IfeXzGnebjzS0oLcaY KO2d3e0b1VefmDNUPxbasvyGwe6CK0hkubyi/LIGoc6aDGExAlkYbkMLB 8YAa9vbveCYtJaLNltwc1jw7/3T2N3kPv1D3qlm7BlR53b11F8Sd2OV3k FypLNfs8QcPd00CgwoFfKmJyNEVcQRaLK2yi2VRPCY3qOengfVrPs3vSs cAIFIUHTYHqLdYYpnnJ4+CF+JyftpjpmDXTNuQGXHhDjgxLXjvxwBQsAF A==; 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 From: Tankut Baris Aktemur 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-Spam-Status: No, score=-3.6 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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