dw2-abs-hi-pc.exp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2014-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. load_lib dwarf.exp
  15. # This test can only be run on targets which support DWARF-2 and use gas.
  16. if {![dwarf2_support]} {
  17. return 0
  18. }
  19. standard_testfile
  20. set sources \
  21. [list \
  22. ${testfile}.c \
  23. ${testfile}-hello.c \
  24. ${testfile}-world.c]
  25. set sources [lmap i $sources { string cat "${srcdir}/${subdir}/" $i }]
  26. lassign [function_range hello $sources] \
  27. hello_start hello_len
  28. lassign [function_range world $sources] \
  29. world_start world_len
  30. set sources \
  31. [list \
  32. ${testfile}.c \
  33. ${testfile}-hello-dbg.S \
  34. ${testfile}-hello.c \
  35. ${testfile}-world-dbg.S \
  36. ${testfile}-world.c]
  37. set flags \
  38. [list \
  39. "nodebug" \
  40. "additional_flags=\"-DHELLO_START=$hello_start\"" \
  41. "additional_flags=\"-DHELLO_END=$hello_start + $hello_len\"" \
  42. "additional_flags=\"-DWORLD_START=$world_start\"" \
  43. "additional_flags=\"-DWORLD_END=$world_start + $world_len\""]
  44. set executable ${testfile}
  45. if {[build_executable ${testfile}.exp ${executable} $sources $flags] == -1} {
  46. return -1
  47. }
  48. clean_restart $executable
  49. gdb_test "break hello" \
  50. "Breakpoint $decimal at $hex: file .*dw2-abs-hi-pc-hello\\.c, line 24\\."
  51. gdb_test "break world" \
  52. "Breakpoint $decimal at $hex: file .*dw2-abs-hi-pc-world\\.c, line 24\\."