mi_string_access.exp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 2018-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] } { return -1 }
  17. standard_ada_testfile bar
  18. load_lib mi-support.exp
  19. set MIFLAGS "-i=mi"
  20. foreach_with_prefix scenario {all minimal} {
  21. set flags [list debug additional_flags=-fgnat-encodings=$scenario]
  22. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
  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}/bar.adb]
  30. mi_continue_to_line \
  31. "bar.adb:$bp_location" \
  32. "stop at start of main Ada procedure"
  33. mi_gdb_test "-var-create var1 * Aos" \
  34. "\\^done,name=\"var1\",numchild=\"2\",.*" \
  35. "Create var1 varobj"
  36. mi_gdb_test "-var-list-children 1 var1" \
  37. "\\^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\"" \
  38. "list var1's children"
  39. mi_gdb_test "-var-evaluate-expression var1" \
  40. "\\^done,value=\"\\\[2\\\]\"" \
  41. "Print var1"
  42. mi_gdb_test "-var-evaluate-expression var1.1" \
  43. "\\^done,value=\"$hex\"" \
  44. "Print var1 first child"
  45. mi_gdb_test "-var-evaluate-expression var1.2" \
  46. "\\^done,value=\"$hex\"" \
  47. "Print var1 second child"
  48. }