diff options
author | Tom Tromey <tromey@adacore.com> | 2024-08-23 13:08:42 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-06 14:17:17 -0700 |
commit | cabd5456c78f431517b4c76ed93feff1608e0cf0 (patch) | |
tree | 412888aad636bc117b902c421a6d7b9d996c4445 | |
parent | 56ddbf72843c0fa1badd68e71c5ba076f626c5c5 (diff) | |
download | binutils-cabd5456c78f431517b4c76ed93feff1608e0cf0.zip binutils-cabd5456c78f431517b4c76ed93feff1608e0cf0.tar.gz binutils-cabd5456c78f431517b4c76ed93feff1608e0cf0.tar.bz2 |
Allow unqualified names in Ada tests
Currently, when a type is declared in a subprogram that isn't part of
a package, gdb will give this type a qualified name. E.g., in the
program for gdb.ada/arr_arr.exp:
procedure Foo is
type Array2_First is array (24 .. 26) of Integer;
gdb will name this type 'foo.array2_first'.
However, with some coming changes to GNAT (and with the remainder of
this series applied as well), this will no longer happen. Instead,
such types will be given their local name. IMO this makes more sense
anyway.
This patch updates most of the Ada tests to allow either form in the
spots where it matters. Both are accepted so that the tests continue
to work with older versions of GNAT. (A few tests are handled in
separate patches; this patch only contains the straightforward
changes.)
-rw-r--r-- | gdb/testsuite/gdb.ada/access_to_unbounded_array.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/arr_arr.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/arrayptr.exp | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/dyn-range.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/local-enum.exp | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/mi_string_access.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/mi_var_access.exp | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/null_overload.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/packed_array.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/py_range.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/rec_comp.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/variant_record_packed_array.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/whatis_array_val.exp | 5 |
14 files changed, 47 insertions, 28 deletions
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp index eeaceb0..fa807c5 100644 --- a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp +++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp @@ -31,6 +31,7 @@ foreach_gnat_encoding scenario flags {all minimal} { set bp_location [gdb_get_line_number "BREAK" ${testdir}/foo.adb] runto "foo.adb:$bp_location" - gdb_test "print Aos(1)" " = \\(foo.string_access\\) $hex" - gdb_test "print Aos(2)" " = \\(foo.string_access\\) $hex" + # Accept "foo." prefix for older versions of GNAT. + gdb_test "print Aos(1)" " = \\((foo.)?string_access\\) $hex" + gdb_test "print Aos(2)" " = \\((foo.)?string_access\\) $hex" } diff --git a/gdb/testsuite/gdb.ada/arr_arr.exp b/gdb/testsuite/gdb.ada/arr_arr.exp index dc641ae..146e6da 100644 --- a/gdb/testsuite/gdb.ada/arr_arr.exp +++ b/gdb/testsuite/gdb.ada/arr_arr.exp @@ -30,5 +30,6 @@ if {![runto "foo.adb:$bp_location"]} { return } +# Accept "foo." prefix for older versions of GNAT. gdb_test "ptype a2" \ - " = array \\(1 \\.\\. 2\\) of foo.array2_first" + " = array \\(1 \\.\\. 2\\) of (foo.)?array2_first" diff --git a/gdb/testsuite/gdb.ada/arrayptr.exp b/gdb/testsuite/gdb.ada/arrayptr.exp index b8c2eab..7998a61 100644 --- a/gdb/testsuite/gdb.ada/arrayptr.exp +++ b/gdb/testsuite/gdb.ada/arrayptr.exp @@ -33,14 +33,15 @@ foreach_gnat_encoding scenario flags {all minimal} { return } + # Accept "foo." prefix for older versions of GNAT. gdb_test "print string_p" \ - "= \\(foo\\.string_access\\) 0x\[0-9a-zA-Z\]+" + "= \\((foo\\.)?string_access\\) 0x\[0-9a-zA-Z\]+" gdb_test "print string_p(3..4)" "= \"ll\"" - gdb_test "print null_string" "= \\(foo\\.string_access\\) 0x0" + gdb_test "print null_string" "= \\((foo\\.)?string_access\\) 0x0" - gdb_test "print arr_ptr" "= \\(access foo\\.little_array\\) 0x\[0-9a-zA-Z\]+" + gdb_test "print arr_ptr" "= \\(access (foo\\.)?little_array\\) 0x\[0-9a-zA-Z\]+" gdb_test "print arr_ptr(2)" "= 22" diff --git a/gdb/testsuite/gdb.ada/dyn-range.exp b/gdb/testsuite/gdb.ada/dyn-range.exp index 9c25522..a7a42ba 100644 --- a/gdb/testsuite/gdb.ada/dyn-range.exp +++ b/gdb/testsuite/gdb.ada/dyn-range.exp @@ -30,4 +30,5 @@ if {![runto "dyn.adb:$bp_location"]} { return -1 } -gdb_test "whatis d" "type = dyn.dyn_range" +# Accept "dyn." prefix for older versions of GNAT. +gdb_test "whatis d" "type = (dyn.)?dyn_range" diff --git a/gdb/testsuite/gdb.ada/local-enum.exp b/gdb/testsuite/gdb.ada/local-enum.exp index 82642cf..b1dfd11 100644 --- a/gdb/testsuite/gdb.ada/local-enum.exp +++ b/gdb/testsuite/gdb.ada/local-enum.exp @@ -35,18 +35,19 @@ if {![runto "local.adb:$bp_location"]} { # name of the enum, either "e1" or "e2". proc print_three {which_enum value} { # We don't know which in order gdb will print the constants, so - # adapt to either. + # adapt to either. Accept "local." prefix for older versions of + # GNAT. set menu1 [multi_line \ "Multiple matches for three" \ "\\\[0\\\] cancel" \ - "\\\[1\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \ - "\\\[2\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \ + "\\\[1\\\] (local\\.)?e2'\\(three\\) \\(enumeral\\)" \ + "\\\[2\\\] (local\\.)?e1'\\(three\\) \\(enumeral\\)" \ "> $"] set menu2 [multi_line \ "Multiple matches for three" \ "\\\[0\\\] cancel" \ - "\\\[1\\\] local\\.e1'\\(three\\) \\(enumeral\\)" \ - "\\\[2\\\] local\\.e2'\\(three\\) \\(enumeral\\)" \ + "\\\[1\\\] (local\\.)?e1'\\(three\\) \\(enumeral\\)" \ + "\\\[2\\\] (local\\.)?e2'\\(three\\) \\(enumeral\\)" \ "> $"] set index -1 diff --git a/gdb/testsuite/gdb.ada/mi_string_access.exp b/gdb/testsuite/gdb.ada/mi_string_access.exp index 8fd116b..59a7ad6 100644 --- a/gdb/testsuite/gdb.ada/mi_string_access.exp +++ b/gdb/testsuite/gdb.ada/mi_string_access.exp @@ -44,8 +44,9 @@ foreach_gnat_encoding scenario flags {all minimal} { "\\^done,name=\"var1\",numchild=\"2\",.*" \ "Create var1 varobj" + # Accept "bar." prefix for older versions of GNAT. mi_gdb_test "-var-list-children 1 var1" \ - "\\^done,numchild=\"2\",children=\\\[child={name=\"var1.1\",exp=\"1\",numchild=\"1\",value=\"$hex\",type=\"bar.string_access\",thread-id=\"$decimal\"},child={name=\"var1.2\",exp=\"2\",numchild=\"1\",value=\"$hex\",type=\"bar.string_access\",thread-id=\"$decimal\"}\\\],has_more=\"0\"" \ + "\\^done,numchild=\"2\",children=\\\[child={name=\"var1.1\",exp=\"1\",numchild=\"1\",value=\"$hex\",type=\"(bar.)?string_access\",thread-id=\"$decimal\"},child={name=\"var1.2\",exp=\"2\",numchild=\"1\",value=\"$hex\",type=\"(bar.)?string_access\",thread-id=\"$decimal\"}\\\],has_more=\"0\"" \ "list var1's children" mi_gdb_test "-var-evaluate-expression var1" \ diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp index 15419bb..1448ce3 100644 --- a/gdb/testsuite/gdb.ada/mi_var_access.exp +++ b/gdb/testsuite/gdb.ada/mi_var_access.exp @@ -52,11 +52,18 @@ mi_continue_to_line \ "mi_access.adb:$bp_location" \ "stop at stop 2" +# A helper to quote some expected output, then arrange for the package +# component to be optional. +proc optional_quote {out} { + set out [string_to_regexp $out] + return [regsub -all "pck\\\\." $out "(pck\\.)?"] +} + # If the VAROBJ_UPDATE_RESULT.TYPE is true, the new_type and new_num_children # strings and values will be printed. This currently happens on PowerPC but # not X86-64. set re_default [string_to_regexp {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="false",has_more="0"}]}] -set re_varobj_update_result_type [string_to_regexp {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="true",new_type="pck.string_access",new_num_children="1",has_more="0"}]}] +set re_varobj_update_result_type [optional_quote {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="true",new_type="pck.string_access",new_num_children="1",has_more="0"}]}] mi_gdb_test "-var-update A_String_Access" \ "($re_default|$re_varobj_update_result_type)" \ "update at stop 2" @@ -71,5 +78,5 @@ mi_continue_to_line \ "stop at stop 3" mi_gdb_test "-var-update A_String_Access" \ - [string_to_regexp {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="true",new_type="pck.string_access",new_num_children="0",has_more="0"}]}] \ + [optional_quote {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="true",new_type="pck.string_access",new_num_children="0",has_more="0"}]}] \ "update at stop 3" diff --git a/gdb/testsuite/gdb.ada/null_overload.exp b/gdb/testsuite/gdb.ada/null_overload.exp index 434366f..664fc42 100644 --- a/gdb/testsuite/gdb.ada/null_overload.exp +++ b/gdb/testsuite/gdb.ada/null_overload.exp @@ -34,4 +34,5 @@ gdb_test "print f(0)" " = false" gdb_test "print null" " = null" gdb_test "print/d null" " = 0" -gdb_test "print U_Ptr" " = \\\(access foo\\.u_0\\\) 0x0" +# Accept "foo." prefix for older versions of GNAT. +gdb_test "print U_Ptr" " = \\\(access (foo\\.)?u_0\\\) 0x0" diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp index 85bc59d..14a4b69 100644 --- a/gdb/testsuite/gdb.ada/packed_array.exp +++ b/gdb/testsuite/gdb.ada/packed_array.exp @@ -40,8 +40,9 @@ foreach_gnat_encoding scenario flags {all minimal} { gdb_test "ptype &var" \ "type = access array \\(4 \\.\\. 8\\) of boolean <packed: 1-bit elements>" + # Accept "pa." prefix for older versions of GNAT. gdb_test "print &var" \ - "= \\(access pa.packed_array\\) 0x.*" + "= \\(access (pa.)?packed_array\\) 0x.*" # Print the value of U_Var, an unconstrainted packed array. diff --git a/gdb/testsuite/gdb.ada/py_range.exp b/gdb/testsuite/gdb.ada/py_range.exp index f96beac..295eb78 100644 --- a/gdb/testsuite/gdb.ada/py_range.exp +++ b/gdb/testsuite/gdb.ada/py_range.exp @@ -38,10 +38,11 @@ gdb_test "python print(int(gdb.parse_and_eval('si')))" \ gdb_test "python print(int(gdb.parse_and_eval('ir')))" \ "974" +# Accept "foo." prefix for older versions of GNAT. gdb_test "python print(gdb.parse_and_eval('si').type)" \ - "foo\\.small_integer" "print type" + "(foo\\.)?small_integer" "print type" gdb_test "python print(gdb.parse_and_eval('si').type.name)" \ - "foo\\.small_integer" "print type name" + "(foo\\.)?small_integer" "print type name" gdb_test "python print(gdb.selected_inferior().main_name)" \ "_ada_foo" \ diff --git a/gdb/testsuite/gdb.ada/rec_comp.exp b/gdb/testsuite/gdb.ada/rec_comp.exp index 641ebb6..5c5c794 100644 --- a/gdb/testsuite/gdb.ada/rec_comp.exp +++ b/gdb/testsuite/gdb.ada/rec_comp.exp @@ -30,9 +30,10 @@ if {![runto "bar_o203_012.adb:$bp_location"]} { return } -gdb_test "whatis r.ia" " = bar_o203_012.int_access" +# Accept "bar_o203_012." prefix for older versions of GNAT. +gdb_test "whatis r.ia" " = (bar_o203_012.)?int_access" gdb_test "ptype r" \ - " = record\r\n *ia: bar_o203_012\\.int_access;\r\nend record" + " = record\r\n *ia: (bar_o203_012\\.)?int_access;\r\nend record" gdb_test "ptype r.ia" " = access <$decimal-byte integer>" diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp index 2bcc027..1512f23 100644 --- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp +++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp @@ -37,8 +37,9 @@ foreach_gnat_encoding scenario flags {all minimal} { "= \\(n => 3, ptr => 0x0, data => \\(3, 5, 8\\)\\)" \ "print My_Object with null Ptr" + # Accept "foo." prefix for older versions of GNAT. gdb_test "print my_object.ptr" \ - "= \\(foo.table_access\\) 0x0" \ + "= \\((foo.)?table_access\\) 0x0" \ "print My_Object.Ptr when null" # Same for My_P_Object... @@ -48,7 +49,7 @@ foreach_gnat_encoding scenario flags {all minimal} { "print My_P_Object with null Ptr" gdb_test "print my_p_object.ptr" \ - "\\(foo.p_table_access\\) 0x0" \ + "\\((foo.)?p_table_access\\) 0x0" \ "print My_P_Object.Ptr when null" # Continue until the Ptr component of both objects get allocated. @@ -68,7 +69,7 @@ foreach_gnat_encoding scenario flags {all minimal} { "print my_object after setting Ptr" gdb_test "print my_object.ptr" \ - "\\(foo.table_access\\) $hex" \ + "\\((foo.)?table_access\\) $hex" \ "print my_object.ptr when no longer null" gdb_test "print my_object.ptr.all" \ @@ -81,7 +82,7 @@ foreach_gnat_encoding scenario flags {all minimal} { "print my_p_object after setting Ptr" gdb_test "print my_p_object.ptr" \ - "= \\(foo.p_table_access\\) $hex" \ + "= \\((foo.)?p_table_access\\) $hex" \ "print My_P_Object.Ptr when no longer null" gdb_test "print my_p_object.ptr.all" \ diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp index f193459..47446c9 100644 --- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp +++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp @@ -52,7 +52,7 @@ foreach_gnat_encoding scenario flags {all minimal} { "= \\(system\\.address\\) $hex" \ "print address" - set test "print {foo.octal_buffer}($)" + set test "print {octal_buffer}($)" gdb_test_multiple "$test" $test { -re "= \\(size => 8, buffer => \\(1, 2, 3, 4, 5, 6, 7, 0\\), length => 8\\)\[\r\n\]+$gdb_prompt $" { pass $test diff --git a/gdb/testsuite/gdb.ada/whatis_array_val.exp b/gdb/testsuite/gdb.ada/whatis_array_val.exp index 007d6ef..1ebbf97 100644 --- a/gdb/testsuite/gdb.ada/whatis_array_val.exp +++ b/gdb/testsuite/gdb.ada/whatis_array_val.exp @@ -30,12 +30,13 @@ if {![runto "foo.adb:$bp_location"]} { return } +# Accept "foo." prefix for older versions of GNAT. gdb_test "whatis full" \ - "type = foo\\.full_table" + "type = (foo\\.)?full_table" gdb_test "print full" \ " = \\(144, 233, 377, 610, 987\\)" gdb_test "whatis $" \ - "type = foo\\.full_table" + "type = (foo\\.)?full_table" |