From a2d9ce47dee2c1df5a79eb7f15d8a98e7b4ddbd7 Mon Sep 17 00:00:00 2001 From: Carl Love Date: Fri, 11 Aug 2023 17:08:37 -0400 Subject: [PATCH] gdb.ada/mi_var_access.exp The NUMCHILD value for the "A_String_Access" test differs for X86 and PowerPC. The patch substitutes $decimal instead of "1" to match the value of NUMCHILD. The test "-var-update A_String_Access" generates different output depending on the value of VAROBJ_UPDATE_RESULT.TYPE_CHANGED. If the value is true, the strings "new_type" and "new_num_children" are printed along with their values. The VAROBJ_UPDATE_RESULT.TYPE_CHANGED value is true on PowerPC which produces the output: Expecting: ^(-var-update A_String_Access[ ]+)?(\^done,changelist=\[\{name="A_String_Access",in_scope="true",type_changed="false",has_more="0"\}\][ ]+[(]gdb[)] [ ]*) -var-update A_String_Access ^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="true",new_type="pck.string_access",new_num_children="1",has_more="0"}] (gdb) FAIL: gdb.ada/mi_var_access.exp: update at stop 2 (unexpected output) The patch adds a second possible result string for the test $re_varobj_update_result_type to match the case when type_changed is true. Currently for the mi_var_access.exp test VAROBJ_UPDATE_RESULT.TYPE_CHANGED is true on PowerPC and false on X86-64. Fixes 2 failures on PowerPC. Approved-By: Tom Tromey --- gdb/testsuite/gdb.ada/mi_var_access.exp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp index e16dc184658..6abad65a6d4 100644 --- a/gdb/testsuite/gdb.ada/mi_var_access.exp +++ b/gdb/testsuite/gdb.ada/mi_var_access.exp @@ -38,7 +38,9 @@ mi_continue_to_line \ "stop at start of mi_access" # The bug was that creating a varobj for A_String_Access would crash. -set re_ok "\\^done,name=\"A_String_Access\",numchild=\"1\",.*" +# The value of NUMCHILD may vary on different systems. Use generic $decimal +# to match possible values. +set re_ok "\\^done,name=\"A_String_Access\",numchild=\"$decimal\",.*" set re_error "\\^error,msg=\"Value out of range\.\".*" mi_gdb_test "-var-create A_String_Access * A_String_Access" \ "($re_ok|$re_error)" \ @@ -49,8 +51,13 @@ mi_continue_to_line \ "mi_access.adb:$bp_location" \ "stop at stop 2" +# 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"}]}] mi_gdb_test "-var-update A_String_Access" \ - [string_to_regexp {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="false",has_more="0"}]}] \ + "($re_default|$re_varobj_update_result_type)" \ "update at stop 2" mi_gdb_test "-var-list-children A_String_Access" \ -- 2.30.2