dw2-op-stack-value.exp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright 2011-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. # Some targets have leading underscores on assembly symbols.
  20. set additional_flags [gdb_target_symbol_prefix_flags_asm]
  21. standard_testfile .S
  22. if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
  23. object {nodebug}] != "" } {
  24. return -1
  25. }
  26. clean_restart $testfile
  27. gdb_test "p/x stack2" " = 0x1"
  28. gdb_test "p/x stack8" " = 0x1"
  29. set test "x/wx &aa551234"
  30. gdb_test_multiple $test $test {
  31. -re ":\[ \t\]*0x341255aa\r\n$gdb_prompt $" {
  32. # little endian
  33. pass $test
  34. gdb_test "p/x implicit4to2" " = 0x2211"
  35. gdb_test "p/x implicit4to4" " = 0x44332211"
  36. }
  37. -re ":\[ \t\]*0xaa551234\r\n$gdb_prompt $" {
  38. # big endian
  39. pass $test
  40. gdb_test "p/x implicit4to2" " = 0x1122"
  41. gdb_test "p/x implicit4to4" " = 0x11223344"
  42. }
  43. -re ":\[ \t\]*0x\[0-9a-f\]{8}\r\n$gdb_prompt $" {
  44. unsupported $test
  45. }
  46. }