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 <tom@tromey.com>
This commit is contained in:
Carl Love
2023-08-11 17:08:37 -04:00
parent f8b12b8e10
commit a2d9ce47de

View File

@@ -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" \