pkd_arr_elem.exp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copyright 2014-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 failure
  18. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
  19. return -1
  20. }
  21. clean_restart ${testfile}
  22. set bp_location \
  23. failure.adb:[gdb_get_line_number "START" ${testdir}/failure.adb]
  24. # Workaround gcc PR101575.
  25. #runto "$bp_location"
  26. gdb_breakpoint "$bp_location"
  27. gdb_run_cmd
  28. set re "Breakpoint $decimal, failure \\(\\) at .*:$decimal.*"
  29. set re_xfail "Breakpoint $decimal, failure__bounded_funny_stringIP.0 \\(\\) at .*:$decimal.*"
  30. set ok 1
  31. gdb_test_multiple "" "Runto to $bp_location" {
  32. -re -wrap $re {
  33. if { $ok } {
  34. pass $gdb_test_name
  35. } else {
  36. xfail $gdb_test_name
  37. }
  38. }
  39. -re -wrap $re_xfail {
  40. set ok 0
  41. send_gdb "continue\n"
  42. exp_continue
  43. }
  44. }
  45. # Print Test. The order of the components depends on which version of
  46. # the compiler being used, as newer version can re-order the order
  47. # of the components. Accept both known orders.
  48. set test "print test"
  49. gdb_test_multiple "$test" $test {
  50. -re "= \\(size => 100, length => 1, str => \\(33 'A', nul <repeats 99 times>\\)\\).*$gdb_prompt $" {
  51. pass $test
  52. }
  53. -re "= \\(size => 100, str => \\(33 'A', nul <repeats 99 times>\\), length => 1\\).*$gdb_prompt $" {
  54. pass $test
  55. }
  56. }
  57. gdb_test "print test.str" \
  58. "= \\(33 'A', nul <repeats 99 times>\\)"
  59. gdb_test "print test.str(1)" \
  60. "= 33 'A'"