brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.6 KiB · 5c8eaff Raw
250 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# RUN: llvm-dwarfdump -debug-rnglists %t.o | \7# RUN:   FileCheck %s --check-prefix=RNGLISTS8 9# Test object to verify dwarfdump handles v5 range lists in 64-bit DWARF format.10# This is similar to 'dwarfdump-rnglists.s', which uses 32-bit DWARF format.11# We use very simplified compile unit dies.12# There are 2 full CUs with DW_AT_rnglists_base, one with a DW_AT_ranges13# attribute using DW_FORM_sec_offset, the other with DW_AT_ranges using14# DW_FORM_rnglistx.15 16        .section .debug_abbrev,"",@progbits17        .byte 0x01  # Abbrev code18        .byte 0x11  # DW_TAG_compile_unit19        .byte 0x00  # DW_CHILDREN_no20        .byte 0x74  # DW_AT_rnglists_base21        .byte 0x17  # DW_FORM_sec_offset22        .byte 0x55  # DW_AT_ranges23        .byte 0x17  # DW_FORM_sec_offset24        .byte 0x00  # EOM(1)25        .byte 0x00  # EOM(2)26        .byte 0x02  # Abbrev code27        .byte 0x11  # DW_TAG_compile_unit28        .byte 0x00  # DW_CHILDREN_no29        .byte 0x74  # DW_AT_rnglists_base30        .byte 0x17  # DW_FORM_sec_offset31        .byte 0x55  # DW_AT_ranges32        .byte 0x23  # DW_FORM_rnglistx33        .byte 0x00  # EOM(1)34        .byte 0x00  # EOM(2)35        .byte 0x00  # EOM(3)36 37# The split CU uses DW_FORM_rnglistx (the only correct option).38# There is no DW_AT_rnglists_base in split units.39        .section .debug_abbrev.dwo,"e",@progbits40        .byte 0x01  # Abbrev code41        .byte 0x11  # DW_TAG_compile_unit42        .byte 0x00  # DW_CHILDREN_no43        .byte 0x55  # DW_AT_ranges44        .byte 0x23  # DW_FORM_rnglistx45        .byte 0x00  # EOM(1)46        .byte 0x00  # EOM(2)47        .byte 0x00  # EOM(3)48        49        .section .debug_info,"",@progbits50        .long 0xffffffff       # DWARF64 mark51        .quad  CU1_5_64_end - CU1_5_64_version  # Length of Unit52CU1_5_64_version:53        .short 5               # DWARF version number54        .byte 1                # DWARF Unit Type55        .byte 4                # Address Size (in bytes)56        .quad .debug_abbrev    # Offset Into Abbrev. Section57# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.58        .byte 1                # Abbreviation code59        .quad Rnglist_Table0_base     # DW_AT_rnglists_base60        .quad Rnglist_Table0_Rnglist0 # DW_AT_ranges61CU1_5_64_end:62 63        .long 0xffffffff       # DWARF64 mark64        .quad  CU2_5_64_end - CU2_5_64_version  # Length of Unit65CU2_5_64_version:66        .short 5               # DWARF version number67        .byte 1                # DWARF Unit Type68        .byte 4                # Address Size (in bytes)69        .quad .debug_abbrev    # Offset Into Abbrev. Section70# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.71        .byte 2                # Abbreviation code72        .quad Rnglist_Table0_base   # DW_AT_rnglists_base73        .uleb128 1             # DW_AT_ranges74CU2_5_64_end:75 76# A CU with an invalid DW_AT_rnglists_base attribute77        .long 0xffffffff       # DWARF64 mark78        .quad  CU3_5_64_end - CU3_5_64_version  # Length of Unit79CU3_5_64_version:80        .short 5               # DWARF version number81        .byte 1                # DWARF Unit Type82        .byte 4                # Address Size (in bytes)83        .quad .debug_abbrev    # Offset Into Abbrev. Section84# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.85        .byte 2                # Abbreviation code86        .quad 0x8              # DW_AT_rnglists_base87        .uleb128 0             # DW_AT_ranges88CU3_5_64_end:89 90# A CU DIE with an incorrect DW_AT_ranges attribute91        .long 0xffffffff       # DWARF64 mark92        .quad  CU4_5_64_end - CU4_5_64_version  # Length of Unit93CU4_5_64_version:94        .short 5               # DWARF version number95        .byte 1                # DWARF Unit Type96        .byte 4                # Address Size (in bytes)97        .quad .debug_abbrev    # Offset Into Abbrev. Section98# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.99        .byte 1                # Abbreviation code100        .quad Rnglist_Table0_base   # DW_AT_rnglists_base101        .quad 4000             # DW_AT_ranges102CU4_5_64_end:103 104        .section .debug_info.dwo,"e",@progbits105 106# DWARF v5 split CU header.107        .long 0xffffffff       # DWARF64 mark108        .quad  CU_split_5_64_end-CU_split_5_64_version  # Length of Unit109CU_split_5_64_version:110        .short 5               # DWARF version number111        .byte 5                # DWARF Unit Type112        .byte 4                # Address Size (in bytes)113        .quad 0                # Offset Into Abbrev Section114        .quad 0xdeadbeefbaadf00d  # DWO id115# The compile-unit DIE, which has DW_AT_rnglists_base and DW_AT_ranges.116        .byte 1                # Abbreviation code117        .uleb128 1             # DW_AT_ranges118CU_split_5_64_end:119 120        .section .debug_rnglists,"",@progbits121# A rnglist table with 2 range lists. The first one uses DW_RLE_start_end122# and DW_RLE_start_length. The second one uses DW_RLE_base_address and123# DW_RLE_offset_pair. The range lists have entries in the offset table.124        .long 0xffffffff                            # DWARF64 mark125        .quad Rnglist_Table0_end - Rnglist_Table0   # table length126Rnglist_Table0:127        .short 5                                    # version128        .byte 4                                     # address size129        .byte 0                                     # segment selector size130        .long 2                                     # offset entry count131Rnglist_Table0_base:132# 2 offset entries which can be used by DW_FORM_rnglistx.133        .quad Rnglist_Table0_Rnglist0 - Rnglist_Table0_base134        .quad Rnglist_Table0_Rnglist1 - Rnglist_Table0_base135Rnglist_Table0_Rnglist0:136        .byte 6                                     # DW_RLE_start_end137        .long Range0_start138        .long Range0_end139        .byte 7                                     # DW_RLE_start_length140        .long Range1_start141        .uleb128 Range1_end - Range1_start 142        .byte 0                                     # DW_RLE_end_of_list143Rnglist_Table0_Rnglist1:144        .byte 5                                     # DW_RLE_base_address145        .long Range0_start146        .byte 4                                     # DW_RLE_offset_pair147        .uleb128 Range1_start - Range0_start148        .uleb128 Range1_end - Range0_start149        .byte 0                                     # DW_RLE_end_of_list150Rnglist_Table0_end:151 152# A rnglist table for the split unit with an empty rangelist and one that153# uses DW_RLE_base_address and DW_RLE_offset_pair. The ranges have entries154# in the offset table. We use the empty range list so we can test 155# DW_FORM_rnglistx with an index other than 0.156        .section .debug_rnglists.dwo,"e",@progbits157        .long 0xffffffff                            # DWARF64 mark158        .quad Rnglist_Table0_dwo_end - Rnglist_Table0_dwo   # table length159Rnglist_Table0_dwo:160        .short 5                                    # version161        .byte 4                                     # address size162        .byte 0                                     # segment selector size163        .long 2                                     # offset entry count164Rnglist_Table0_base_dwo:165# 2 offset entries which can be used by DW_FORM_rnglistx.166        .quad Rnglist_Table0_Rnglist0_dwo - Rnglist_Table0_base_dwo167        .quad Rnglist_Table0_Rnglist1_dwo - Rnglist_Table0_base_dwo168Rnglist_Table0_Rnglist0_dwo:169        .byte 0                                     # DW_RLE_start_end170Rnglist_Table0_Rnglist1_dwo:171        .byte 5                                     # DW_RLE_base_address172        .long Range0_start - .text173        .byte 4                                     # DW_RLE_offset_pair174        .uleb128 Range1_start - Range0_start175        .uleb128 Range1_end - Range0_start176        .byte 0                                     # DW_RLE_end_of_list177Rnglist_Table0_dwo_end:178 179.text180        .space 20181Range0_start:               # Range0: 0x14 - 0x1c182        .space 10183Range0_end:184        .space 12185Range1_start:               # Range1: 0x2a - 0x34186        .space 10187Range1_end:188 189# CHECK:      .debug_info contents:190# CHECK:      Compile Unit: 191# CHECK-NOT:  Compile Unit:192# CHECK:      DW_TAG_compile_unit193# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000000000014)194# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000000000024195# CHECK-NEXT: [0x00000014, 0x0000001e) ".text"196# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")197 198# CHECK:      Compile Unit:199# CHECK-NOT:  Compile Unit:200# CHECK:      DW_TAG_compile_unit201# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000000000014)202# CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000034203# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")204 205# CHECK:      .debug_info.dwo contents:206# CHECK:      Compile Unit:207# CHECK-NOT:  contents:208# CHECK:      DW_TAG_compile_unit209# CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000025210# CHECK-NEXT: [0x0000002a, 0x00000034))211 212#ERR: error: decoding address ranges: invalid range list offset 0x4000500000008213#ERR: error: decoding address ranges: invalid range list offset 0xfa0214 215# RNGLISTS:      .debug_rnglists contents:216# RNGLISTS:      range list header:217# RNGLISTS-SAME:   length = 0x0000000000000031,218# RNGLISTS-SAME:   format = DWARF64,219# RNGLISTS-SAME:   version = 0x0005,220# RNGLISTS-SAME:   addr_size = 0x04,221# RNGLISTS-SAME:   seg_size = 0x00,222# RNGLISTS-SAME:   offset_entry_count = 0x00000002223# RNGLISTS-NEXT: offsets: [224# RNGLISTS-NEXT: 0x0000000000000010225# RNGLISTS-NEXT: 0x0000000000000020226# RNGLISTS-NEXT: ]227# RNGLISTS-NEXT: ranges:228# RNGLISTS-NEXT: [0x00000014, 0x0000001e)229# RNGLISTS-NEXT: [0x0000002a, 0x00000034)230# RNGLISTS-NEXT: <End of list>231# RNGLISTS-NEXT: [0x0000002a, 0x00000034)232# RNGLISTS-NEXT: <End of list>233 234# RNGLISTS:      .debug_rnglists.dwo contents:235# RNGLISTS:      range list header:236# RNGLISTS-SAME:   length = 0x0000000000000022,237# RNGLISTS-SAME:   format = DWARF64,238# RNGLISTS-SAME:   version = 0x0005,239# RNGLISTS-SAME:   addr_size = 0x04,240# RNGLISTS-SAME:   seg_size = 0x00,241# RNGLISTS-SAME:   offset_entry_count = 0x00000002242# RNGLISTS-NEXT: offsets: [243# RNGLISTS-NEXT: 0x0000000000000010244# RNGLISTS-NEXT: 0x0000000000000011245# RNGLISTS-NEXT: ]246# RNGLISTS-NEXT: ranges:247# RNGLISTS-NEXT: <End of list>248# RNGLISTS-NEXT: [0x0000002a, 0x00000034)249# RNGLISTS-NEXT: <End of list>250