inline-small-func.exp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2020-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. # Check for an issue in GDB where buildsym_compunit::record_line was
  15. # removing duplicate line table entries, but skip_prologue_using_sal
  16. # depends on these duplicates to spot the end of the prologue.
  17. #
  18. # When the de-duplication was added this regression was not spotted as
  19. # it requires a particular combination of a (very) small function
  20. # being inlined into an also very small outer function.
  21. #
  22. # See also gdb.dwarf/dw2-inline-small-func.exp for a version of this
  23. # test that makes use of the Dejagnu DWARF compiler.
  24. #
  25. # This test simply compiles with optimization and checks that GDB can
  26. # do something suitable with the compiled binary. Problems with this
  27. # test are most likely to occur when GDB asks the target specific code
  28. # to skip the prologue (gdbarch_skip_prologue). Some targets make use
  29. # of skip_prologue_using_sal, which should be fine, however, some
  30. # targets make a poor attempt to duplicate parts of
  31. # skip_prologue_using_sal, these targets could easily fail this test.
  32. # This is not (necessarily) a problem with this test, but could
  33. # indicate a weakness with the target in question.
  34. standard_testfile inline-small-func.c inline-small-func.h
  35. if { [prepare_for_testing "failed to prepare" ${testfile} \
  36. [list $srcfile] {debug optimize=-O1}] } {
  37. return -1
  38. }
  39. if ![runto_main] {
  40. return -1
  41. }
  42. # Delete all breakpoints so that the output of "info breakpoints"
  43. # below will only contain a single breakpoint.
  44. delete_breakpoints
  45. # Place a breakpoint within the function in the header file.
  46. set linenum [gdb_get_line_number "callee: body" $srcfile2]
  47. gdb_breakpoint "${srcfile2}:${linenum}"
  48. # Check that the breakpoint was placed where we expected. It should
  49. # appear at the requested line. When the bug in GDB was present the
  50. # breakpoint would be placed on one of the following lines instead.
  51. gdb_test "info breakpoints" \
  52. ".* in callee at \[^\r\n\]+${srcfile2}:${linenum}\\y.*"