From patchwork Sat May 4 00:05:17 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: 794553 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp985704wrr; Fri, 3 May 2024 17:05:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXy/8HmcAdtP1WUWdacP9YC8pQmLBUHB+6Eno9s++9zyGvWRAGiIMWgOKGRBgREEACVkdOyXLk3U3aEB7wpJb+s X-Google-Smtp-Source: AGHT+IGs0djTL6NHGXCLjzQ0SqKlcv49fNubvzeMCa59mYZ4yxmxkC2WV0dNXtAHO8TUfv7iQGTA X-Received: by 2002:a81:ac5c:0:b0:617:c383:42ac with SMTP id z28-20020a81ac5c000000b00617c38342acmr3993332ywj.51.1714781155353; Fri, 03 May 2024 17:05:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714781155; cv=pass; d=google.com; s=arc-20160816; b=bMOTfgzQnEcyJEeDz1yur9iTr/WyTNwkFnfTZMDMZlrlpH2SjyctY3/CxWcsFZSi8k VSg5XEBbu0bU8rkiW7XpFyrgIBX5SBkIMWkMhZee1j01v8jIAxDYNxANM7gVhswqN1wS ZygiH35ZW40xrH223T5QzvptoXGov/dlieRtdd/rVuyGb6nbbU3FPSS1TaNypZzZ4y7C rLd5suQH+9KdrHmoIlzVD3/IVxkF3sguRj0rYX4DFRPbh3ogv1ltEcDoBG+e8LKr9ek2 3Q+sfHY0lj5j10P6CQjmHyFbMlUxMFr3ksaWIuekFvrfWhQuuXlsHqmyiFA4sPJlpViK 1xYg== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=NTEil/YFBBxjvbmv1jlJQCuCE5xsTpEO3w74pD4l13Y=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=Y/bZuqmPHHgFWBY85IohaV087b2Vju2MkfpGL/wqQU/xzBGfhhI5OLjbeEJJ8p+iDm CpjCoxj+HVR1U8RVYt0/soMUOwDh/B+lp0cOoy+6CmsTyjmKv7cQnHgGI9o7tJ2G0wZs SVzJYTTniSfK8Ir+vns4Z1sShovv34R8tvcyl6K/gFqyQNNif6XegyRoOFl3U3UUaeGc RTH1EbQVdLDhGdsxB5cVfpex39NGz3PN4CTsrLciEdM+wBswyXQnpCYWtctlTh8gthml ClRiqJ0Kwfi8NSCVFFvfq43KY6c0jXt1R0wS3siYzOnN9SyN3ojtVxrkLH4RnnL/tA7V DiNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MocRfM1B; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z7-20020a05622a028700b0043acc860004si4460538qtw.304.2024.05.03.17.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MocRfM1B; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 F00323844044 for ; Sat, 4 May 2024 00:05:54 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 1624F3845BE1 for ; Sat, 4 May 2024 00:05:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1624F3845BE1 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 1624F3845BE1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781132; cv=none; b=kgvj+eOmuXwcEyYPKAc4MrF2lxsrPW1Hg86tM6YVUE80WwUrLKQYmw1AFUoqFJrlEYSuVtlaxLPFxHl1aZWg0J8+UyTurnWl8ib26C16NZc88flBQWsKgI8Hhw3hvjpxA+H1xBZA35LCMTjkjGt7cN04telGU+tH+WF7XCaBbrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781132; c=relaxed/simple; bh=oPUnkaWAJb/Z/PgqT4REWtPLXXoB3Nj48clRJ+r6XwU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Z6LS9iX7L0ZryRP0eymgmOe00w1Gs0XIGph34HAF4T1768hzJVwlyroj8EesyJlbd/2+izCStU6E5FjpJnlw6STD2IBLi17Nrh/Sgl8QCbiG7dBUgGjBHoPFiBJWxnzXDAW4ujGkspuUCNDhrmbBKqdqyr117yg4zdqtz2wrik0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6f453d2c5a1so265586b3a.2 for ; Fri, 03 May 2024 17:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714781129; x=1715385929; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NTEil/YFBBxjvbmv1jlJQCuCE5xsTpEO3w74pD4l13Y=; b=MocRfM1BDSPP2QN7dWDUqLAVCoziPlwKPoaaxrrnOC1+Ry//rAhmmara1FuYwgZh4c Z1PVkypOedCz2na/CC35Jtn7VmrT4PaZ5IRztNterovepx+Awm3S2PykCRYD1wSQzqLY 1peCu0em5+MFKprbrxZl0QdIqWb/HjG4utstS6Oevry0AhVO+AxnxxLd0v7DQ+nKgr31 IU/qdydXNB9JCTseuD+DYBR/KVnQKTQ/xkf/luF/pdlekb580K4H8IzHa8glbd6KkPsv dC+WCK8tNPf3Y2sbHpLYFXx+lTiG6NQlARYO+3O6AdItMZx6PoJECD7pPuzZ/PAxpJyw TsEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714781129; x=1715385929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NTEil/YFBBxjvbmv1jlJQCuCE5xsTpEO3w74pD4l13Y=; b=HYOkghnDdmx2/TGjaEYMUYGnIwDiSMw4mmwEiKb1mnhe/pf6t7qK6r0DaFa7QEuBUw A3ByL6aC+vRfrcVLYNEceyyvqK6F15l9f4NXpIhuzGshr3FqM+k0H9khXQVw4CE3NZfC fQatoZkU4RkSFwUhcjX6Hj1/2A9HrbcOCdT5hRuH9q3AJ87G5ErsFvxUM5b7pZ4+YXrR MkFfKuMhgS3VcTcH2J6d2eB8KRzqCEf+1YVtuJp/Os0J31Se9BHDmh4egGtWf0l3F+bn RBRU8VmEMFNihtGJUnRm5otURn9OCRbOFGIrFH+DLg6WmWc4aMt8hQwiTSU0QpVmssXJ +Idg== X-Gm-Message-State: AOJu0YwV8rnRg+KM+RCjlPYNNXXK1rk2rdB2AIZggzwM1N4QA/RQ0PQS w5ZZYVH+jWIysqrcGwyAHGkBT78yxLC/sI0Yub931mM1xx1Wdp0QXHJu9FnbnvQ+jkx7CsuME6B H X-Received: by 2002:a05:6a21:3a84:b0:1af:8468:5f79 with SMTP id zv4-20020a056a213a8400b001af84685f79mr4367763pzb.16.1714781128815; Fri, 03 May 2024 17:05:28 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:50e3:94e0:79b0:c9f9]) by smtp.gmail.com with ESMTPSA id 200-20020a6301d1000000b006109431806dsm3663899pgb.92.2024.05.03.17.05.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:28 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH 1/5] gdb/aarch64: Implement software single stepping for MOPS instructions Date: Fri, 3 May 2024 21:05:17 -0300 Message-ID: <20240504000521.314531-2-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240504000521.314531-1-thiago.bauermann@linaro.org> References: <20240504000521.314531-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 The AArch64 MOPS (Memory Operation) instructions provide a standardised instruction sequence to perform a memset, memcpy or memmove. A sequence is always composed of three instructions: a prologue instruction, a main instruction and an epilogue instruction. As an illustration, here are the implementations of these memory operations in glibc 2.39: (gdb) disassemble/r Dump of assembler code for function __memset_mops: => 0x0000fffff7e8d780 <+0>: d503201f nop 0x0000fffff7e8d784 <+4>: aa0003e3 mov x3, x0 0x0000fffff7e8d788 <+8>: 19c10443 setp [x3]!, x2!, x1 0x0000fffff7e8d78c <+12>: 19c14443 setm [x3]!, x2!, x1 0x0000fffff7e8d790 <+16>: 19c18443 sete [x3]!, x2!, x1 0x0000fffff7e8d794 <+20>: d65f03c0 ret End of assembler dump. (gdb) disassemble/r Dump of assembler code for function __memcpy_mops: => 0x0000fffff7e8c580 <+0>: d503201f nop 0x0000fffff7e8c584 <+4>: aa0003e3 mov x3, x0 0x0000fffff7e8c588 <+8>: 19010443 cpyfp [x3]!, [x1]!, x2! 0x0000fffff7e8c58c <+12>: 19410443 cpyfm [x3]!, [x1]!, x2! 0x0000fffff7e8c590 <+16>: 19810443 cpyfe [x3]!, [x1]!, x2! 0x0000fffff7e8c594 <+20>: d65f03c0 ret End of assembler dump. (gdb) disassemble/r Dump of assembler code for function __memmove_mops: => 0x0000fffff7e8d180 <+0>: d503201f nop 0x0000fffff7e8d184 <+4>: aa0003e3 mov x3, x0 0x0000fffff7e8d188 <+8>: 1d010443 cpyp [x3]!, [x1]!, x2! 0x0000fffff7e8d18c <+12>: 1d410443 cpym [x3]!, [x1]!, x2! 0x0000fffff7e8d190 <+16>: 1d810443 cpye [x3]!, [x1]!, x2! 0x0000fffff7e8d194 <+20>: d65f03c0 ret End of assembler dump. The Arm Architecture Reference Manual says that "the prologue, main, and epilogue instructions are expected to be run in succession and to appear consecutively in memory". Therefore GDB needs to treat them as an atomic instruction sequence, and also can't do displaced stepping with them. This patch implements support for executing the sequence atomically, and also disables displaced step on them. PR tdep/31666 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31666 --- gdb/aarch64-tdep.c | 107 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 8d0553f3d7cd..e920cea49066 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3444,6 +3444,104 @@ value_of_aarch64_user_reg (const frame_info_ptr &frame, const void *baton) return value_of_register (*reg_p, get_next_frame_sentinel_okay (frame)); } +/* Single step through MOPS instruction sequences on AArch64. */ + +static std::vector +aarch64_software_single_step_mops (struct regcache *regcache, CORE_ADDR loc, + uint32_t insn) +{ + const int insn_size = 4; + struct gdbarch *gdbarch = regcache->arch (); + enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); + uint8_t o0 = bit (insn, 21); + uint8_t op1 = bits (insn, 22, 23); + uint8_t op2 = bits (insn, 12, 15); + + /* Look for the prologue instruction that begins the sequence. */ + + /* CPYFP* */ + if (!((o0 == 0 && op1 == 0) + /* SETP* */ + || (o0 == 0 && op1 == 3 && op2 < 4) + /* CPYP* */ + || (o0 == 1 && op1 == 0) + /* SETGP* */ + || (o0 == 1 && op1 == 3 && op2 < 4))) + /* Prologue instruction not found. */ + return {}; + + /* Now look for the main instruction in the middle of the sequence. */ + + loc += insn_size; + ULONGEST insn_from_memory; + if (!safe_read_memory_unsigned_integer (loc, insn_size, + byte_order_for_code, + &insn_from_memory)) + { + /* Assume we don't have a MOPS sequence, as we couldn't read the + instruction in this location. */ + return {}; + } + + insn = insn_from_memory; + aarch64_inst inst; + if (aarch64_decode_insn (insn, &inst, 1, nullptr) != 0) + return {}; + if (!AARCH64_CPU_HAS_FEATURE (*inst.opcode->avariant, MOPS)) + return {}; + + o0 = bit (insn, 21); + op1 = bits (insn, 22, 23); + op2 = bits (insn, 12, 15); + + /* CPYFM* */ + if (!((o0 == 0 && op1 == 1) + /* SETM* */ + || (o0 == 0 && op1 == 3 && op2 >= 4 && op2 < 8) + /* CPYM* */ + || (o0 == 1 && op1 == 1) + /* SETGM* */ + || (o0 == 1 && op1 == 3 && op2 >= 4 && op2 < 8))) + /* Main instruction not found. */ + return {}; + + /* Now look for the epilogue instruction that ends the sequence. */ + + loc += insn_size; + if (!safe_read_memory_unsigned_integer (loc, insn_size, + byte_order_for_code, + &insn_from_memory)) + { + /* Assume we don't have a MOPS sequence, as we couldn't read the + instruction in this location. */ + return {}; + } + + insn = insn_from_memory; + if (aarch64_decode_insn (insn, &inst, 1, nullptr) != 0) + return {}; + if (!AARCH64_CPU_HAS_FEATURE (*inst.opcode->avariant, MOPS)) + return {}; + + o0 = bit (insn, 21); + op1 = bits (insn, 22, 23); + op2 = bits (insn, 12, 15); + + /* CPYFE* */ + if (!((o0 == 0 && op1 == 2) + /* SETE* (op2 >= 12 is unallocated space) */ + || (o0 == 0 && op1 == 3 && op2 >= 8 && op2 < 12) + /* CPYE* */ + || (o0 == 1 && op1 == 2) + /* SETGE* (op2 >= 12 is unallocated space) */ + || (o0 == 1 && op1 == 3 && op2 >= 8 && op2 < 12))) + /* Epilogue instruction not found. */ + return {}; + + /* Insert breakpoint after the end of the atomic sequence. */ + return { loc + insn_size }; +} + /* Implement the "software_single_step" gdbarch method, needed to single step through atomic sequences on AArch64. */ @@ -3479,6 +3577,9 @@ aarch64_software_single_step (struct regcache *regcache) if (aarch64_decode_insn (insn, &inst, 1, NULL) != 0) return {}; + if (AARCH64_CPU_HAS_FEATURE (*inst.opcode->avariant, MOPS)) + return aarch64_software_single_step_mops (regcache, loc, insn); + /* Look for a Load Exclusive instruction which begins the sequence. */ if (inst.opcode->iclass != ldstexcl || bit (insn, 22) == 0) return {}; @@ -3808,8 +3909,10 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, if (aarch64_decode_insn (insn, &inst, 1, NULL) != 0) return NULL; - /* Look for a Load Exclusive instruction which begins the sequence. */ - if (inst.opcode->iclass == ldstexcl && bit (insn, 22)) + /* Look for a Load Exclusive instruction which begins the sequence, + or for a MOPS instruction. */ + if ((inst.opcode->iclass == ldstexcl && bit (insn, 22)) + || AARCH64_CPU_HAS_FEATURE (*inst.opcode->avariant, MOPS)) { /* We can't displaced step atomic sequences. */ return NULL; From patchwork Sat May 4 00:05:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 794554 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp985806wrr; Fri, 3 May 2024 17:06:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXq5No1JxjPYxLv4UPyp0TzKMXr5e463rPgouWtAmYWVPhgRyJks91dJU3i7Zr7ZO2zho6V2346pbikVQYmaQOj X-Google-Smtp-Source: AGHT+IFpuvNKgdofFeL4r6JalfjXKvxJhosEDPxY0Z2HWK6DLjQ1BG3AnCnx3uqWpUQjC6B7r7PB X-Received: by 2002:a05:6871:5897:b0:23d:9821:2b90 with SMTP id ok23-20020a056871589700b0023d98212b90mr4889468oac.23.1714781174179; Fri, 03 May 2024 17:06:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714781174; cv=pass; d=google.com; s=arc-20160816; b=UtsedBxnKibjKwbXHjJ0Xxn++GXGm/2pKSD3Pn97CUfFbEU6VO0LRFxf/Mnli1ZKXs JH37j6/6luaPGq/goEwls0ocrItxUdMdMvtc/JfOKXamRUMC6n4RmhT+MY1Hk+2MLyzY MgUOROfFO1THVmsbP3jxn3EZ6WSkL1nOnSJdoGowmd77eOKPJgFGPNqbn7+lM+k0nXfP Qx3n38OIq6B3kwn/RicjiDWqv3Is14pntFPXR1YCE3479jaameJJWaxL+mekuj3hoUz5 xhXduknRFoRRT33fbeNDK4gfrdmdLmJaeRi+cW3qcPmScF8jUVplUHxRAgzByPOZpuUn heIQ== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=GvPssLg+IXk2QnJ4msRdqgy9CGdgocoBSD9nbquhNyI=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=ssTsU8OdAqmoQIuZyCQd/ZOVi+HHmVYdqLiYAIwpD3/gRMTiLaKf3D9yxn/3S2kE9Z PodE5WgtROz/ahEhxiU/l7CxLcuaDV68W/1HJoGvsfG6hqHfYOrfF/Ip+Lu5QsKE6rUW Mf6qgv2WePn7T0BMYB8kjYaBavbyi0fkbeWIo6V9Nn6M4q3IkXp7MomyGH4P0OkTeBqf lxn1omfIA/oE0gxl2W8Pxt/eTaz9iI+Ka1eocKY8NtaCJVUnI3Gl6qFixPjJCye6mKWd IJGdDMzSOrjLaR0SoabXZkdl/tj+YuKi5DQv9SHJ9iQ8fuF5wyjKxBeY4DolBRLqiWYr ZR9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N99IaHk3; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b9-20020a05620a04e900b00790f06f5071si4193581qkh.571.2024.05.03.17.06.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N99IaHk3; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 C35B8386F41E for ; Sat, 4 May 2024 00:06:13 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id A31633844750 for ; Sat, 4 May 2024 00:05:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A31633844750 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 A31633844750 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::629 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781140; cv=none; b=BEfwAda0ZDdfxf3VV6tcFZqpMErp5j0EAEB9H1KtFJ46lj6119LchRi15S2gv/CFVxj7RGzf3TAZi913NqE0ttPw1Vf/kPoap67toIh/RdVCRuIN7abDB2uCzWdSCvJgvP5jz6UenYkezZkoCw3bv8jzb/LYYAckWLE3joTopJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781140; c=relaxed/simple; bh=GdOvo9+lnPXC/34Ga/Z0aIgEb0MIIpjGYPU3zk74/P4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=X3/+n+X/vydHyYPAwmHT6v0K2tpMYahyXkQ3LBERft9i6aphWmBDbENAUpHgEdxkVGj2TISm0zMTzJUk2USNNLTUszLpNMN6XHrBRM1170C7j53YOf4TABtTjvwunpckznRozP/e4t9lLU9UrGuo8pYZ2cOCEdtpXlpYPdt0CLI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1ed835f3c3cso1909225ad.3 for ; Fri, 03 May 2024 17:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714781132; x=1715385932; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=GvPssLg+IXk2QnJ4msRdqgy9CGdgocoBSD9nbquhNyI=; b=N99IaHk3Iq2WS+5QIQeCKJv/ClZZjDGvyEhXisqf92pFlB+MxdjggtEt85BpVhVFHt C28yhLlKqY6l3NK6+NfHXDuEaf9ZUnZ5pl9hh8tHXdmGPfl6dtnqERydzkljHEyrrqSz qTC53HQueVIDsAoAuY4dFqF0UC2yxL5eTWRbXQPOug/jROsARTjewHIbcFOU1BdMJUnt K/z0fNTUgEsi0k6lstO0BTcSD35B2a1ZkYQ0pehgpELblpta3+DnNxbItLyz4weGI9ce Ldz9Ig+kHdqg4EI/ZV0dBw7nnx8dicVjWZ+mGnxnk5YNQKmwBW12Axg9r8WrHzFhhQey UOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714781132; x=1715385932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GvPssLg+IXk2QnJ4msRdqgy9CGdgocoBSD9nbquhNyI=; b=q6EjeULT0CsF7cQ99EL57HL4o2NGxfGsMG/PJt80h2ZMtPTBaUvtIImRKiczUIsLR7 PFxYmPACL4zAQFmnnVPPvq35Q+sdRaQhGOkqm+HmyQT/7NzN/hXvuqkHo8aav410XqqU Se3L2rgRvCYZlDrHZxiQNAya8P8uemC+MYaSCw4LsPtdwM2vlfuhxgPKE/c/oB+TVPbx n9OEkhGOMWCc7DDfRgeiNIn0tiox1h23f+o3QFf5JHBXx1e9mHwLqlYeu9mY91SF6cE3 noMOkxMVw9JawE0GlAL59tfs3NzIwAN9PAqvu9BX+SexADnxq5ljnff+xkkqhkoRpL4L c9eg== X-Gm-Message-State: AOJu0YyWpFl6Etk+eJNc7WOrttTmkIIKv+K+LzJ0KeVgQtTxI3BB7X3E RipOBGSkROnTjvsaAqJ4Es+dQYGTI+ITVpjPwkggYTtLKvufQ3E2o/Cf1kg/4eeuY3qm7M4eo0g C X-Received: by 2002:a17:902:e54d:b0:1e6:7731:80 with SMTP id n13-20020a170902e54d00b001e677310080mr5708011plf.11.1714781132478; Fri, 03 May 2024 17:05:32 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:50e3:94e0:79b0:c9f9]) by smtp.gmail.com with ESMTPSA id jb13-20020a170903258d00b001ec4ed47ddesm3869387plb.86.2024.05.03.17.05.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:32 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH 2/5] gdb/aarch64: Add record support for MOPS instructions. Date: Fri, 3 May 2024 21:05:18 -0300 Message-ID: <20240504000521.314531-3-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240504000521.314531-1-thiago.bauermann@linaro.org> References: <20240504000521.314531-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 There are two kinds of MOPS instructions: set instructions and copy instructions. Within each group there are variants with minor differences in how they read or write to memory — e.g., non-temporal read and/or write, unprivileged read and/or write and permutations of those — but they work in the same way in terms of the registers and regions of memory that they modify. PR tdep/31666 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31666 --- gdb/aarch64-tdep.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index e920cea49066..c60c5d6e0ec2 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -5289,6 +5289,86 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r) return AARCH64_RECORD_SUCCESS; } +/* Record handler for Memory Copy and Memory Set instructions. */ + +static unsigned int +aarch64_record_memcopy_memset (aarch64_insn_decode_record *aarch64_insn_r) +{ + if (record_debug) + debug_printf ("Process record: memory copy and memory set\n"); + + uint8_t op1 = bits (aarch64_insn_r->aarch64_insn, 22, 23); + uint8_t op2 = bits (aarch64_insn_r->aarch64_insn, 12, 15); + uint32_t reg_rd = bits (aarch64_insn_r->aarch64_insn, 0, 4); + uint32_t reg_rn = bits (aarch64_insn_r->aarch64_insn, 5, 9); + uint32_t record_buf[3]; + uint64_t record_buf_mem[4]; + + if (op1 != 3) + { + /* Copy instructions. */ + uint32_t reg_rs = bits (aarch64_insn_r->aarch64_insn, 16, 20); + + record_buf[0] = reg_rd; + record_buf[1] = reg_rn; + record_buf[2] = reg_rs; + aarch64_insn_r->reg_rec_count = 3; + + ULONGEST dest_addr; + regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rd, + &dest_addr); + ULONGEST source_addr; + regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rs, + &source_addr); + LONGEST length; + regcache_raw_read_signed (aarch64_insn_r->regcache, reg_rn, + &length); + + /* In a processor using algorithm option A, the length in Rn has an + inverted sign. */ + if (length < 0) + length *= -1; + + record_buf_mem[0] = length; + record_buf_mem[1] = dest_addr; + record_buf_mem[2] = length; + record_buf_mem[3] = source_addr; + aarch64_insn_r->mem_rec_count = 2; + } + else if ((op1 == 3 && op2 < 12) || (op1 == 3 && op2 < 12)) + { + /* Set instructions. */ + record_buf[0] = reg_rd; + record_buf[1] = reg_rn; + aarch64_insn_r->reg_rec_count = 2; + + ULONGEST address; + regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rd, + &address); + + LONGEST length; + regcache_raw_read_signed (aarch64_insn_r->regcache, reg_rn, + &length); + + /* In a processor using algorithm option B, the length in Rn has an + inverted sign. */ + if (length < 0) + length *= -1; + + record_buf_mem[0] = length; + record_buf_mem[1] = address; + aarch64_insn_r->mem_rec_count = 1; + } + else + return AARCH64_RECORD_UNKNOWN; + + MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count, + record_buf_mem); + REG_ALLOC (aarch64_insn_r->aarch64_regs, aarch64_insn_r->reg_rec_count, + record_buf); + return AARCH64_RECORD_SUCCESS; +} + /* Record handler for load and store instructions. */ static unsigned int @@ -5566,6 +5646,10 @@ aarch64_record_load_store (aarch64_insn_decode_record *aarch64_insn_r) if (insn_bits10_11 == 0x01 || insn_bits10_11 == 0x03) record_buf[aarch64_insn_r->reg_rec_count++] = reg_rn; } + /* Memory Copy and Memory Set instructions. */ + else if ((insn_bits24_27 & 1) == 1 && insn_bits28_29 == 1 + && insn_bits10_11 == 1 && !insn_bit21) + return aarch64_record_memcopy_memset (aarch64_insn_r); /* Advanced SIMD load/store instructions. */ else return aarch64_record_asimd_load_store (aarch64_insn_r); From patchwork Sat May 4 00:05:19 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: 794556 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp985832wrr; Fri, 3 May 2024 17:06:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPDUKby7n/rTiurPGpaBOnZk9GAEpCk9WxFI7Ezhr68nwQfxQP8fRDJRUo9K/0GGIekfTUXGpZa8XM+M5a6XbA X-Google-Smtp-Source: AGHT+IEDCnXOweTSE8af2tE50mjmJaOx0/3LKJm44vx3cxM7giIqYGBXe2Z3HPZynmNQu9XVZM4f X-Received: by 2002:a05:620a:c84:b0:78d:6b37:ee7a with SMTP id q4-20020a05620a0c8400b0078d6b37ee7amr3705375qki.50.1714781179858; Fri, 03 May 2024 17:06:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714781179; cv=pass; d=google.com; s=arc-20160816; b=zK6p2ljOpVWPwjaabEx9XfT80mzTvHXX+F+XTAK6HeNnGGZBABe4iOUgBe6wH/5MvU DUuLXcxTChBtu7t1MVu1PXmPFtTILJ3lW/DutLVoE55hH31mqy4KkRzEcVvmL5sFQwst B3CuRTh15bkOIqIiBjOucAWXjXXQ8y4g6zOMr4y7eZtpCE8eZLZJqti8lak5gp930JbB gsudxveM6gndh6jo/ryqqzrPkKd8HctcqjZUS/gvdTQH+WHy+FFA9Q4jUoX1w/klVGOK wEPuDdd5yd1izLmVtUbA7R1pDuZn8P6uZpRT7TbuvQkWIuU7eROaxMcaxP2Y1tckAWBR BXHQ== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=x6tAzyEiM50fLZnGF9T10lQdqQJkOFJz6OH73fa4REs=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=I5LBI7+3iGTAuq1SCOiWR0gHE6IHIicBPFGBIQ3dJOynWGetSZlVarE7A487qeopLb nmfrCGAAIVqRGcUs32PXTeOaHUxh+G0m8Qd6QTTxDF4xt6zWdqHmAnEYUd9Z0/zNR/HC BJujP38r3FqOeEvpzOXLAq1s8U0hfOc8Wd07/2jCQuoUk3fqh6DvfkP/VtF9IEAP1VhS LDN5JktwGkN99Mr+l1O2RhP1iyits8L0U5KE6S9atF5XMMfEjZnTMszslGnbA/zM7FJY Mhykr9veTCGANDtUvOUFkx04pFPAqd15NanVXsvcMZqDwn6pGk9lhtspCqmoeVLzZPM5 2t6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xOHtuWpv; 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 yf13-20020a05620a3bcd00b0078eba18c1e5si4171217qkn.705.2024.05.03.17.06.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:06:19 -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=xOHtuWpv; 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 709FF386F426 for ; Sat, 4 May 2024 00:06:19 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id AEB05384476C for ; Sat, 4 May 2024 00:05:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AEB05384476C 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 AEB05384476C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781140; cv=none; b=PJYrkWHe9A1J5WapwTBy0aaylB0FRCmne/XwQ/f29RNT5cLVlNSxIT0BwvT4oDDYek4AWUF28elGRYQRrFPXzkgQXLCtMjs3YyRZJxQpoSszii5eOWbixjyeWVFTrMAmGqLi4F2GfYr70pGUZq+1E/eUfgUupEtykxUs3ln4yG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781140; c=relaxed/simple; bh=Mk88gP6CXxklUiMRj8QxF6+pEDH7g5U4XoK7QAvC4sU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O7c0/qoIkrvbvmgpoWKJwLA/DAW49heqGwkJO39yKUzzdb8/AHQHEHdY3DY3bFQC7MYGFJQETV7LULRCOEqL+8x89bU6v3jHvKt2XxhNL2K+0keDvwtsp0t349VL6jJsMMPxlkgDbeez5vR5QAUOjTZD2CzzOdhL/uPQxUbglDo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6f453d2c5a1so265655b3a.2 for ; Fri, 03 May 2024 17:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714781136; x=1715385936; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=x6tAzyEiM50fLZnGF9T10lQdqQJkOFJz6OH73fa4REs=; b=xOHtuWpvEAJbXqXwXb11ZmbWEqIRrgQFg+cKPHDpuSQ/hSeVpEUN5t1NSkoc+mDxCV qZz3acDUppCEE/yNvwz/upK6EqyiAvm7OOrPPiL5/ZzOYEgcaaOP+TS4AkXkJkfs/4MI Ohz+qoOiBB2vVRyl6+7xYj5gHfdsu6sAdLUgiZfbuV4cZ2/iOShDbskb31g5kqo6u9xj bPBP14AvFwHNpTj93+NvnDO2a+GBGIh//tuEdDQ63MnoIzkknAU/EFVuKWXv+nIpMU7t S4Q+pzesivsmzW05SICiSbFmKVSp4DOCQQzwwyeMqzHLZdMNxQJsCdOfUeuzmaOXQycR ODPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714781136; x=1715385936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x6tAzyEiM50fLZnGF9T10lQdqQJkOFJz6OH73fa4REs=; b=oJXrJBLS6yszrZyF6UE+/MVB93bYxgcKLjOkenphJJTqY8M+ZSnOJ/eHSXnV1V0BK7 qeWA1Yh30wOHcaoKdds/ipc4JwA32+gIHytIFm6tj0hAIw/lEcnNBjdnfxEOuwugUt8X MGIqLxGYw6Vt7ZTbuaFCRHU+c/bcBv0LyFPB2E/UOGcvTxVkKJu8ibbIx8jp5AlW3Bvn B6OYoWuj2SOkL0o4XJdPXdw+bZZbVt9/x37eQjWNFHmtBi56rt3oF47G6uc/EOrbz+yI 4HNJeYLlGml3g9YOMHpEXu6V6CVFKX9ZKGrJZTPTNcjSPHiiTPAJtml5IdzD89RERTNh Zd5g== X-Gm-Message-State: AOJu0YxZLWxStNwR1o5x2umhUvM0e9EkvI2C1NP0jXHKhiz4MDhr0eYt p48Wk45xkyCWZ6q1MX9vpWElFqZAWXCoINWosLHprVTS7WZ8PnSJYwyI3AkhF4KSvYRj4AOZMKe i X-Received: by 2002:a05:6a00:a1a:b0:6f3:368d:6f64 with SMTP id p26-20020a056a000a1a00b006f3368d6f64mr5474090pfh.2.1714781136521; Fri, 03 May 2024 17:05:36 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:50e3:94e0:79b0:c9f9]) by smtp.gmail.com with ESMTPSA id it21-20020a056a00459500b006f4401df6c9sm3271302pfb.113.2024.05.03.17.05.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:36 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH 3/5] gdb/testsuite: Add gdb.arch/aarch64-mops-watchpoint.exp Date: Fri, 3 May 2024 21:05:19 -0300 Message-ID: <20240504000521.314531-4-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240504000521.314531-1-thiago.bauermann@linaro.org> References: <20240504000521.314531-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 Test behaviour of watchpoints triggered by MOPS instructions. This test is similar to gdb.base/memops-watchpoint.exp, but specifically for MOPS instructions rather than whatever instructions are used in the libc's implementation of memset/memcpy/memmove. There's a separate watched variable for each set of instructions so that the testcase can test whether GDB correctly identified the watchpoint that triggered in each case. --- .../gdb.arch/aarch64-mops-watchpoint.c | 66 ++++++++++++++++ .../gdb.arch/aarch64-mops-watchpoint.exp | 79 +++++++++++++++++++ gdb/testsuite/lib/gdb.exp | 61 ++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c new file mode 100644 index 000000000000..b981f033d210 --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c @@ -0,0 +1,66 @@ +/* This test program is part of GDB, the GNU debugger. + + Copyright 2024 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main (void) +{ + char source[40] __attribute__ ((aligned (8))) + = "This is a relatively long string..."; + char a[40] __attribute__ ((aligned (8))) + = "String to be overwritten with zeroes"; + char b[40] __attribute__ ((aligned (8))) + = "Another string to be memcopied..."; + char c[40] __attribute__ ((aligned (8))) + = "Another string to be memmoved..."; + char *p, *q; + long size, zero; + + /* Break here. */ + p = a; + size = sizeof (a); + zero = 0; + /* memset implemented in MOPS instructions. */ + __asm__ volatile ("setp [%0]!, %1!, %2\n\t" + "setm [%0]!, %1!, %2\n\t" + "sete [%0]!, %1!, %2\n\t" + : "+&r"(p), "+&r"(size) + : "r"(zero) + : "memory"); + + p = b; + q = source; + size = sizeof (b); + /* memmove implemented in MOPS instructions. */ + __asm__ volatile ("cpyp [%0]!, [%1]!, %2!\n\t" + "cpym [%0]!, [%1]!, %2!\n\t" + "cpye [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + p = c; + q = source; + size = sizeof (c); + /* memcpy implemented in MOPS instructions. */ + __asm__ volatile ("cpyfp [%0]!, [%1]!, %2!\n\t" + "cpyfm [%0]!, [%1]!, %2!\n\t" + "cpyfe [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + + return 0; +} diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp new file mode 100644 index 000000000000..9e210602d800 --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp @@ -0,0 +1,79 @@ +# Copyright 2024 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test a binary that uses MOPS (Memory Operations) instructions. +# This test is similar to gdb.base/memops-watchpoint.exp, but specifically +# tests MOPS instructions rather than whatever instructions are used in the +# system libc's implementation of memset/memcpy/memmove. + +require allow_hw_watchpoint_tests allow_aarch64_mops_tests + +standard_testfile + +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + [list debug additional_flags=-march=armv9.3-a]] } { + return -1 +} + +set linespec ${srcfile}:[gdb_get_line_number "Break here"] +if ![runto ${linespec}] { + return -1 +} + +gdb_test "watch -location a\[28\]" \ + "(Hardware w|W)atchpoint ${decimal}: -location a\\\[28\\\]" \ + "set watch on a" +gdb_test "watch -location b\[28\]" \ + "(Hardware w|W)atchpoint ${decimal}: -location b\\\[28\\\]" \ + "set watchpoint on b" +gdb_test "watch -location c\[28\]" \ + "(Hardware w|W)atchpoint ${decimal}: -location c\\\[28\\\]" \ + "set watchpoint on c" + +gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Hardware watchpoint ${decimal}: -location a\\\[28\\\]" \ + "" \ + "Old value = 104 'h'" \ + "New value = 0 '\\\\000'" \ + "$hex in main \\(\\) at .*aarch64-mops-watchpoint.c:$decimal" \ + "${decimal}\\s+__asm__ volatile \\(\"setp.*\\\\n\\\\t\""] \ + "continue until set watchpoint hits" + +gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Hardware watchpoint ${decimal}: -location b\\\[28\\\]" \ + "" \ + "Old value = 101 'e'" \ + "New value = 114 'r'" \ + "$hex in main \\(\\) at .*aarch64-mops-watchpoint.c:$decimal" \ + "${decimal}\\s+__asm__ volatile \\(\"cpyp.*\\\\n\\\\t\""] \ + "continue until cpy watchpoint hits" + +gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Hardware watchpoint ${decimal}: -location c\\\[28\\\]" \ + "" \ + "Old value = 100 'd'" \ + "New value = 114 'r'" \ + "$hex in main \\(\\) at .*aarch64-mops-watchpoint.c:$decimal" \ + "${decimal}\\s+__asm__ volatile \\(\"cpyfp.*\\\\n\\\\t\""] \ + "continue until cpyf watchpoint hits" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index fe3f05c18df9..78c926ac80b6 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4497,6 +4497,67 @@ proc aarch64_supports_sme_svl { length } { return 1 } +# Run a test on the target to see if it supports Aarch64 MOPS (Memory +# Operations) extensions. Return 0 if so, 1 if it does not. Note this causes +# a restart of GDB. + +gdb_caching_proc allow_aarch64_mops_tests {} { + global srcdir subdir gdb_prompt inferior_exited_re + + set me "allow_aarch64_mops_tests" + + if { ![is_aarch64_target]} { + return 0 + } + + # ARMv9.3-A contains the MOPS extension. The test program doesn't use it, + # but take the opportunity to check whether the toolchain knows about MOPS. + set compile_flags "{additional_flags=-march=armv9.3-a}" + + # Compile a program that tests the MOPS feature. + set src { + #include + #include + + #ifndef HWCAP2_MOPS + #define HWCAP2_MOPS (1UL << 43) + #endif + + int main() { + bool mops_supported = getauxval (AT_HWCAP2) & HWCAP2_MOPS; + + return !mops_supported; + } + } + + if {![gdb_simple_compile $me $src executable $compile_flags]} { + return 0 + } + + # Compilation succeeded so now run it via gdb. + clean_restart $obj + gdb_run_cmd + gdb_expect { + -re ".*$inferior_exited_re with code 01.*${gdb_prompt} $" { + verbose -log "\n$me mops support not detected" + set allow_mops_tests 0 + } + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { + verbose -log "\n$me: mops support detected" + set allow_mops_tests 1 + } + default { + warning "\n$me: default case taken" + set allow_mops_tests 0 + } + } + gdb_exit + remote_file build delete $obj + + verbose "$me: returning $allow_mops_tests" 2 + return $allow_mops_tests +} + # A helper that compiles a test case to see if __int128 is supported. proc gdb_int128_helper {lang} { return [gdb_can_simple_compile "i128-for-$lang" { From patchwork Sat May 4 00:05:20 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: 794557 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp986004wrr; Fri, 3 May 2024 17:06:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcfr9XT8SLIBevKE+kUm4utxUyv3mGFn61g06fMOLt0bwMBN63UL72c0l83c5KoZQL91GuvdwNoDUwAQrdPb5H X-Google-Smtp-Source: AGHT+IFpnRyhkUb4p9QmwzsCQqtg72rvyW5QstY+rB8XFdodTqVPfLO/ksWVC6+7gkjBq2ZbebPh X-Received: by 2002:a25:ec0b:0:b0:de5:5706:b959 with SMTP id j11-20020a25ec0b000000b00de55706b959mr4496429ybh.1.1714781213700; Fri, 03 May 2024 17:06:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714781213; cv=pass; d=google.com; s=arc-20160816; b=ty2BdvCFnqEC2UXYBsxII3H7wLUcQwRY2VZPnXO6q3gKxz05EVYmD6G70s6qdf3lnx vMMr/UD3Vfy6lk2FELOntwolqUX1EkG9xlEKCbxxEhg5w9veA2AM3u+yC0y4uU/cPDfd lDaubcZb+LKe94SJSRa5lCncKxT1Yy6tK5bYiUywQJ4We1tGk4GMyyZieQnWS9tc958Q 7GoPYpyHS11tMjlDGGASfQJ2ujj1rXo3q+hDhBqV8780jZ526J6JNkU8CZubW+ZDpElT f6QgsqR9W0iTM3TtspvExrItn3g1tErbohPX1OyHrFmpESBtudkg6969rib3UPUl3DLv HwXw== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=1MduVO//xrZXadrlceS6ikuP3WfARpTg2oYwtmYhAJc=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=U0hkHHxdsqTGkBe6YZpEZHJakgt5evXZ1+h1554ZxG3iltXt4f6KwC5vUXw5PBGbgJ /fNvQKSyLonLTySr8v/z5DrT/QJtwckCrHMd2m9ntPx28JsG/R9jhttTmVeQIfUiauct QDgIxWSMkozXZ812cmDgQvqLcr2Ujxp82DACMa+xeEEryNXM1EJ3yUzK1VDfaSYS5vCs bfDaZoxpOZlyUzjVXO5VIkXTO1f4Hcl2SXYeVFiq/H1+O2nWUsrWIn3vOBZxON82oAQv +ybN6UnBVtRuqkAT/A9lpRUWIl3Dphxi+2h8jLksWntzlwFF0BRiu5mlcBbZquC1O93G lxaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CbANOAT9; 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 ay32-20020a05622a22a000b00439df8fa2a2si4485915qtb.652.2024.05.03.17.06.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:06:53 -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=CbANOAT9; 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 4F8DC3844073 for ; Sat, 4 May 2024 00:06:53 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id D1B5E3844054 for ; Sat, 4 May 2024 00:05:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1B5E3844054 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 D1B5E3844054 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781143; cv=none; b=Oi9g187Y3kJ3ZMMLK+HCyIFCjdC51YA5GOVnGjeku6cFLC+x9iYEaPwExUn1D+JVlQf4CVNqJR+yxXOW0WfYRdZ7AsQjZZj73+uInIZ1f/0bcSRCnTgUT9j7bMY9NZ5XlqfPLoQfDErj5XrgRcf/MgQOw0DbwdcTG+B4Ko6DU8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781143; c=relaxed/simple; bh=0OXPeMid0ijWsdWT0emEUPY1SOoIVDRrdmKLRpD1xoI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qYwhVf0blPw9hJ6+bxEjYzPxrj12UePby0HDuNW0IhibBwt2qG9yjwdoDPxW1FmNEBIhYhsHiAWII2k9nR1d+kuumrb+hDbLgElC4kav/DL7bJjIsMaPl5NR/6C+ajeb/b5KWxo7nugMxkGZwzRVLUXj1wMRIJJULqCWmCwoflA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e86d56b3bcso2052255ad.1 for ; Fri, 03 May 2024 17:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714781140; x=1715385940; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1MduVO//xrZXadrlceS6ikuP3WfARpTg2oYwtmYhAJc=; b=CbANOAT9T1ZDi/wENYBsXszDjbi6iWLR3uVtkMqu7UfaTH+V5zj54ePWmrJZ1KY2g7 OWTkDfdGjFDxBsWagqE17gdopBNNC6RZEK6uvDVgn/mDn2eMEf/rr2ZIUCAXfBso2d3f QgpqBVBAwQH9/Yo/o7QdoKEMT+rXgZqlKUgi5MYam51XPSuJcHx+jTVbqkDYMr/vA+Ka K/C9ThpteTpoXG86cK8la5GiAMACfoWHu6QtKJpYu2ZScknH8Q7pzkWxOjXOcArx1r+8 568wBI+GqoHwITzQvUje6WcczIkQgQIPqI80LUS/1BWxKG+saVW/8dlEDc6acOi7kfr1 osDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714781140; x=1715385940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1MduVO//xrZXadrlceS6ikuP3WfARpTg2oYwtmYhAJc=; b=s0CHv1BrWXcIHnx4rHjp3Ctw9CLRWpKRQ+5uMGs7so4UBdANmyQJkVJJL0eizOJNCT dFRVDt36d+XyMIMTRLr1FIuH8aRMG0OKaI7y3yQnobbVrbv9GjEuRJslsgWrwhhA28k1 YTubAHY2cu/2GG0PTfWo1bNxIi+wsbqUsiexkRYelJdEKcYj90eHX32qmz77cfM4ARtm C5gymR+GWC7ExNA4rys49P1a9u8hhyc5SX47AEDqdgBMeCN+Zcz9p+869qMv9at9G4qo opM1zy5ygN541zSuulGpLYDOVvESyjkMG6p8aDX4sL+RUqyB8gQJGeGj8vzLhFjRI37A Ithg== X-Gm-Message-State: AOJu0YxYT7Db/nPcwMNzulRhiNdy/8HWGzyVjkmmq6mMk5VvnovqxgL8 cywfQXLmcM25osUTCLPdH97HV4OIMG8+fnRz7WvbTx81lOnUSs7Gg0R/odrnUoooYsT5MkpkeOM 1 X-Received: by 2002:a17:902:9f98:b0:1eb:6468:7fc3 with SMTP id g24-20020a1709029f9800b001eb64687fc3mr3782548plq.62.1714781139800; Fri, 03 May 2024 17:05:39 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:50e3:94e0:79b0:c9f9]) by smtp.gmail.com with ESMTPSA id x13-20020a170902ec8d00b001ecf6d3edb5sm3848163plg.241.2024.05.03.17.05.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:39 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH 4/5] gdb/testsuite: Add gdb.arch/aarch64-mops-atomic-inst.exp Date: Fri, 3 May 2024 21:05:20 -0300 Message-ID: <20240504000521.314531-5-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240504000521.314531-1-thiago.bauermann@linaro.org> References: <20240504000521.314531-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 The testcase verifies that MOPS sequences are stepped over when stepping the inferior instruction by instruction. --- .../gdb.arch/aarch64-mops-atomic-inst.c | 62 ++++++++++++ .../gdb.arch/aarch64-mops-atomic-inst.exp | 97 +++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.exp diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.c b/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.c new file mode 100644 index 000000000000..211cfb21c37c --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.c @@ -0,0 +1,62 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2024 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#define TEST_STRING "Just a test string." +#define BUF_SIZE sizeof(TEST_STRING) + +int main(void) +{ + const char source[BUF_SIZE] = TEST_STRING; + char dest[BUF_SIZE]; + char *p = dest; + const char *q; + const long zero = 0; + long size = BUF_SIZE; + + /* Break memset. */ + /* memset implemented in MOPS instructions. */ + __asm__ volatile ("setp [%0]!, %1!, %2\n\t" + "setm [%0]!, %1!, %2\n\t" + "sete [%0]!, %1!, %2\n\t" + : "+&r"(p), "+&r"(size) + : "r"(zero) + : "memory"); + + p = dest; + q = source; + /* Break memcpy. */ + /* memcpy implemented in MOPS instructions. */ + __asm__ volatile ("cpyfp [%0]!, [%1]!, %2!\n\t" + "cpyfm [%0]!, [%1]!, %2!\n\t" + "cpyfe [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + + p = dest; + q = source; + /* Break memmove. */ + /* memmove implemented in MOPS instructions. */ + __asm__ volatile ("cpyp [%0]!, [%1]!, %2!\n\t" + "cpym [%0]!, [%1]!, %2!\n\t" + "cpye [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + + return 0; +} diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.exp b/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.exp new file mode 100644 index 000000000000..ad74795d5cfd --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-mops-atomic-inst.exp @@ -0,0 +1,97 @@ +# Copyright 2024 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This file is part of the GDB testsuite. + +# Test single stepping through MOPS (memory operations) atomic sequences. + +require allow_aarch64_mops_tests + +standard_testfile +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + [list debug additional_flags=-march=armv9.3-a]] } { + return -1 +} + +proc is_at_instruction { instruction } { + global gdb_prompt hex + + set test "pc points to $instruction" + gdb_test_multiple {x/i $pc} $test { + -re -wrap "=> $hex \[^\r\n\]+:\t$instruction\t\[^\r\n\]+" { + return 1 + } + -re "\r\n$gdb_prompt $" { + return 0 + } + } + + return 0 +} + +proc arrive_at_instruction { instruction } { + set count 0 + + while { [is_at_instruction $instruction] != 1 } { + gdb_test -nopass "nexti" ".*__asm__ volatile.*" \ + "nexti #$count to reach $instruction" + incr count + + if { $count > 50 } { + fail "didn't reach $instruction" + return 0 + } + } + + return 1 +} + +if ![runto_main] { + return -1 +} + +gdb_breakpoint ${srcfile}:[gdb_get_line_number "Break memset"] +gdb_breakpoint ${srcfile}:[gdb_get_line_number "Break memcpy"] +gdb_breakpoint ${srcfile}:[gdb_get_line_number "Break memmove"] + +gdb_continue_to_breakpoint "memset breakpoint" + +if { [arrive_at_instruction setp] } { + # The nexti output isn't useful to detect whether we skipped the sequence. + gdb_test "nexti" "\[^\r\n\]+" "step through the memset sequence" + gdb_assert { [is_at_instruction setm] == 0 \ + && [is_at_instruction sete] == 0 } \ + "stepped through the memset sequence" +} + +gdb_continue_to_breakpoint "memcpy breakpoint" + +if { [arrive_at_instruction cpyfp] } { + # The nexti output isn't useful to detect whether we skipped the sequence. + gdb_test "nexti" "\[^\r\n\]+" "step through the memcpy sequence" + gdb_assert { [is_at_instruction cpyfm] == 0 \ + && [is_at_instruction cpyfe] == 0 } \ + "stepped through the memcpy sequence" +} + +gdb_continue_to_breakpoint "memmove breakpoint" + +if { [arrive_at_instruction cpyp] } { + # The nexti output isn't useful to detect whether we skipped the sequence. + gdb_test "nexti" "\[^\r\n\]+" "step through the memmove sequence" + gdb_assert { [is_at_instruction cpym] == 0 \ + && [is_at_instruction cpye] == 0 } \ + "stepped through the memmove sequence" +} From patchwork Sat May 4 00:05:21 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: 794555 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp985821wrr; Fri, 3 May 2024 17:06:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDZUgxRmNLhFTN7F3+H+KgSpRhuxCaK76MtH+lHnbEOZDXjg5G6rxQ2UGlzFgWd7Ep2MpI0O8JLcVCdC++z7gv X-Google-Smtp-Source: AGHT+IERSxrs2kKczhtA2Kt1AO7SX2oOZCIu0LB8Qcgq83sk2XWA1LJLf/DKRgMT2np7KbDsSxko X-Received: by 2002:ac8:5d8f:0:b0:43b:7:6456 with SMTP id d15-20020ac85d8f000000b0043b00076456mr4322231qtx.34.1714781177123; Fri, 03 May 2024 17:06:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714781177; cv=pass; d=google.com; s=arc-20160816; b=jqoUiyTDfGKG+fz7+YF8DCnzZhajiIEgnSeufRbIrQCTjB4A/B29FaQ2MvA/UPiFob jqkZzy0Sg7KCW/FtGkGWwzegrr8mOd8iXsOJOgqYed1+SXll7/uQ2EQBT3r4UhZX8Tyg ptaxeRm0Xv/0WeM3IbHUsNY9GgNWZZyKDRW+ghyAP1HOXP5wjNuKOJyn6Pw5bvJ9zfrJ N8E1so9lAG4w8X0g4H6Rbm41nyxsr7JPJAG2hpiGTi7LJBW7jRAhmcy8OEPL1hTAp5nS xYivxlkDWHLJ2XhXSi+Nm8yjhLaIcVgOlo9/fhwkXCsY8BDpqtwkaiNx51sKB+AGALFD fr+Q== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=lC+iKXqzQE4y6lKv4irPrPxbDt9vEwmTnGIJRFVo0M0=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=HIEDn4C6jbafqoNHi/4LUBMeR0n+glWEtecvj+yHScDcVYtMWEepctUwagshn7V/MK YwRy7YSAfq1gC+oFFEcs0g2yq26iKPizlvdK8oJn7IiJpNOi4J/l6N6AGVsAVgo3yPBw Ss/9jJNZ6vO8y+Oa9Yo+v4oTI+Ocj5WXzJAeL+RV6bkDryLPTlkMK3kFXK29ATQRDwtw 0HO85PMfKf0Baw2wDMMQBqFF3TCTkinZdX3qsu9RX9awmmm8iz3rdF8Qt3TUh+pXmMDf Fks3eyglwj4haqfcbKVOhuoLUiQ+Hbqz+nLZyBlRrgyq42myQ2vQbOZt7dq+7gd2ZzPv r6yQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HPtszVX8; 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 f4-20020ac859c4000000b0043af4300510si4381741qtf.348.2024.05.03.17.06.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:06:17 -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=HPtszVX8; 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 B0FDF3844040 for ; Sat, 4 May 2024 00:06:16 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 26FA1384404C for ; Sat, 4 May 2024 00:05:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26FA1384404C 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 26FA1384404C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781147; cv=none; b=VyGthXwajls664EdG47eRmGX7n0ZQ+5tneKd2pb9IeLGoWED7G1sm/MJJpFyqo55FzXZEJ4DEuVUWwLk8N8kjNulIBs6v+UE6e/Ey/wDHNyKI8wcmyNYYdcFfBQk6HDfEuoofA9e93VKAeX0uJ8jfk30E8Eg9E/dc1wgG437cMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714781147; c=relaxed/simple; bh=f4Tiahh2xJZ0ucs5/3fb9UyTCLa/mYTUbXxJXfEC+tU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vdPYGa3BCmlLNdY5NNHATI7iAW3DRAz8lyXetCHHWQJ5Hu6sGZ8/AuBNANP3Yn/v96WrDBfkWDFJ+WpE6ZmY0ZMBnSARLEp0+j1+hl1+Ajji1gGVpA4eX0qiC5hbs2CMF22/tZmYFj+jAaBlqRZQfEF6hMNZJo4KM/qJJxvYjTw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so132218a12.1 for ; Fri, 03 May 2024 17:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714781143; x=1715385943; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lC+iKXqzQE4y6lKv4irPrPxbDt9vEwmTnGIJRFVo0M0=; b=HPtszVX8Kx78j6Ptl/mZVa420M0ixVU37iQmYhXEsQlvhxc5u5iFxnPNXpJJnuJf5U uzh3E2QnDUKbRwCkc6Avk2t9BQ86RKXRJc3kvoqscnI7UpgVro4DQJNWPL07aoj/za5E bjXoFjwL5vAvjquTHZZU2tyC8dUq+9y1jSVCuL1L5KOhrj4EaVUIub4+gtX3qF2Qysw6 CbPA73Mg03wh9pybwESjdqq+vf48ql7YVLA821ESH0FO0HfggivvKjkXNb8yyxBgUtNM fsSBV1PNeOg5a5D8G2Vr6lC238XzKbZIWNZE7PxQY/gK5RhNzvNZEGfoO151BeNFF2Vn mAKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714781143; x=1715385943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lC+iKXqzQE4y6lKv4irPrPxbDt9vEwmTnGIJRFVo0M0=; b=iD5QfAils8uP+f4im8EuvAuLIw4U3a3wOpmvKsT9KKzl8qqtAMBtb62p+wJ1iWb8up SuxO/zjcCmT2nzfX6GfAoCmQF9xqdlpRzkqnRlnyxM+s0RVcDjVo/vVMxP63lbNepaoh fnPLRd+uBJ1dTg8HqWJ/3MlTlLDxj4TPLG9pKU7Vsne3QBP+eemYq7A2ymVrCIYVErPU jEYzA72uz6Mkjum1RhIzvz517UNi2yxAyOPLeaSiY0thGv2JYTMI8ZrZiX2x2tvymiHk q4VWGOLKZea/w4VakrsuX2+aCFJQfhyL+UwEmpHHcraJYIvWD0Mz2GvE/r1x3CKjq3aZ Sn5g== X-Gm-Message-State: AOJu0YzyuSLhAF3OIOnEKmkxj3TTnuwaTBRwvDdGVYgiEZL1qru4pDIb kgkrym2Y39h1n5Mx+dzmmeVLOBRK1w5hftc9e1vWFTF77I4SXiOFZjuyLkHGmK/dLZpI2DSjM+F y X-Received: by 2002:a17:90a:c481:b0:2a2:d498:eec2 with SMTP id j1-20020a17090ac48100b002a2d498eec2mr4074440pjt.40.1714781142928; Fri, 03 May 2024 17:05:42 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:50e3:94e0:79b0:c9f9]) by smtp.gmail.com with ESMTPSA id lt10-20020a17090b354a00b002a2f6da006csm3724056pjb.52.2024.05.03.17.05.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:05:42 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH 5/5] gdb/testsuite: Add gdb.reverse/aarch64-mops.exp Date: Fri, 3 May 2024 21:05:21 -0300 Message-ID: <20240504000521.314531-6-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240504000521.314531-1-thiago.bauermann@linaro.org> References: <20240504000521.314531-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 The testcase verifies that MOPS instructions are recorded and correctly reversed. Not all variants of the copy and set instructions are tested, since there are many and the record and replay target processes them in the same way. --- gdb/testsuite/gdb.reverse/aarch64-mops.c | 71 +++++++++ gdb/testsuite/gdb.reverse/aarch64-mops.exp | 171 +++++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 gdb/testsuite/gdb.reverse/aarch64-mops.c create mode 100644 gdb/testsuite/gdb.reverse/aarch64-mops.exp diff --git a/gdb/testsuite/gdb.reverse/aarch64-mops.c b/gdb/testsuite/gdb.reverse/aarch64-mops.c new file mode 100644 index 000000000000..513f324b9dd6 --- /dev/null +++ b/gdb/testsuite/gdb.reverse/aarch64-mops.c @@ -0,0 +1,71 @@ +/* This test program is part of GDB, the GNU debugger. + + Copyright 2024 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#define TEST_STRING "Just a test string." +#define BUF_SIZE sizeof(TEST_STRING) + +int +main (void) +{ + char dest[BUF_SIZE]; + char source[BUF_SIZE] = TEST_STRING; + register char *p asm ("x19"); + register char *q asm ("x20"); + register long size asm ("x21"); + register long zero asm ("x22"); + + p = dest; + size = BUF_SIZE; + zero = 0; + /* Before setp. */ + /* memset implemented in MOPS instructions. */ + __asm__ volatile ("setp [%0]!, %1!, %2\n\t" + "setm [%0]!, %1!, %2\n\t" + "sete [%0]!, %1!, %2\n\t" + : "+&r"(p), "+&r"(size) + : "r"(zero) + : "memory"); + + /* After sete. */ + p = dest; + q = source; + size = BUF_SIZE; + /* Before cpyp. */ + /* memmove implemented in MOPS instructions. */ + __asm__ volatile ("cpyp [%0]!, [%1]!, %2!\n\t" + "cpym [%0]!, [%1]!, %2!\n\t" + "cpye [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + /* After cpye. */ + p = dest; + q = source; + size = BUF_SIZE; + /* Before cpyfp. */ + /* memcpy implemented in MOPS instructions. */ + __asm__ volatile ("cpyfp [%0]!, [%1]!, %2!\n\t" + "cpyfm [%0]!, [%1]!, %2!\n\t" + "cpyfe [%0]!, [%1]!, %2!\n\t" + : "+&r" (p), "+&r" (q), "+&r" (size) + : + : "memory"); + /* After cpyfe. */ + p = dest; + + return 0; +} diff --git a/gdb/testsuite/gdb.reverse/aarch64-mops.exp b/gdb/testsuite/gdb.reverse/aarch64-mops.exp new file mode 100644 index 000000000000..f9c1257e0b11 --- /dev/null +++ b/gdb/testsuite/gdb.reverse/aarch64-mops.exp @@ -0,0 +1,171 @@ +# Copyright 2024 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test instruction record for AArch64 FEAT_MOPS instructions. +# Based on gdb.reverse/ppc_record_test_isa_3_1.exp +# +# The basic flow of the record tests are: +# 1) Stop before executing the instructions of interest. Record +# the initial value of the registers that the instruction will +# change, i.e. the destination register. +# 2) Execute the instructions. Record the new value of the +# registers that changed. +# 3) Reverse the direction of the execution and execute back to +# just before the instructions of interest. Record the final +# value of the registers of interest. +# 4) Check that the initial and new values of the registers are +# different, i.e. the instruction changed the registers as expected. +# 5) Check that the initial and final values of the registers are +# the same, i.e. GDB record restored the registers to their +# original values. + +require allow_aarch64_mops_tests + +standard_testfile + +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + [list debug additional_flags=-march=armv9.3-a]] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +gdb_test_no_output "record full" + +proc do_test { insn_prefix } { + global decimal hex + + set before_seq [gdb_get_line_number "Before ${insn_prefix}p"] + set after_seq [gdb_get_line_number "After ${insn_prefix}e"] + + with_test_prefix $insn_prefix { + gdb_test "break $before_seq" \ + "Breakpoint $decimal at $hex: file .*/aarch64-mops.c, line $decimal\\." \ + "break before instruction sequence" + gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Breakpoint $decimal, main \\(\\) at .*/aarch64-mops.c:$decimal" \ + "$decimal\[ \t\]+__asm__ volatile \\(\"${insn_prefix}p \[^\r\n\]+\""] \ + "about to execute instruction sequence" + + # Record the initial register values. + set x19_initial [capture_command_output "info register x19" ""] + set x21_initial [capture_command_output "info register x21" ""] + + # The set instructions use the ZERO variable, but not Q, and the other + # instructions are the opposite. + if {[string compare $insn_prefix "set"] == 0} { + set x22_initial [capture_command_output "info register x22" ""] + } else { + set x20_initial [capture_command_output "info register x20" ""] + } + + gdb_test "break $after_seq" \ + "Breakpoint $decimal at $hex: file .*/aarch64-mops.c, line $decimal\\." \ + "break after instruction sequence" + gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Breakpoint $decimal, main \\(\\) at .*/aarch64-mops.c:$decimal" \ + "$decimal\[ \t\]+p = dest;"] \ + "executed instruction sequence" + + # Record the new register values. + set x19_new [capture_command_output "info register x19" ""] + set x21_new [capture_command_output "info register x21" ""] + + if {[string compare $insn_prefix "set"] == 0} { + set x22_new [capture_command_output "info register x22" ""] + } else { + set x20_new [capture_command_output "info register x20" ""] + } + + # Execute in reverse to before the instruction sequence. + gdb_test_no_output "set exec-direction reverse" + + gdb_test "continue" \ + [multi_line \ + "Continuing\\." \ + "" \ + "Breakpoint $decimal, main \\(\\) at .*/aarch64-mops.c:$decimal" \ + "$decimal\[ \t\]+__asm__ volatile \\(\"${insn_prefix}p \[^\r\n\]+\""] \ + "reversed execution of instruction sequence" + + # Record the final register values. + set x19_final [capture_command_output "info register x19" ""] + set x21_final [capture_command_output "info register x21" ""] + + if {[string compare $insn_prefix "set"] == 0} { + set x22_final [capture_command_output "info register x22" ""] + } else { + set x20_final [capture_command_output "info register x20" ""] + } + + # Check initial and new values of x19 are different. + gdb_assert [string compare $x19_initial $x19_new] \ + "check x19 initial value versus x19 new value" + + # Check initial and new values of x21 are different. + gdb_assert [string compare $x21_initial $x21_new] \ + "check x21 initial value versus x21 new value" + + if {[string compare $insn_prefix "set"] == 0} { + # Check initial and new values of x22 are the same. + # The register with the value to set shouldn't change. + gdb_assert ![string compare $x22_initial $x22_new] \ + "check x22 initial value versus x22 new value" + } else { + # Check initial and new values of x20 are different. + gdb_assert [string compare $x20_initial $x20_new] \ + "check x20 initial value versus x20 new value" + } + + # Check initial and final values of x19 are the same. + gdb_assert ![string compare $x19_initial $x19_final] \ + "check x19 initial value versus x19 final value" + + # Check initial and final values of x21 are the same. + gdb_assert ![string compare $x21_initial $x21_final] \ + "check x21 initial value versus x21 final value" + + if {[string compare $insn_prefix "set"] == 0} { + # Check initial and final values of x22 are the same. + # The register with the value to set shouldn't change. + gdb_assert ![string compare $x22_initial $x22_final] \ + "check x22 initial value versus x22 final value" + } else { + # Check initial and final values of x20 are the same. + gdb_assert ![string compare $x20_initial $x20_final] \ + "check x20 initial value versus x20 final value" + } + + # Restore forward execution and go to end of recording. + gdb_test_no_output "set exec-direction forward" + gdb_test "record goto end" \ + [multi_line \ + "Go forward to insn number $decimal" \ + "#0 main \\(\\) at .*/aarch64-mops.c:$decimal" \ + "$decimal\[ \t\]+p = dest;"] + } +} + +do_test "set" +do_test "cpy" +do_test "cpyf"