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"
}
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"
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"
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"
# 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
"\\^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" \
"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"
"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"
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"
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.
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" \
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>"
"= \\(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...
"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.
"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" \
"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" \
"= \\(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
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"