scoped_watch.exp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Copyright 2017-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 foo_p708_025
  18. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
  19. return -1
  20. }
  21. clean_restart ${testfile}
  22. set bp_location [gdb_get_line_number "START" ${testdir}/pck.adb]
  23. runto "pck.adb:$bp_location"
  24. # Insert a watchpoint on local variable "result"
  25. gdb_test "watch result" \
  26. ".*atchpoint \[0-9\]+: result"
  27. # Insert a breakpoint we'll reach after returning from the current
  28. # function.
  29. set bp_location [gdb_get_line_number "Do_Nothing" ${testdir}/foo_p708_025.adb]
  30. gdb_test "break foo_p708_025.adb:$bp_location" \
  31. "Breakpoint \[0-9\]+ at.*: file .*foo_p708_025.adb, line \[0-9\]+."
  32. # This breakpoint will be there to stop us after we test what happens
  33. # during a continue (see below...)
  34. gdb_test "break pck.increment" \
  35. "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+."
  36. # Continue until we reach our watchpoint. It isn't strictly necessary
  37. # for our purpose that the watchpoint actually triggers, but this shows
  38. # that the watchpoint exists and is active.
  39. gdb_test "cont" \
  40. ".*atchpoint \[0-9\]+: result.*Old value = 8.*New value = 64.*" \
  41. "continuing to watchpoint hit"
  42. # Continue again. We should be stopped at the (internal) breakpoint
  43. # that we setup to delete the watchpoint as soon as the program leaves
  44. # the current scope.
  45. gdb_test \
  46. "cont" \
  47. ".*atchpoint \[0-9\]+ deleted because the program has left the block.*" \
  48. "continuing until watchpoint automatic deletion"
  49. # Continue one more time. We should be reaching one of the breakpoints
  50. # (on the call to Do_Nothing) we set earlier.
  51. gdb_test "cont" \
  52. "Breakpoint \[0-9\]+.*Do_Nothing.*" \
  53. "continuing to breakpoint on call to Do_Nothing"
  54. # Do a next, to verify that it works...
  55. gdb_test "next" \
  56. ".* Call_Me;" \
  57. "next to call to Call_Me"
  58. # And finally, one more continue.
  59. gdb_test "cont" \
  60. "Breakpoint \[0-9\]+.*pck\\.increment.*" \
  61. "continuing to breakpoint in pck.increment"