dwz.exp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. # 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 dwz.S
  20. # Create the DWARF.
  21. set asm_file [standard_output_file $srcfile2]
  22. Dwarf::assemble $asm_file {
  23. declare_labels partial_label int_label int_label2
  24. cu {} {
  25. partial_label: partial_unit {} {
  26. subprogram {
  27. {MACRO_AT_func { main }}
  28. }
  29. }
  30. }
  31. cu {} {
  32. compile_unit {{language @DW_LANG_C}} {
  33. int_label2: base_type {
  34. {name int}
  35. {byte_size 4 sdata}
  36. {encoding @DW_ATE_signed}
  37. }
  38. constant {
  39. {name the_int}
  40. {type :$int_label2}
  41. {const_value 99 data1}
  42. }
  43. constant {
  44. {name other_int}
  45. {type :$int_label2}
  46. {const_value 99 data1}
  47. }
  48. }
  49. }
  50. cu {} {
  51. compile_unit {{language @DW_LANG_C}} {
  52. imported_unit {
  53. {import $partial_label ref_addr}
  54. }
  55. int_label: base_type {
  56. {name int}
  57. {byte_size 4 sdata}
  58. {encoding @DW_ATE_signed}
  59. }
  60. constant {
  61. {name the_int}
  62. {type :$int_label}
  63. {const_value 23 data1}
  64. }
  65. }
  66. }
  67. }
  68. if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
  69. return -1
  70. }
  71. if ![runto_main] {
  72. return -1
  73. }
  74. gdb_test "p other_int" " = 99"
  75. gdb_test "p the_int" " = 23"