arr-subrange.exp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 main.c -dw.S
  20. # Make some DWARF for the test.
  21. set asm_file [standard_output_file $srcfile2]
  22. Dwarf::assemble $asm_file {
  23. cu {} {
  24. DW_TAG_compile_unit {
  25. {DW_AT_language @DW_LANG_Ada95}
  26. {DW_AT_name foo.adb}
  27. {DW_AT_comp_dir /tmp}
  28. {MACRO_AT_range {main}}
  29. } {
  30. declare_labels boolean_label typedef_label array_label enum_label
  31. boolean_label: DW_TAG_base_type {
  32. {DW_AT_byte_size 1 DW_FORM_sdata}
  33. {DW_AT_encoding @DW_ATE_boolean}
  34. {DW_AT_name boolean}
  35. }
  36. typedef_label: DW_TAG_typedef {
  37. {DW_AT_name pck__table}
  38. {DW_AT_type :$array_label}
  39. }
  40. array_label: DW_TAG_array_type {
  41. {DW_AT_name pck__table}
  42. {DW_AT_type :$boolean_label}
  43. } {
  44. DW_TAG_subrange_type {
  45. {DW_AT_type :$enum_label}
  46. {DW_AT_lower_bound 0 DW_FORM_data1}
  47. {DW_AT_upper_bound 128 DW_FORM_data1}
  48. }
  49. }
  50. enum_label: DW_TAG_enumeration_type {
  51. {DW_AT_name pck__enum_t}
  52. {DW_AT_byte_size 1 DW_FORM_sdata}
  53. } {
  54. DW_TAG_enumerator {
  55. {DW_AT_name pck__enum_000}
  56. {DW_AT_const_value 0 DW_FORM_sdata}
  57. }
  58. DW_TAG_enumerator {
  59. {DW_AT_name pck__enum_001}
  60. {DW_AT_const_value 1 DW_FORM_sdata}
  61. }
  62. DW_TAG_enumerator {
  63. {DW_AT_name pck__enum_128}
  64. {DW_AT_const_value 128 DW_FORM_sdata}
  65. }
  66. }
  67. }
  68. }
  69. }
  70. if { [prepare_for_testing "failed to prepare" ${testfile} \
  71. [list $srcfile $asm_file] {nodebug}] } {
  72. return -1
  73. }
  74. gdb_test_no_output "set language ada"
  75. gdb_test "ptype pck.table" \
  76. "type = array \\(enum_000 \\.\\. enum_128\\) of boolean"