pieces-optimized-out.exp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright 2013-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 some DWARF piece operators.
  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. # This test can only be run on x86 targets.
  21. if {![is_x86_like_target]} {
  22. return 0
  23. }
  24. standard_testfile .S
  25. set csrcfile ${testfile}.c
  26. if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile]} {
  27. return -1
  28. }
  29. if ![runto foo] {
  30. return -1
  31. }
  32. # Move back up to main.
  33. gdb_test "up" "#1 $hex in main.*" "move up a frame"
  34. # Now take a look at the 's' structure.
  35. gdb_test "p s" \
  36. " = {a = 5, b = <optimized out>, c = <optimized out>, d = <optimized out>}" \
  37. "print s"
  38. gdb_test "p s.a" " = 5" "print s.a"
  39. gdb_test "p s.b" " = <optimized out>" "print s.b"
  40. gdb_test "p s.c" " = <optimized out>" "print s.c"
  41. gdb_test "p s.d" " = <optimized out>" "print s.d"
  42. gdb_test "p s.d + 1" "value has been optimized out" "print s.d + 1"