operator_bp.exp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Copyright 2012-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 ops_test
  18. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
  19. return -1
  20. }
  21. clean_restart ${testfile}
  22. # This test won't work properly if system debuginfo is installed.
  23. gdb_test_no_output "set debug-file-directory"
  24. set bp_location [gdb_get_line_number "BEGIN" ${testdir}/ops_test.adb]
  25. runto "ops_test.adb:$bp_location"
  26. # Set breakpoints for all operators, using just the operator name in quotes.
  27. set bp_re "Breakpoint $decimal at $hex"
  28. foreach op { "+" "-" } {
  29. set op_re [string_to_regexp $op]
  30. gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\. \\($decimal locations\\).*"
  31. }
  32. foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
  33. set op_re [string_to_regexp $op]
  34. gdb_test_multiple "break \"$op\"" "" {
  35. -re -wrap "$bp_re: file .*ops.adb, line $decimal." {
  36. pass $gdb_test_name
  37. }
  38. -re -wrap "$bp_re: \"$op_re\"\. \\($decimal locations\\).*" {
  39. pass $gdb_test_name
  40. }
  41. }
  42. }
  43. # Make sure we stop correctly in each operator function.
  44. foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
  45. set op_re [string_to_regexp $op]
  46. gdb_test "continue" \
  47. "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
  48. "continue to \"$op\""
  49. }
  50. # Perform the same test, but using the qualified name of the operator,
  51. # instead of the just the operator name (as in 'break ops."+"').
  52. clean_restart ${testfile}
  53. runto "ops_test.adb:$bp_location"
  54. # Set breakpoints for all operators, using just the operator name in quotes.
  55. foreach op { "+" "-" } {
  56. set op_re [string_to_regexp $op]
  57. gdb_test "break ops.\"$op\"" \
  58. "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\. \\(2 locations\\)"
  59. }
  60. foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
  61. set op_re [string_to_regexp $op]
  62. gdb_test "break ops.\"$op\"" \
  63. "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
  64. }
  65. # Make sure we stop correctly in each operator function.
  66. foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
  67. set op_re [string_to_regexp $op]
  68. gdb_test "continue" \
  69. "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
  70. "continue to ops.\"$op\""
  71. }