From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by sourceware.org (Postfix) with ESMTPS id D900E3858407 for ; Fri, 5 Aug 2022 00:47:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D900E3858407 Received: by mail-vs1-xe2f.google.com with SMTP id q15so1169373vsr.0 for ; Thu, 04 Aug 2022 17:47:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=T/9z+d3plOUORHOFbFZRnamHW1vNduh1C7fzYTnowZY=; b=4wJPnjNSOpVGCFqSMS+MdD5CeinONpIWncPTdIVXOnjjExiQcuTPpMJv3OyFpnFArw b71rjSZJ1yHiZo5Ww6UQavwUc0rH07ojcDrdqyyAifwmMRli9b1JGZ+4pVHQlTi7Vugn aeVaKdEiaGf0cTl4OUmedlMOvPCYXMYSCWAVShBjiw7UzBc+tNOMv+RGc7XW8AnknGQN F2jcwvLiqni6A8IxhS4xkoxonJQEL8yuZBOD2QB55XgReXrpMpVCzPU+Ft+AZR8sTnpq 4QqZ7xY5p2gjgxcZJY3baBAUFSq4vqv+a31sy1azeznaIcEXgzaa5q5Bc7MNpYK7Bgow Bnfw== X-Gm-Message-State: ACgBeo31N59JNb5GOH/ea2S4K68P+7w1vT1WxshQGAmWxIk2LGAkjczt ZD6BYcokjSlej/dgSp9VdNOUUBUixXV5KA== X-Google-Smtp-Source: AA6agR41ATF5IEIBpyt/l0d5CmyJwDQUo/MdoNvdj6n6xZ0PsZoI/uRMVez9PzZRh9aLBLRRXTng+w== X-Received: by 2002:a67:dd04:0:b0:388:5a2d:3c5c with SMTP id y4-20020a67dd04000000b003885a2d3c5cmr2026124vsj.26.1659660422192; Thu, 04 Aug 2022 17:47:02 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:bfe4:e3f1:491d:133e]) by smtp.gmail.com with ESMTPSA id q3-20020ab02b83000000b0038342b58f6csm2230180uar.17.2022.08.04.17.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 17:47:01 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH v2 0/2] Fix bug in aarch64-linux GDB when inferior changes SVE vector length Date: Fri, 5 Aug 2022 00:46:46 +0000 Message-Id: <20220805004648.111358-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2022 00:47:04 -0000 Hello, This version addresses Luis' review comments on v1. Built with “--enable-targets=all” and regression tested on aarch64-linux native on Ubuntu 20.04. Changes since v1: - Patch “gdb/aarch64: Fix thread's gdbarch when SVE vector length changes” - Use aarch64_read_description () (which caches descriptions) to get the new target description. - Simplify aarch64_features_from_target_desc () a little bit by using the existing aarch64_get_tdesc_vq (). In v1, the former duplicated the latter's logic. - Remove from aarch64_gdbarch_init () code which tries to read vq from struct gdbarch_info.id. It was dead code in v1. This also allows simplifying the if block a bit further down for the case where tdesc doesn't have registers. - Remove the id member of struct gdbarch_info, since this patch removes its only user. - Patch “gdb/testsuite: Add test for AArch64 Scalable Vector Extension” - Remove mention of QEMU's copyright statement. - Use the GNU Coding Style in the C file. - Be more specific about what the test does in the Tcl file. - Use skip_aarch64_sve_tests to exit early if SVE isn't supported. - Use “info all-registers” rather than “info registers” to check whether all registers are there after the vector length changes. This makes the test take ~15s rather than ~4s. I assume this isn't a problem. - Test that the new vector length is reflected in the $vg register. - Test that the new vector length is reflected in the size of the $z[0-31] registers. - Loop the same number of iterations that the inferior is supposed to loop. - Add small comment documenting the count_newlines procedure. Original cover letter below: While working on gdbserver support for the case where the inferior changes the SVE vector length, I noticed this problem in the GDB native handling of the same scenario. Here's a fix and a testcase which fails without the fix, and passes with it. Regression tested on aarch64-linux native on Ubuntu 20.04. Thiago Jung Bauermann (2): gdb/aarch64: Fix thread's gdbarch when SVE vector length changes gdb/testsuite: Add test for AArch64 Scalable Vector Extension gdb/aarch64-linux-nat.c | 11 ++- gdb/aarch64-tdep.c | 41 +++++----- gdb/aarch64-tdep.h | 2 + gdb/gdbarch.h | 13 +--- gdb/testsuite/gdb.arch/aarch64-sve.c | 64 ++++++++++++++++ gdb/testsuite/gdb.arch/aarch64-sve.exp | 101 +++++++++++++++++++++++++ gdb/testsuite/lib/gdb.exp | 6 ++ gdb/testsuite/lib/mi-support.exp | 4 - 8 files changed, 207 insertions(+), 35 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/aarch64-sve.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-sve.exp