207 lines · plain
1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o2# RUN: not llvm-dwarfdump -v -debug-info %t.o 2> %t.err | FileCheck %s3# RUN: FileCheck %s --input-file %t.err --check-prefix=ERR --implicit-check-not=error4# RUN: not llvm-dwarfdump -lookup 10 %t.o 2> %t2.err5# RUN: FileCheck %s --input-file %t2.err --check-prefix=ERR --implicit-check-not=error6 7# Test object to verify dwarfdump handles v5 range lists.8# We use very simplified compile unit dies.9# There are 2 full CUs with DW_AT_rnglists_base, one with a DW_AT_ranges10# attribute using DW_FORM_sec_offset, the other with DW_AT_ranges using11# DW_FORM_rnglistx.12 13 .section .debug_abbrev,"",@progbits14 .byte 0x01 # Abbrev code15 .byte 0x11 # DW_TAG_compile_unit16 .byte 0x00 # DW_CHILDREN_no17 .byte 0x74 # DW_AT_rnglists_base18 .byte 0x17 # DW_FORM_sec_offset19 .byte 0x55 # DW_AT_ranges20 .byte 0x17 # DW_FORM_sec_offset21 .byte 0x00 # EOM(1)22 .byte 0x00 # EOM(2)23 .byte 0x02 # Abbrev code24 .byte 0x11 # DW_TAG_compile_unit25 .byte 0x00 # DW_CHILDREN_no26 .byte 0x74 # DW_AT_rnglists_base27 .byte 0x17 # DW_FORM_sec_offset28 .byte 0x55 # DW_AT_ranges29 .byte 0x23 # DW_FORM_rnglistx30 .byte 0x00 # EOM(1)31 .byte 0x00 # EOM(2)32 .byte 0x00 # EOM(3)33 34# The split CU uses DW_FORM_rnglistx (the only correct option).35# There is no DW_AT_rnglists_base in split units.36 .section .debug_abbrev.dwo,"e",@progbits37 .byte 0x01 # Abbrev code38 .byte 0x11 # DW_TAG_compile_unit39 .byte 0x00 # DW_CHILDREN_no40 .byte 0x55 # DW_AT_ranges41 .byte 0x23 # DW_FORM_rnglistx42 .byte 0x00 # EOM(1)43 .byte 0x00 # EOM(2)44 .byte 0x00 # EOM(3)45 46 .section .debug_info,"",@progbits47 .long CU1_5_end-CU1_5_version # Length of Unit48CU1_5_version:49 .short 5 # DWARF version number50 .byte 1 # DWARF Unit Type51 .byte 4 # Address Size (in bytes)52 .long .debug_abbrev # Offset Into Abbrev. Section53# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.54 .byte 1 # Abbreviation code55 .long Rnglist_Table0_base # DW_AT_rnglists_base56 .long Rnglist_Table0_Rnglist0 # DW_AT_ranges57 .byte 0 # NULL58 .byte 0 # NULL59CU1_5_end:60 61 .long CU2_5_end-CU2_5_version # Length of Unit62CU2_5_version:63 .short 5 # DWARF version number64 .byte 1 # DWARF Unit Type65 .byte 4 # Address Size (in bytes)66 .long .debug_abbrev # Offset Into Abbrev. Section67# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.68 .byte 2 # Abbreviation code69 .long Rnglist_Table0_base # DW_AT_rnglists_base70 .uleb128 1 # DW_AT_ranges71 .byte 0 # NULL72CU2_5_end:73# A CU with an invalid DW_AT_rnglists_base attribute74 .long CU3_5_end-CU3_5_version # Length of Unit75CU3_5_version:76 .short 5 # DWARF version number77 .byte 1 # DWARF Unit Type78 .byte 4 # Address Size (in bytes)79 .long .debug_abbrev # Offset Into Abbrev. Section80# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.81 .byte 2 # Abbreviation code82 .long 0x8 # DW_AT_rnglists_base83 .long 0 # DW_AT_ranges84 .byte 0 # NULL85CU3_5_end:86# A CU DIE with an incorrect DW_AT_ranges attribute87 .long CU4_5_end-CU4_5_version # Length of Unit88CU4_5_version:89 .short 5 # DWARF version number90 .byte 1 # DWARF Unit Type91 .byte 4 # Address Size (in bytes)92 .long .debug_abbrev # Offset Into Abbrev. Section93# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.94 .byte 1 # Abbreviation code95 .long Rnglist_Table0_base # DW_AT_rnglists_base96 .long 4000 # DW_AT_ranges97 .byte 0 # NULL98CU4_5_end:99 100 .section .debug_info.dwo,"e",@progbits101 102# DWARF v5 split CU header.103 .long CU_split_5_end-CU_split_5_version # Length of Unit104CU_split_5_version:105 .short 5 # DWARF version number106 .byte 5 # DWARF Unit Type107 .byte 4 # Address Size (in bytes)108 .long 0 # Offset Into Abbrev Section109 .quad 0xdeadbeefbaadf00d # DWO id110# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.111 .byte 1 # Abbreviation code112 .uleb128 1 # DW_AT_ranges113 .byte 0 # NULL114CU_split_5_end:115 116 .section .debug_rnglists,"",@progbits117# A rnglist table with 2 range lists. The first one uses DW_RLE_start_end118# and DW_RLE_start_length. The second one uses DW_RLE_base_address and119# DW_RLE_offset_pair. The range lists have entries in the offset table.120 .long Rnglist_Table0_end - Rnglist_Table0 # table length121Rnglist_Table0:122 .short 5 # version123 .byte 4 # address size124 .byte 0 # segment selector size125 .long 2 # offset entry count126Rnglist_Table0_base:127# 2 offset entries which can be used by DW_FORM_rnglistx.128 .long Rnglist_Table0_Rnglist0 - Rnglist_Table0_base129 .long Rnglist_Table0_Rnglist1 - Rnglist_Table0_base130Rnglist_Table0_Rnglist0:131 .byte 6 # DW_RLE_start_end132 .long Range0_start133 .long Range0_end134 .byte 7 # DW_RLE_start_length135 .long Range1_start136 .uleb128 Range1_end - Range1_start 137 .byte 0 # DW_RLE_end_of_list138Rnglist_Table0_Rnglist1:139 .byte 5 # DW_RLE_base_address140 .long Range0_start141 .byte 4 # DW_RLE_offset_pair142 .uleb128 Range1_start - Range0_start143 .uleb128 Range1_end - Range0_start144 .byte 0 # DW_RLE_end_of_list145Rnglist_Table0_end:146 147# A rnglist table for the split unit with an empty rangelist and one that148# uses DW_RLE_base_address and DW_RLE_offset_pair. The ranges have entries149# in the offset table. We use the empty range list so we can test 150# DW_FORM_rnglistx with an index other than 0.151 .section .debug_rnglists.dwo,"e",@progbits152 .long Rnglist_Table0_dwo_end - Rnglist_Table0_dwo # table length153Rnglist_Table0_dwo:154 .short 5 # version155 .byte 4 # address size156 .byte 0 # segment selector size157 .long 2 # offset entry count158Rnglist_Table0_base_dwo:159# 2 offset entries which can be used by DW_FORM_rnglistx.160 .long Rnglist_Table0_Rnglist0_dwo - Rnglist_Table0_base_dwo161 .long Rnglist_Table0_Rnglist1_dwo - Rnglist_Table0_base_dwo162Rnglist_Table0_Rnglist0_dwo:163 .byte 0 # DW_RLE_start_end164Rnglist_Table0_Rnglist1_dwo:165 .byte 5 # DW_RLE_base_address166 .long Range0_start - .text167 .byte 4 # DW_RLE_offset_pair168 .uleb128 Range1_start - Range0_start169 .uleb128 Range1_end - Range0_start170 .byte 0 # DW_RLE_end_of_list171Rnglist_Table0_dwo_end:172 173.text174 .space 20175Range0_start: # Range0: 0x14 - 0x1c176 .space 10177Range0_end:178 .space 12179Range1_start: # Range1: 0x2a - 0x34180 .space 10181Range1_end:182 183# CHECK: .debug_info contents:184# CHECK: Compile Unit: 185# CHECK-NOT: Compile Unit:186# CHECK: DW_TAG_compile_unit187# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)188# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000014189# CHECK-NEXT: [0x00000014, 0x0000001e) ".text"190# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")191 192# CHECK: Compile Unit:193# CHECK-NOT: Compile Unit:194# CHECK: DW_TAG_compile_unit195# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)196# CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000024197# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")198 199# CHECK: .debug_info.dwo contents:200# CHECK: Compile Unit:201# CHECK-NOT: contents:202# CHECK: DW_TAG_compile_unit203# CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000015204# CHECK-NEXT: [0x0000002a, 0x00000034))205 206#ERR: error: decoding address ranges: invalid range list offset 0xfa0207