From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: <Ezra.Sitorus@arm.com>
Cc: <gdb-patches@sourceware.org>, <luis.machado.foss@gmail.com>,
<guinevere@redhat.com>
Subject: Re: [PATCH v2 1/4] gdb/aarch64: record/replay support for LRCPC3
Date: Fri, 15 May 2026 00:50:30 -0300 [thread overview]
Message-ID: <874ik9covt.fsf@linaro.org> (raw)
In-Reply-To: <20260512231707.18123-2-Ezra.Sitorus@arm.com> (Ezra Sitorus's message of "Wed, 13 May 2026 00:17:04 +0100")
Hello Ezra,
Mostly looks good to me. Just a couple of comments in
allow_aarch64_lrcpc3_tests and a question on how to test:
<Ezra.Sitorus@arm.com> writes:
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 28709004..3f3197cb 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5287,6 +5287,69 @@ gdb_caching_proc allow_aarch64_fpmr_tests {} {
> return $allow_fpmr_tests
> }
>
> +# Run a test on the target to see if it supports AArch64 LRCPC3 (Load-Acquire
> +# RCpc instructions) extensions. Return 1 if so, 0 if it does not. Note this
> +# causes a restart of GDB.
> +
> +gdb_caching_proc allow_aarch64_lrcpc3_tests {} {
> + global srcdir subdir gdb_prompt inferior_exited_re
> +
> + set me "allow_aarch64_lrcpc3_tests"
> +
> + if { ![is_aarch64_target] } {
> + return 0
> + }
> +
> + # Take the opportunity to check whether the toolchain knows about LRCPC3.
> + set compile_flags "{additional_flags=-march=armv8-a+rcpc3}"
> +
> + # Compile a program that tests the LRCPC3 feature.
> + set src {
> + #include <stdbool.h>
> + #include <sys/auxv.h>
> +
> + /* Feature check for LRCPC3. */
> + #ifndef HWCAP_LRCPC3
> + #define HWCAP_LRCPC3 (1ULL << 46)
> + #endif
In the system headers, this constant is called HWCAP2_LRCPC3.
> +
> + int main (void) {
> + bool lrcpc3_supported = getauxval (AT_HWCAP2) & HWCAP_LRCPC3;
> +
> + /* Return success if LRCPC3 is supported. */
> + return !lrcpc3_supported;
> + }
> + }
> +
> + if {![gdb_simple_compile $me $src executable $compile_flags]} {
> + return 0
> + }
> +
> + # Compilation succeeded so now run it via gdb.
> + clean_restart
> + gdb_load $obj
> + gdb_run_cmd
> + gdb_expect {
> + -re ".*Illegal instruction.*${gdb_prompt} $" {
> + verbose -log "\n$me lrcpc3 support not detected"
> + set allow_lrcpc3_tests 0
> + }
> + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
> + verbose -log "\n$me: lrcpc3 support detected"
> + set allow_lrcpc3_tests 1
> + }
> + default {
> + warning "\n$me: default case taken"
> + set allow_lrcpc3_tests 0
> + }
> + }
The test program in v1 tried to execute an instruction to detect whether
LRCPC3 is supported, and in v2 it checks a bit in HWCAP. Nothing wrong
with that, but the gdb_expect above needs to be adapted accordingly. On
a machine which doesn't support the feature I see a WARNING, but the
test program just behaved as expected:
(gdb) file /home/bauermann/.cache/builds/gdb-native/gdb/testsuite/temp/1223/allow_aarch64_lrcpc3_tests.x
Reading symbols from /home/bauermann/.cache/builds/gdb-native/gdb/testsuite/temp/1223/allow_aarch64_lrcpc3_tests.x...
(gdb) run
Starting program: /home/bauermann/.cache/builds/gdb-native/gdb/testsuite/temp/1223/allow_aarch64_lrcpc3_tests.x
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/aarch64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 1299) exited with code 01]
(gdb) WARNING:
allow_aarch64_lrcpc3_tests: default case taken
gdb_caching_proc allow_aarch64_lrcpc3_tests caused gdb_exit to be called
gdb_caching_proc allow_aarch64_lrcpc3_tests marked as called
gdb_caching_proc get_compiler_info_1 marked as called
gdb_caching_proc is_aarch32_target marked as called
gdb_caching_proc universal_compile_options_c marked as called
UNSUPPORTED: gdb.reverse/aarch64-lrcpc3.exp: require failed: allow_aarch64_lrcpc3_tests
testcase /home/bauermann/src/binutils-gdb/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp completed in 26 seconds
By the way, is there something specific I need to do to get an FVP
supporting LRCPC3? I set up FVP with:
$ shrinkwrap build --overlay=arch/v9.6.yaml ns-edk2.yaml
But then inside the guest the CPU features in /proc/cpuinfo and the
HWCAP2 don't mention LRCPC3. If I hard-code the testcase to run anyway,
then the inferior dies with a SIGILL.
> + gdb_exit
> + remote_file build delete $obj
> +
> + verbose "$me: returning $allow_lrcpc3_tests" 2
> + return $allow_lrcpc3_tests
> +}
> +
> # Run a test on the target to see if it supports AArch64 MOPS (Memory
> # Operations) extensions. Return 1 if so, 0 if it does not. Note this
> # causes a restart of GDB.
--
Thiago
next prev parent reply other threads:[~2026-05-15 3:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 23:17 [PATCH v2 0/4] gdb/aarch64: record/replay support for AArch64 Ezra.Sitorus
2026-05-12 23:17 ` [PATCH v2 1/4] gdb/aarch64: record/replay support for LRCPC3 Ezra.Sitorus
2026-05-15 3:50 ` Thiago Jung Bauermann [this message]
2026-05-15 11:45 ` Ezra Sitorus
2026-05-15 23:03 ` Thiago Jung Bauermann
2026-05-26 14:30 ` Guinevere Larsen
2026-05-26 23:36 ` Ezra Sitorus
2026-05-27 0:05 ` Thiago Jung Bauermann
2026-05-12 23:17 ` [PATCH v2 2/4] gdb/aarch64: Test record/replay support for CSSC Ezra.Sitorus
2026-05-15 3:50 ` Thiago Jung Bauermann
2026-05-26 19:40 ` Guinevere Larsen
2026-05-26 16:40 ` Guinevere Larsen
2026-05-12 23:17 ` [PATCH v2 3/4] gdb/aarch64: record/replay support for RPRFM, PRFM (reg), PRFUM Ezra.Sitorus
2026-05-15 3:56 ` Thiago Jung Bauermann
2026-05-12 23:17 ` [PATCH v2 4/4] gdb/aarch64: record/replay support for LSE128 Ezra.Sitorus
2026-05-15 3:58 ` Thiago Jung Bauermann
2026-05-26 19:40 ` Guinevere Larsen
2026-05-15 3:59 ` [PATCH v2 0/4] gdb/aarch64: record/replay support for AArch64 Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ik9covt.fsf@linaro.org \
--to=thiago.bauermann@linaro.org \
--cc=Ezra.Sitorus@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=guinevere@redhat.com \
--cc=luis.machado.foss@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox