From patchwork Fri May 10 05:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 796027 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp668856wra; Thu, 9 May 2024 22:24:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGGJqjPpGjjkBlD5hx7QFIjHfP6kXdMcxfnnZpsvNuYtipYNtm0ixaaErXCs2d0ECUCR5e9Kp+EGtQbWhi5DVv X-Google-Smtp-Source: AGHT+IF+pdSMPt19DzPVAIDrE3Sg8Dlm5/Esyf354cbMmbkAngkbtJ+Dtiek2kgmatItMVt1C1JH X-Received: by 2002:a05:620a:12ce:b0:792:c1a7:1e91 with SMTP id af79cd13be357-792c7598494mr166653085a.18.1715318686745; Thu, 09 May 2024 22:24:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715318686; cv=pass; d=google.com; s=arc-20160816; b=UndiexGtfW28qKhIYfgHR9Xn4x40J64IujTisYKy8jSbckvaxqfE93ceJbtSOMBL/Q eBCKR8mKbsQq6pSYQKprK0gz3lD3/rgmJ0e/XecPRFLygKkJacItQ0LJqZC4HMiukyjD DA5xnwk7NEl+J168sY86c9vpr+K2TdiBj5BP+5uO3jl6WhWmLY2E0yGOdTeLoYY0qZVu 6N3L/QRuZ68/9DK0JMuzLsZ5YLjpmSZsKBwNkPS/HNlQQCm2H2WPidOqgYNhBH8iGKs+ TA/Ols2fawedweWbGe6N1zN6MoSRZErADiDOKItKjDlMvuWCZWJ35ZELXp+ybvj9XckC jr3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=xJ6oNoxgDBFV61kbpwfsgtDUu87HBtyDHNFqrUDvNHA=; fh=fCgs51ICTgFk+vSt57NFPMWoUahXD4XhqjP2ci5WYSU=; b=L9/H+rV7FkhGvJJjxveH2It8nNPn7OwqWG6tktovmjDrKXYKKgttKzBhvwxqQ6VBAg 7D3E3Jski1Xk8oofVHX0aW9WRzYcwBwUo067wYZRLy93nGsEery2+tqXrw7a2O57smvF WYvfh5LIAsH0IO0k8AElDiACx0cPcrsSygQDREsNMJlXFwrWzPeS8k8Csr29XUVnhX6M zZMA6mH01nyZY4KhvaoD0/jY3uZaacjDIItJffehvQJMEuBl1K9HNBix50EU+pePWdPE fhq4+xtwYcf8pyltga2+bS8ZoClN9KQq8+xEUGZdId3UbXV/JG1VQlJuXZn1ku5+ae7z wqew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OXCT6MKq; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-792bf30a8edsi283964285a.259.2024.05.09.22.24.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 22:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OXCT6MKq; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F3573844775 for ; Fri, 10 May 2024 05:24:46 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 8F5673858431 for ; Fri, 10 May 2024 05:24:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F5673858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F5673858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715318656; cv=none; b=mHMJWsSo3ZY5syc5W0mAYF2IWOD49iRTf9eppRbgK58KFf8/NipSVPnCCOJBEDpl35aEpOWLtMsngoUuFmhPGtBTT9gfMBaXbVIca/9KByUFh7n5EzivekTc+HDrARuX+Nv1OsfkB/RojGu9X+8WGkH7hA1ywtrraCBDEaRBglY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715318656; c=relaxed/simple; bh=dNHkXOq+taFpvizINr8w0xtfH5MnTTGAN5RQEJuRrk4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ftuv1jN2Vx6o5K+Lb3DMg4FimnWlYl7vI/HB/dJVPosXlzDwLjx0J+iDrcGzoOIqUE64mZ3kcertKq/UeNU0S4wfwhyyHmOqVot9EiUBjNmNKs3A30S3hGFJkUVJ8GGK6C8SR2XAvZ6VBVmblEhJHd3o/3kPxN6CtNOXHQe1Wok= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1ee7963db64so12698955ad.1 for ; Thu, 09 May 2024 22:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715318652; x=1715923452; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xJ6oNoxgDBFV61kbpwfsgtDUu87HBtyDHNFqrUDvNHA=; b=OXCT6MKqfyau4DOE9yVBjTAD2CdbQZUgELYqJjoVmJRLBQOs5RIkI0nzFGzh1N0y6s 5dvyU/CQTCw/uyEIWp7iUU2eeH8M2I2FH78grjXRvrCfGRgcNN2IQBTuD0wfjmcVypv1 69lM1woEDgIZ98MPTkx4TLYNNdW9WNW74NSowTWiboXK4NzThsD7+me01BBvaRLq+lPX BSRz8sd0fL+HbuJ7WdytsDWRDZUQdkBWu7eyupWddlrQwkBPq5tL1bmbmFCGbFFX9NrT 2E7+BviaQq11uaBm5Lq5ouDMG6/FoNDiE7vTKx6HpjsAgvDwwMHm+lj7fLksTC8kwHfA Nlpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715318652; x=1715923452; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xJ6oNoxgDBFV61kbpwfsgtDUu87HBtyDHNFqrUDvNHA=; b=me7KCEEKn5xTKsntpju9lywNbtMsMWn7nElYkZF5MDiQ4IEGanyumyUzPXvdQr8Crj cPiy3LiLsYRFlkAerkWPmTT+MjW//ytmVqcK7ieMYJK5KuOU8cLfTaycPIpDsKk7Qug0 LzadmGAkF5pJBO7UamfqIuD0caCxSxkpm74Xg8ZE+rve8XrnCQnNlEeuRrt1vdsGuezt louuMOoa/m0z68WjDee1yGhhjFovBptRBwM4//mSxNriQcfBKoncvX60QIcDayChL/Ip LQ3xlIPnROZhuNp6kEP1Px/g78ulk3u14UmGqVJdCz/6Wv2/XmAH1ikZ8weUhsz2IH4d YM6g== X-Gm-Message-State: AOJu0YwMxtMhpZrVr55GLwmILMySPKbrkeL5jStOkmHh+NyByTt9vFW8 ntES1TMI9D3V2RKxVbpu5U23XyQYgmvSqTYhx/L32gdcRFZxlj7ryC0gojmMy1vl3A3HzcfGHGS 7 X-Received: by 2002:a17:902:ecc7:b0:1e8:c994:b55b with SMTP id d9443c01a7336-1ef43d15786mr22825165ad.7.1715318652394; Thu, 09 May 2024 22:24:12 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:9d31:c7dc:c8bd:73d9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c1394b8sm23381785ad.271.2024.05.09.22.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 22:24:11 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Christophe Lyon , Luis Machado Subject: [PATCH v3 0/5] Add support for AArch64 MOPS instructions Date: Fri, 10 May 2024 02:24:03 -0300 Message-ID: <20240510052408.2173579-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patch=linaro.org@sourceware.org Hello, This version is to adapt to Luis' clarification that MOPS instructions don't need to be treated as atomic sequences and can be single-stepped. If the OS reschedules the inferior to a different CPU while a main or epilogue instruction is executed, it will reset the sequence back to the prologue instruction. Therefore patch 1 is now much smaller and only disables displaced stepping on MOPS instructions, since they do need to appear consecutively in memory. Luis suggested relocating the whole sequence as a block. I will implement that suggestion in the near future, but in the mean time I would like to suggest this approach. Patch 4 is the only other one that was changed. The gdb.arch/aarch64-mops-atomic-inst.exp testcase was renamed to gdb.arch/aarch64-mops-single-step.exp, and adjusted to expect the MOPS sequence to reset back to the prologue instruction. Also, a small bug was fixed in its corresponding C file (the bug didn't affect the effectiveness of the test). The other patches are unchanged from v2. Here is the original cover letter for convenience: This patch series implements GDB support for the new instructions in AArch64's MOPS feature. Patch 1 has a small overview. What is needed from GDB is recognizing the MOPS sequences of instructions as atomic so that they can be stepped over during instruction single stepping, and also to avoid doing displaced stepping with them. This is done in patch 1. Patch 2 adds support for the new instructions to the record an replay target. The other patches add testcases to test each of the aspects above, plus one testcase to verify the interaction of the MOPS instructions with watchpoints. Tested on Ubuntu 23.10 aarch64-linux-gnu with no regressions, using the Arm FVP emulator as well as QEMU v8.2. Thiago Jung Bauermann (5): gdb/aarch64: Disable displaced single-step for MOPS instructions gdb/aarch64: Add record support for MOPS instructions. gdb/testsuite: Add gdb.arch/aarch64-mops-watchpoint.exp gdb/testsuite: Add gdb.arch/aarch64-mops-single-step.exp gdb/testsuite: Add gdb.reverse/aarch64-mops.exp gdb/aarch64-tdep.c | 92 +++++++++- .../gdb.arch/aarch64-mops-single-step.c | 73 ++++++++ .../gdb.arch/aarch64-mops-single-step.exp | 132 ++++++++++++++ .../gdb.arch/aarch64-mops-watchpoint.c | 66 +++++++ .../gdb.arch/aarch64-mops-watchpoint.exp | 79 ++++++++ gdb/testsuite/gdb.reverse/aarch64-mops.c | 71 ++++++++ gdb/testsuite/gdb.reverse/aarch64-mops.exp | 171 ++++++++++++++++++ gdb/testsuite/lib/gdb.exp | 61 +++++++ 8 files changed, 742 insertions(+), 3 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-single-step.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp create mode 100644 gdb/testsuite/gdb.reverse/aarch64-mops.c create mode 100644 gdb/testsuite/gdb.reverse/aarch64-mops.exp base-commit: 5021daf303393722f58f4422d7ad53d526aa2d50