[binutils-gdb] Fix gdb.ada/extended-access.exp on riscv64-linux

Tom de Vries vries@sourceware.org
Tue Oct 14 16:09:42 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=94a0adaca0c84c645acc45e28662a4cbaeb75fbe

commit 94a0adaca0c84c645acc45e28662a4cbaeb75fbe
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Oct 14 18:09:36 2025 +0200

    Fix gdb.ada/extended-access.exp on riscv64-linux
    
    On riscv64-linux, I ran into:
    ...
    (gdb) print the_array.all^M
    Cannot access memory at address 0x0^M
    (gdb) FAIL: gdb.ada/extended-access.exp: print the_array.all
    ...
    
    The problem is that the_array.p_array is set by a dynamic relocation:
    ...
    0000000000002010 <array_data>:
            ...
    
    0000000000002028 <the_array>:
            ...
                            2028: R_RISCV_RELATIVE  *ABS*+0x2010
    ...
    which doesn't seem to get its value until we arrive in main.
    
    Fix this by running to main before trying to print the_array.
    
    Tested on riscv64-linux.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/testsuite/gdb.ada/extended-access.exp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/extended-access.exp b/gdb/testsuite/gdb.ada/extended-access.exp
index 7c02ad73f82..c54c5f65a26 100644
--- a/gdb/testsuite/gdb.ada/extended-access.exp
+++ b/gdb/testsuite/gdb.ada/extended-access.exp
@@ -21,9 +21,17 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
     return
 }
 
+# For riscv64-linux, we need to run to main, or the_array.p_array will still
+# be nullptr.
+if {![runto "main"]} {
+  return
+}
+
 # The test case is written in C, because it was easy to make the
 # required type there without requiring a new version of GNAT.
-gdb_test_no_output "set lang ada"
+gdb_test "set lang ada" \
+    [string_to_regexp \
+	 "Warning: the current language does not match this frame."]
 
 gdb_test "print the_array.all" \
     [string_to_regexp " = (93 => 23, 24, 25, 26, 27)"]


More information about the Gdb-cvs mailing list