From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [66.216.25.90]) by sourceware.org (Postfix) with ESMTPS id 565363858D20 for ; Tue, 1 Mar 2022 00:24:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 565363858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id BF84C1A84BA9 for ; Mon, 28 Feb 2022 19:24:27 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [RFC PATCH 00/12] FreeBSD/aarch64 hardware watchpoint support Date: Mon, 28 Feb 2022 16:24:07 -0800 Message-Id: <20220301002419.5122-1-jhb@FreeBSD.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Mon, 28 Feb 2022 19:24:28 -0500 (EST) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 01 Mar 2022 00:24:29 -0000 The purpose of this series is to add support for aarch64 hardware breakpoints and watchpoints on FreeBSD. The first five patches are a detour to fix some small issues in the x86 debug register support based on things I saw while porting the aarch64 support over to FreeBSD. Patches 6 and 7 work on splitting out platform-independent aarch64 debug register support from the Linux-specific aarch64 code. Patch 6 has an open question about how best to handle having a platform-specific hook for when debug registers have been changed. Right now we require the platform to supply the function that nat/aarch64-hw-point.c calls. I did not choose to create an equivalent to x86_dr_low, but perhaps that sort of structure, or at least a function pointer should be used instead? There is also some messiness around the Linux-specific kernel_supports_any_contiguous_range workaround in patch 6. One big concern is that while I have tested this on FreeBSD/amd64 and FreeBSD/aarch64, I don't have a way to test this on Linux Aarch64. John Baldwin (12): Remove USE_SIGTRAP_SIGINFO condition for FreeBSD/x86 debug regs support. x86-nat: Use an unordered_map to store per-pid debug reg state. x86-nat: Add x86_lookup_debug_reg_state. Add an x86_fbsd_nat_target mixin class for FreeBSD x86 native targets. fbsd-nat: Add a low_new_fork virtual method. x86-fbsd-nat: Copy debug register state on fork. nat: Split out platform-independent aarch64 debug register support. aarch64: Add an aarch64_nat_target mixin class. fbsd-nat: Add helper routine to fetch siginfo_t for a ptid. fbsd-nat: Add a low_delete_thread virtual method. fbsd-nat: Add a low_prepare_to_resume virtual method. Add support for hardware breakpoints/watchpoints on FreeBSD/Aarch64. gdb/NEWS | 2 + gdb/aarch64-fbsd-nat.c | 260 ++++++++++++- gdb/aarch64-linux-nat.c | 333 +--------------- gdb/aarch64-nat.c | 311 +++++++++++++++ gdb/aarch64-nat.h | 110 ++++++ gdb/amd64-fbsd-nat.c | 20 +- gdb/configure.nat | 12 +- gdb/fbsd-nat.c | 28 +- gdb/fbsd-nat.h | 18 + gdb/i386-fbsd-nat.c | 20 +- gdb/nat/aarch64-hw-point.c | 625 +++++++++++++++++++++++++++++++ gdb/nat/aarch64-hw-point.h | 127 +++++++ gdb/nat/aarch64-linux-hw-point.c | 605 +----------------------------- gdb/nat/aarch64-linux-hw-point.h | 105 +----- gdb/nat/aarch64-linux.c | 4 +- gdb/x86-fbsd-nat.c | 45 +++ gdb/x86-fbsd-nat.h | 36 ++ gdb/x86-nat.c | 108 ++---- gdb/x86-nat.h | 5 + gdbserver/linux-aarch64-low.cc | 13 +- 20 files changed, 1634 insertions(+), 1153 deletions(-) create mode 100644 gdb/aarch64-nat.c create mode 100644 gdb/aarch64-nat.h create mode 100644 gdb/nat/aarch64-hw-point.c create mode 100644 gdb/nat/aarch64-hw-point.h create mode 100644 gdb/x86-fbsd-nat.c create mode 100644 gdb/x86-fbsd-nat.h -- 2.34.1