pr13961.S 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. /* Copyright 2012-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. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  12. /* Testcase to exercise the code path in bug 13961.
  13. Compiled from:
  14. class foo
  15. {
  16. public:
  17. int bar;
  18. };
  19. foo baz;
  20. int
  21. main ()
  22. {
  23. return 0;
  24. }
  25. And then manually edited to insert the necessary DW_AT_specification
  26. entries to trigger the desired code path.
  27. There's no real need to make this architecture-specific, so it has been
  28. further hand-edited to support that.
  29. */
  30. #define CONCAT1(a, b) CONCAT2(a, b)
  31. #define CONCAT2(a, b) a ## b
  32. #ifdef SYMBOL_PREFIX
  33. # define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str)
  34. #else
  35. # define SYMBOL(str) str
  36. #endif
  37. .file "pr13961.cc"
  38. .globl baz
  39. .data /* Previously this used .bss, but it's not portable. */
  40. .align 4
  41. .type baz, %object
  42. .size baz, 4
  43. baz:
  44. #if 0
  45. /* This is disabled because when it was accidentally left out it
  46. caused a segv when used with .gdb_index. */
  47. .file 1 "foo.c"
  48. .loc 1 12 0
  49. #endif
  50. .zero 4
  51. .text
  52. .Ltext0:
  53. .globl SYMBOL(main)
  54. .type SYMBOL(main), %function
  55. SYMBOL(main):
  56. .LFB0:
  57. .4byte 0
  58. .LFE0:
  59. .size SYMBOL(main), .-SYMBOL(main)
  60. .Letext0:
  61. .section .debug_types,"",%progbits
  62. .Ldebug_types0:
  63. .4byte .Ltu_end - .Ltu_start /* Length of Compilation Unit Info */
  64. .Ltu_start:
  65. .2byte 0x4 /* DWARF version number */
  66. .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
  67. .byte 0x4 /* Pointer Size (in bytes) */
  68. .byte 0x19 /* Type Signature */
  69. .byte 0x8b
  70. .byte 0x7e
  71. .byte 0xac
  72. .byte 0xce
  73. .byte 0xf1
  74. .byte 0x22
  75. .byte 0x90
  76. .4byte .Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */
  77. .uleb128 0x1 /* DW_TAG_type_unit */
  78. .byte 0x4 /* DW_AT_language */
  79. .byte 0x73 /* DW_AT_GNU_odr_signature */
  80. .byte 0xea
  81. .byte 0x85
  82. .byte 0x23
  83. .byte 0x75
  84. .byte 0x8a
  85. .byte 0x7e
  86. .byte 0x87
  87. .4byte .Ldebug_line0 /* DW_AT_stmt_list */
  88. /* Manually inserted to have a DW_AT_specification refering to
  89. something and appearing ahead of it. */
  90. .uleb128 0x8 /* DW_TAG_class_type */
  91. .4byte .Ltu_class_type - .Ldebug_types0
  92. /* End of manual insertion */
  93. .Ltu_class_type:
  94. .uleb128 0x2 /* (DW_TAG_class_type) */
  95. .ascii "foo\0" /* DW_AT_name */
  96. .byte 0x4 /* DW_AT_byte_size */
  97. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  98. .byte 0x1 /* DW_AT_decl_line */
  99. .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */
  100. .uleb128 0x3 /* (DW_TAG_member) */
  101. .ascii "bar\0" /* DW_AT_name */
  102. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  103. .byte 0x4 /* DW_AT_decl_line */
  104. .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */
  105. .byte 0 /* DW_AT_data_member_location */
  106. .byte 0x1 /* DW_AT_accessibility */
  107. .byte 0 /* end of children */
  108. .Ltu_base_type:
  109. .uleb128 0x4 /* DW_TAG_base_type */
  110. .byte 0x4 /* DW_AT_byte_size */
  111. .byte 0x5 /* DW_AT_encoding */
  112. .ascii "int\0" /* DW_AT_name */
  113. .byte 0 /* end of children */
  114. .Ltu_end:
  115. .section .debug_info,"",%progbits
  116. .Ldebug_info0:
  117. .4byte .Lcu_end - .Lcu_start /* Length of Compilation Unit Info */
  118. .Lcu_start:
  119. .2byte 0x4 /* DWARF version number */
  120. .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
  121. .byte 0x4 /* Pointer Size (in bytes) */
  122. .uleb128 0x5 /* (DW_TAG_compile_unit) */
  123. .4byte .LASF0 /* DW_AT_producer: "GNU C++ 4.6.3 20120306" */
  124. .byte 0x4 /* DW_AT_language */
  125. .4byte .LASF1 /* DW_AT_name: "pr13961.cc" */
  126. .4byte .LASF2 /* DW_AT_comp_dir: "." */
  127. .4byte .Ltext0 /* DW_AT_low_pc */
  128. .4byte .Letext0 /* DW_AT_high_pc */
  129. .4byte .Ldebug_line0 /* DW_AT_stmt_list */
  130. .Lint_base_type:
  131. .uleb128 0x4 /* DW_TAG_base_type */
  132. .byte 0x4 /* DW_AT_byte_size */
  133. .byte 0x5 /* DW_AT_encoding */
  134. .ascii "int\0" /* DW_AT_name */
  135. .uleb128 0x6 /* DW_TAG_subprogram */
  136. /* DW_AT_external */
  137. .4byte .LASF3 /* DW_AT_name: "main" */
  138. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  139. .byte 0xa /* DW_AT_decl_line */
  140. .4byte .Lint_base_type - .Ldebug_info0 /* DW_AT_type */
  141. .4byte .LFB0 /* DW_AT_low_pc */
  142. .4byte .LFE0 /* DW_AT_high_pc */
  143. .uleb128 0x1 /* DW_AT_frame_base */
  144. .byte 0x9c /* DW_OP_call_frame_cfa */
  145. /* DW_AT_GNU_all_call_sites */
  146. .uleb128 0x7 /* DW_TAG_variable */
  147. .ascii "baz\0" /* DW_AT_name */
  148. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  149. .byte 0x7 /* DW_AT_decl_line */
  150. .byte 0x19 /* DW_AT_type */
  151. .byte 0x8b
  152. .byte 0x7e
  153. .byte 0xac
  154. .byte 0xce
  155. .byte 0xf1
  156. .byte 0x22
  157. .byte 0x90
  158. /* DW_AT_external */
  159. .uleb128 0x5 /* DW_AT_location */
  160. .byte 0x3 /* DW_OP_addr */
  161. .4byte baz
  162. /* Manually inserted to have a DW_AT_specification refering to
  163. something and appearing ahead of it. */
  164. .uleb128 0x8 /* DW_TAG_class_type */
  165. .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
  166. .Lcu_int_type:
  167. .uleb128 0x4 /* DW_TAG_base_type */
  168. .byte 0x4 /* DW_AT_byte_size */
  169. .byte 0x5 /* DW_AT_encoding */
  170. .ascii "int\0" /* DW_AT_name */
  171. .Lcu_class_type:
  172. .uleb128 0x2 /* DW_TAG_class_type */
  173. .ascii "foo2\0" /* DW_AT_name */
  174. .byte 0x4 /* DW_AT_byte_size */
  175. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  176. .byte 0x1 /* DW_AT_decl_line */
  177. .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_sibling */
  178. .uleb128 0x3 /* DW_TAG_member */
  179. .ascii "bar\0" /* DW_AT_name */
  180. .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
  181. .byte 0x4 /* DW_AT_decl_line */
  182. .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
  183. .byte 0 /* DW_AT_data_member_location */
  184. .byte 0x1 /* DW_AT_accessibility */
  185. .byte 0 /* end of children */
  186. .Lcu_second_int_type:
  187. .uleb128 0x4 /* DW_TAG_base_type */
  188. .byte 0x4 /* DW_AT_byte_size */
  189. .byte 0x5 /* DW_AT_encoding */
  190. .ascii "int\0" /* DW_AT_name */
  191. /* End of manual insertion */
  192. .byte 0 /* end of children */
  193. .Lcu_end:
  194. .section .debug_abbrev,"",%progbits
  195. .Ldebug_abbrev0:
  196. .uleb128 0x1 /* (abbrev code) */
  197. .uleb128 0x41 /* (TAG: DW_TAG_type_unit) */
  198. .byte 0x1 /* DW_children_yes */
  199. .uleb128 0x13 /* (DW_AT_language) */
  200. .uleb128 0xb /* (DW_FORM_data1) */
  201. .uleb128 0x210f /* (DW_AT_GNU_odr_signature) */
  202. .uleb128 0x7 /* (DW_FORM_data8) */
  203. .uleb128 0x10 /* (DW_AT_stmt_list) */
  204. .uleb128 0x17 /* (DW_FORM_sec_offset) */
  205. .byte 0
  206. .byte 0
  207. .uleb128 0x2 /* (abbrev code) */
  208. .uleb128 0x2 /* (TAG: DW_TAG_class_type) */
  209. .byte 0x1 /* DW_children_yes */
  210. .uleb128 0x3 /* (DW_AT_name) */
  211. .uleb128 0x8 /* (DW_FORM_string) */
  212. .uleb128 0xb /* (DW_AT_byte_size) */
  213. .uleb128 0xb /* (DW_FORM_data1) */
  214. .uleb128 0x3a /* (DW_AT_decl_file) */
  215. .uleb128 0xb /* (DW_FORM_data1) */
  216. .uleb128 0x3b /* (DW_AT_decl_line) */
  217. .uleb128 0xb /* (DW_FORM_data1) */
  218. .uleb128 0x1 /* (DW_AT_sibling) */
  219. .uleb128 0x13 /* (DW_FORM_ref4) */
  220. .byte 0
  221. .byte 0
  222. .uleb128 0x3 /* (abbrev code) */
  223. .uleb128 0xd /* (TAG: DW_TAG_member) */
  224. .byte 0 /* DW_children_no */
  225. .uleb128 0x3 /* (DW_AT_name) */
  226. .uleb128 0x8 /* (DW_FORM_string) */
  227. .uleb128 0x3a /* (DW_AT_decl_file) */
  228. .uleb128 0xb /* (DW_FORM_data1) */
  229. .uleb128 0x3b /* (DW_AT_decl_line) */
  230. .uleb128 0xb /* (DW_FORM_data1) */
  231. .uleb128 0x49 /* (DW_AT_type) */
  232. .uleb128 0x13 /* (DW_FORM_ref4) */
  233. .uleb128 0x38 /* (DW_AT_data_member_location) */
  234. .uleb128 0xb /* (DW_FORM_data1) */
  235. .uleb128 0x32 /* (DW_AT_accessibility) */
  236. .uleb128 0xb /* (DW_FORM_data1) */
  237. .byte 0
  238. .byte 0
  239. .uleb128 0x4 /* (abbrev code) */
  240. .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
  241. .byte 0 /* DW_children_no */
  242. .uleb128 0xb /* (DW_AT_byte_size) */
  243. .uleb128 0xb /* (DW_FORM_data1) */
  244. .uleb128 0x3e /* (DW_AT_encoding) */
  245. .uleb128 0xb /* (DW_FORM_data1) */
  246. .uleb128 0x3 /* (DW_AT_name) */
  247. .uleb128 0x8 /* (DW_FORM_string) */
  248. .byte 0
  249. .byte 0
  250. .uleb128 0x5 /* (abbrev code) */
  251. .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
  252. .byte 0x1 /* DW_children_yes */
  253. .uleb128 0x25 /* (DW_AT_producer) */
  254. .uleb128 0xe /* (DW_FORM_strp) */
  255. .uleb128 0x13 /* (DW_AT_language) */
  256. .uleb128 0xb /* (DW_FORM_data1) */
  257. .uleb128 0x3 /* (DW_AT_name) */
  258. .uleb128 0xe /* (DW_FORM_strp) */
  259. .uleb128 0x1b /* (DW_AT_comp_dir) */
  260. .uleb128 0xe /* (DW_FORM_strp) */
  261. .uleb128 0x11 /* (DW_AT_low_pc) */
  262. .uleb128 0x1 /* (DW_FORM_addr) */
  263. .uleb128 0x12 /* (DW_AT_high_pc) */
  264. .uleb128 0x1 /* (DW_FORM_addr) */
  265. .uleb128 0x10 /* (DW_AT_stmt_list) */
  266. .uleb128 0x17 /* (DW_FORM_sec_offset) */
  267. .byte 0
  268. .byte 0
  269. .uleb128 0x6 /* (abbrev code) */
  270. .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
  271. .byte 0 /* DW_children_no */
  272. .uleb128 0x3f /* (DW_AT_external) */
  273. .uleb128 0x19 /* (DW_FORM_flag_present) */
  274. .uleb128 0x3 /* (DW_AT_name) */
  275. .uleb128 0xe /* (DW_FORM_strp) */
  276. .uleb128 0x3a /* (DW_AT_decl_file) */
  277. .uleb128 0xb /* (DW_FORM_data1) */
  278. .uleb128 0x3b /* (DW_AT_decl_line) */
  279. .uleb128 0xb /* (DW_FORM_data1) */
  280. .uleb128 0x49 /* (DW_AT_type) */
  281. .uleb128 0x13 /* (DW_FORM_ref4) */
  282. .uleb128 0x11 /* (DW_AT_low_pc) */
  283. .uleb128 0x1 /* (DW_FORM_addr) */
  284. .uleb128 0x12 /* (DW_AT_high_pc) */
  285. .uleb128 0x1 /* (DW_FORM_addr) */
  286. .uleb128 0x40 /* (DW_AT_frame_base) */
  287. .uleb128 0x18 /* (DW_FORM_exprloc) */
  288. .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
  289. .uleb128 0x19 /* (DW_FORM_flag_present) */
  290. .byte 0
  291. .byte 0
  292. .uleb128 0x7 /* (abbrev code) */
  293. .uleb128 0x34 /* (TAG: DW_TAG_variable) */
  294. .byte 0 /* DW_children_no */
  295. .uleb128 0x3 /* (DW_AT_name) */
  296. .uleb128 0x8 /* (DW_FORM_string) */
  297. .uleb128 0x3a /* (DW_AT_decl_file) */
  298. .uleb128 0xb /* (DW_FORM_data1) */
  299. .uleb128 0x3b /* (DW_AT_decl_line) */
  300. .uleb128 0xb /* (DW_FORM_data1) */
  301. .uleb128 0x49 /* (DW_AT_type) */
  302. .uleb128 0x20 /* (DW_FORM_ref_sig8) */
  303. .uleb128 0x3f /* (DW_AT_external) */
  304. .uleb128 0x19 /* (DW_FORM_flag_present) */
  305. .uleb128 0x2 /* (DW_AT_location) */
  306. .uleb128 0x18 /* (DW_FORM_exprloc) */
  307. .byte 0
  308. .byte 0
  309. /* Manually inserted. */
  310. .uleb128 0x8 /* abbrev code */
  311. .uleb128 0x2 /* DW_TAG_class_type */
  312. .byte 0x0 /* DW_has_children_no */
  313. .uleb128 0x47 /* DW_AT_specification */
  314. .uleb128 0x13 /* DW_FORM_ref4 */
  315. .byte 0x0 /* Terminator */
  316. .byte 0x0 /* Terminator */
  317. /* End of manual insertion. */
  318. .byte 0
  319. .section .debug_aranges,"",%progbits
  320. .4byte 0x1c /* Length of Address Ranges Info */
  321. .2byte 0x2 /* DWARF Version */
  322. .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */
  323. .byte 0x4 /* Size of Address */
  324. .byte 0 /* Size of Segment Descriptor */
  325. .2byte 0 /* Pad to 8 byte boundary */
  326. .2byte 0
  327. .4byte .Ltext0 /* Address */
  328. .4byte .Letext0-.Ltext0 /* Length */
  329. .4byte 0
  330. .4byte 0
  331. .section .debug_line,"",%progbits
  332. .Ldebug_line0:
  333. .section .debug_str,"MS",%progbits,1
  334. .LASF0:
  335. .string "GNU C++ 4.6.3 20120306"
  336. .LASF2:
  337. .string "."
  338. .LASF1:
  339. .string "pr13961.cc"
  340. .LASF3:
  341. .string "main"