hello.exp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright 2007-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 "pascal.exp"
  16. standard_testfile .pas
  17. if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
  18. return -1
  19. }
  20. clean_restart ${testfile}
  21. set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
  22. set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
  23. if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
  24. pass "setting breakpoint 1"
  25. }
  26. if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
  27. pass "setting breakpoint 2"
  28. }
  29. # Verify that "start" lands inside the right procedure.
  30. if { [gdb_start_cmd] < 0 } {
  31. untested start
  32. return -1
  33. }
  34. # This test fails for gpc
  35. # because debug information for 'main'
  36. # is in some <implicit code>
  37. gdb_test "" \
  38. ".* at .*hello.pas.*" \
  39. "start"
  40. gdb_test "cont" \
  41. "Breakpoint .*:${bp_location1}.*" \
  42. "Going to first breakpoint"
  43. gdb_test "print st" \
  44. ".* = ''.*" \
  45. "empty string check"
  46. # This test also fails for gpc because the program
  47. # stops after the string has been written
  48. # while it should stop before writing it
  49. if { $pascal_compiler_is_gpc } {
  50. setup_xfail *-*-*
  51. }
  52. gdb_test "cont" \
  53. "Breakpoint .*:${bp_location2}.*" \
  54. "Going to second breakpoint"
  55. gdb_test "print st" \
  56. ".* = 'Hello, world!'.*" \
  57. "string after assignment check"