objcdecode.exp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Copyright 2003-2022 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. # This file tests decoding of Objective-C symbols
  15. # This file was written by Adam Fedor (fedor@gnu.org)
  16. standard_testfile .m
  17. #
  18. # Objective-C program compilation isn't standard. We need to figure out
  19. # which libraries to link in. Most of the time it uses pthread
  20. #
  21. if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
  22. return -1
  23. }
  24. proc do_objc_tests {} {
  25. global subdir
  26. global srcdir
  27. global binfile
  28. global gdb_prompt
  29. # Start with a fresh gdb.
  30. gdb_exit
  31. gdb_start
  32. gdb_reinitialize_dir $srcdir/$subdir
  33. gdb_load $binfile
  34. }
  35. do_objc_tests
  36. gdb_test_no_output "set multiple-symbols ask"
  37. #
  38. # Break on multiply defined method (PR objc/1236)
  39. #
  40. set name "break on multiply defined method"
  41. gdb_test_multiple "break multipleDef" $name \
  42. {
  43. -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] .*${srcfile}:-.Decode multipleDef.\r\n\\\[3\\\] .*${srcfile}:multipleDef\r\n> $" {
  44. send_gdb "3\n"
  45. exp_continue
  46. }
  47. -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: .*\r\n$gdb_prompt $" { pass $name }
  48. -re ".*$gdb_prompt $" { kfail "gdb/1236" $name }
  49. }
  50. set name "continue after break on multiply defined symbol"
  51. gdb_run_cmd
  52. gdb_test_multiple "" $name \
  53. {
  54. -re "Breakpoint \[0-9\]+, multipleDef \\\(\\\) at .*\r\n$gdb_prompt $" {
  55. pass $name
  56. }
  57. -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" {
  58. send_gdb "0\n"
  59. kfail "gdb/1238" $name
  60. # gdb is in a bad state here.
  61. # It would be difficult to do any more tests after this.
  62. }
  63. }