dw2-op-call.exp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright 2009-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. # Test DW_OP_call2 and DW_OP_call4, PR gdb/10640.
  16. # This test can only be run on targets which support DWARF-2 and use gas.
  17. if {![dwarf2_support]} {
  18. return 0
  19. }
  20. standard_testfile .S main.c
  21. if { [prepare_for_testing "failed to prepare" ${testfile} \
  22. [list $srcfile $srcfile2] {nodebug}] } {
  23. return -1
  24. }
  25. # Additional test to verify the referenced CU is not aged out.
  26. gdb_test_no_output "maintenance set dwarf max-cache-age 0"
  27. gdb_test "p array1" " = 1"
  28. gdb_test "p array2" " = 2" "array2 using DW_OP_call2"
  29. gdb_test "p array3" " = 3" "array3 using DW_OP_call4"
  30. # Location lists need PC.
  31. if ![runto_main] {
  32. return -1
  33. }
  34. gdb_test "p arraynoloc" " = <optimized out>"
  35. gdb_test "p arraycallnoloc" {Asked for position 0 of stack, stack only has 0 elements on it\.}