fun_renaming.exp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Copyright 2015-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 fun_renaming
  18. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
  19. return -1
  20. }
  21. clean_restart ${testfile}
  22. set bp_location [gdb_get_line_number "BREAK" ${testdir}/fun_renaming.adb]
  23. runto "fun_renaming.adb:$bp_location"
  24. # Sanity check: make sure we can call a regular global function.
  25. gdb_test "print fun_rename_test_next(1)" " = 2"
  26. # Starting with GCC 6, renamed subprograms are materialized in the debugging
  27. # information: make sure we can call the regular global function using its
  28. # multiple names.
  29. set test "print fun_rename_test_n(1)"
  30. gdb_test_multiple $test $test {
  31. -re " = 2\..*$gdb_prompt $" {
  32. pass $test
  33. }
  34. -re "No definition of \"fun_rename_test_n\" in current context\..*$gdb_prompt $" {
  35. if {[test_compiler_info {gcc-6*}]} {
  36. fail $test
  37. } else {
  38. xfail $test
  39. }
  40. }
  41. }
  42. set test "print renamed_fun_rename_test_next(1)"
  43. gdb_test_multiple $test $test {
  44. -re " = 2\..*$gdb_prompt $" {
  45. pass $test
  46. }
  47. -re "No definition of \"renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
  48. if {[test_compiler_info {gcc-6*}]} {
  49. fail $test
  50. } else {
  51. xfail $test
  52. }
  53. }
  54. }
  55. set test "print pack.renamed_fun_rename_test_next(1)"
  56. gdb_test_multiple $test $test {
  57. -re " = 2\..*$gdb_prompt $" {
  58. pass $test
  59. }
  60. -re "No definition of \"pack\.renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
  61. if {[test_compiler_info {gcc-6*}]} {
  62. fail $test
  63. } else {
  64. xfail $test
  65. }
  66. }
  67. -re "Type <data variable, no debug info> is not a structure or union type\..*$gdb_prompt $" {
  68. if {[test_compiler_info {gcc-6*}]} {
  69. fail $test
  70. } else {
  71. xfail $test
  72. }
  73. }
  74. }