mi_var_access.exp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 2020-2022 Free Software Foundation, Inc.
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. load_lib "ada.exp"
  16. if {[skip_ada_tests]} {
  17. return -1
  18. }
  19. standard_ada_testfile mi_access
  20. load_lib mi-support.exp
  21. set MIFLAGS "-i=mi"
  22. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != "" } {
  23. return -1
  24. }
  25. mi_clean_restart $binfile
  26. if {[mi_runto_main] < 0} {
  27. return 0
  28. }
  29. set bp_location [gdb_get_line_number "STOP" ${testdir}/mi_access.adb]
  30. mi_continue_to_line \
  31. "mi_access.adb:$bp_location" \
  32. "stop at start of mi_access"
  33. # The bug was that creating a varobj for A_String_Access would crash.
  34. mi_gdb_test "-var-create A_String_Access * A_String_Access" \
  35. "\\^done,name=\"A_String_Access\",numchild=\"1\",.*" \
  36. "Create varobj"
  37. set bp_location [gdb_get_line_number "STOP2" ${testdir}/mi_access.adb]
  38. mi_continue_to_line \
  39. "mi_access.adb:$bp_location" \
  40. "stop at stop 2"
  41. mi_gdb_test "-var-update A_String_Access" \
  42. [string_to_regexp {^done,changelist=[{name="A_String_Access",in_scope="true",type_changed="false",has_more="0"}]}] \
  43. "update at stop 2"
  44. mi_gdb_test "-var-list-children A_String_Access" \
  45. [string_to_regexp {^done,numchild="1",children=[child={name="A_String_Access.A_String_Access.all",exp="A_String_Access.all",numchild="3",type="array (3 .. 5) of character",thread-id="1"}],has_more="0"}] \
  46. "list children at stop 2"
  47. set bp_location [gdb_get_line_number "STOP3" ${testdir}/mi_access.adb]
  48. mi_continue_to_line \
  49. "mi_access.adb:$bp_location" \
  50. "stop at stop 3"
  51. mi_gdb_test "-var-update A_String_Access" \
  52. [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"}]}] \
  53. "update at stop 3"