brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.0 KiB · 32b1c39 Raw
252 lines · yaml
1# This test verifies that if a DW_TAG_compile_unit has DW_AT_ranges that2# overlap, that it doesn't end up producing invalid errors claiming a child3# DW_TAG_subprogram DIE is not in the parant (CU) ranges. Prior to the commit4# that fixed this, a loop was iterating over all DW_AT_ranges for a DIE and5# stopping the loop if any intersecting ranges were found. This would cause6# the DW_TAG_subprogram DIEs, like "stripped2" and "main", to improperly report7# that they were not contained in the parent's address ranges8#9# The DWARF looks like:10# 0x0000000b: DW_TAG_compile_unit11#               DW_AT_name	("/tmp/main.c")12#               DW_AT_language	(DW_LANG_C)13#               DW_AT_low_pc	(0x0000000000000000)14#               DW_AT_ranges	(0x0000000015#                  [0x0000000000002000, 0x0000000000003000)16#                  [0x0000000000000000, 0x0000000000000020)17#                  [0x0000000000000000, 0x0000000000000030)18#                  [0x0000000000001000, 0x0000000000002000))19#20# 0x0000001e:   DW_TAG_subprogram21#                 DW_AT_name	("stripped1")22#                 DW_AT_low_pc	(0x0000000000000000)23#                 DW_AT_high_pc	(0x0000000000000020)24#25# 0x0000002f:   DW_TAG_subprogram26#                 DW_AT_name	("stripped2")27#                 DW_AT_low_pc	(0x0000000000000000)28#                 DW_AT_high_pc	(0x0000000000000030)29#30# 0x00000044:   DW_TAG_subprogram31#                 DW_AT_name	("main")32#                 DW_AT_low_pc	(0x0000000000001000)33#                 DW_AT_high_pc	(0x0000000000002000)34#35# 0x00000055:   DW_TAG_subprogram36#                 DW_AT_name	("foo")37#                 DW_AT_low_pc	(0x0000000000002000)38#                 DW_AT_high_pc	(0x0000000000003000)39#40# 0x00000066:   NULL41 42# RUN: yaml2obj %s | not llvm-dwarfdump --error-display=details --verify - | FileCheck %s --implicit-check-not=error:43 44# CHECK: error: DIE has overlapping ranges in DW_AT_ranges attribute: [0x0000000000000000, 0x0000000000000020) and [0x0000000000000000, 0x0000000000000030)45 46# CHECK: 0x0000000b:   DW_TAG_compile_unit47# CHECK-NEXT:                DW_AT_name      [DW_FORM_strp] ( .debug_str[0x00000001] = "/tmp/main.c")48# CHECK-NEXT:                DW_AT_language  [DW_FORM_data2] (DW_LANG_C)49# CHECK-NEXT:                DW_AT_low_pc    [DW_FORM_addr] (0x0000000000000000)50# CHECK-NEXT:                DW_AT_ranges    [DW_FORM_sec_offset] (0x0000000051# CHECK-NEXT:                   [0x0000000000002000, 0x0000000000003000)52# CHECK-NEXT:                   [0x0000000000000000, 0x0000000000000020)53# CHECK-NEXT:                   [0x0000000000000000, 0x0000000000000030)54# CHECK-NEXT:                   [0x0000000000001000, 0x0000000000002000))55 56# CHECK: error: DIEs have overlapping address ranges:57# CHECK: 0x0000002f: DW_TAG_subprogram58# CHECK-NEXT:              DW_AT_name        [DW_FORM_strp] ( .debug_str[0x00000017] = "stripped2")59# CHECK-NEXT:              DW_AT_low_pc      [DW_FORM_addr] (0x0000000000000000)60# CHECK-NEXT:              DW_AT_high_pc     [DW_FORM_addr] (0x0000000000000030)61 62# CHECK: 0x0000001e: DW_TAG_subprogram63# CHECK-NEXT:              DW_AT_name        [DW_FORM_strp] ( .debug_str[0x0000000d] = "stripped1")64# CHECK-NEXT:              DW_AT_low_pc      [DW_FORM_addr] (0x0000000000000000)65# CHECK-NEXT:              DW_AT_high_pc     [DW_FORM_data4] (0x00000020)66 67--- !mach-o68FileHeader:69  magic:           0xFEEDFACF70  cputype:         0x0100000771  cpusubtype:      0x0000000372  filetype:        0x0000000173  ncmds:           474  sizeofcmds:      46475  flags:           0x0000200076  reserved:        0x0000000077LoadCommands:78  - cmd:             LC_SEGMENT_6479    cmdsize:         39280    segname:         ''81    vmaddr:          082    vmsize:          26183    fileoff:         52884    filesize:        26185    maxprot:         786    initprot:        787    nsects:          488    flags:           089    Sections:90      - sectname:        __debug_abbrev91        segname:         __DWARF92        addr:            0x000000000000000093        size:            3694        offset:          0x0000021095        align:           096        reloff:          0x0000000097        nreloc:          098        flags:           0x0000000099        reserved1:       0x00000000100        reserved2:       0x00000000101        reserved3:       0x00000000102      - sectname:        __debug_info103        segname:         __DWARF104        addr:            0x0000000000000024105        size:            103106        offset:          0x00000234107        align:           0108        reloff:          0x00000000109        nreloc:          0110        flags:           0x00000000111        reserved1:       0x00000000112        reserved2:       0x00000000113        reserved3:       0x00000000114      - sectname:        __debug_ranges115        segname:         __DWARF116        addr:            0x000000000000008B117        size:            80118        offset:          0x0000029B119        align:           0120        reloff:          0x00000000121        nreloc:          0122        flags:           0x00000000123        reserved1:       0x00000000124        reserved2:       0x00000000125        reserved3:       0x00000000126      - sectname:        __debug_str127        segname:         __DWARF128        addr:            0x00000000000000DB129        size:            42130        offset:          0x000002EB131        align:           0132        reloff:          0x00000000133        nreloc:          0134        flags:           0x00000000135        reserved1:       0x00000000136        reserved2:       0x00000000137        reserved3:       0x00000000138  - cmd:             LC_SYMTAB139    cmdsize:         24140    symoff:          0141    nsyms:           0142    stroff:          792143    strsize:         8144  - cmd:             LC_BUILD_VERSION145    cmdsize:         32146    platform:        1147    minos:           658944148    sdk:             658944149    ntools:          1150    Tools:151      - tool:            3152        version:         34734080153  - cmd:             LC_DATA_IN_CODE154    cmdsize:         16155    dataoff:         792156    datasize:        0157LinkEditData:158  StringTable:159    - ' '160    - ''161    - ''162    - ''163    - ''164    - ''165    - ''166DWARF:167  debug_str:168    - ''169    - '/tmp/main.c'170    - stripped1171    - stripped2172    - main173    - foo174  debug_abbrev:175    - Table:176        - Code:            0x00000001177          Tag:             DW_TAG_compile_unit178          Children:        DW_CHILDREN_yes179          Attributes:180            - Attribute:       DW_AT_name181              Form:            DW_FORM_strp182            - Attribute:       DW_AT_language183              Form:            DW_FORM_data2184            - Attribute:       DW_AT_low_pc185              Form:            DW_FORM_addr186            - Attribute:       DW_AT_ranges187              Form:            DW_FORM_sec_offset188        - Code:            0x00000002189          Tag:             DW_TAG_subprogram190          Children:        DW_CHILDREN_no191          Attributes:192            - Attribute:       DW_AT_name193              Form:            DW_FORM_strp194            - Attribute:       DW_AT_low_pc195              Form:            DW_FORM_addr196            - Attribute:       DW_AT_high_pc197              Form:            DW_FORM_data4198        - Code:            0x00000003199          Tag:             DW_TAG_subprogram200          Children:        DW_CHILDREN_no201          Attributes:202            - Attribute:       DW_AT_name203              Form:            DW_FORM_strp204            - Attribute:       DW_AT_low_pc205              Form:            DW_FORM_addr206            - Attribute:       DW_AT_high_pc207              Form:            DW_FORM_addr208  debug_ranges:209    - Offset:          0x00000000210      AddrSize:        0x08211      Entries:212        - LowOffset:       0x0000000000002000213          HighOffset:      0x0000000000003000214        - LowOffset:       0x0000000000000000215          HighOffset:      0x0000000000000020216        - LowOffset:       0x0000000000000000217          HighOffset:      0x0000000000000030218        - LowOffset:       0x0000000000001000219          HighOffset:      0x0000000000002000220  debug_info:221    - Version:         4222      AddrSize:        8223      Entries:224        - AbbrCode:        0x00000001225          Values:226            - Value:           0x0000000000000001227            - Value:           0x0000000000000002228            - Value:           0x0000000000000000229            - Value:           0x0000000000000000230        - AbbrCode:        0x00000002231          Values:232            - Value:           0x000000000000000D233            - Value:           0x0000000000000000234            - Value:           0x0000000000000020235        - AbbrCode:        0x00000003236          Values:237            - Value:           0x0000000000000017238            - Value:           0x0000000000000000239            - Value:           0x0000000000000030240        - AbbrCode:        0x00000002241          Values:242            - Value:           0x0000000000000021243            - Value:           0x0000000000001000244            - Value:           0x0000000000001000245        - AbbrCode:        0x00000002246          Values:247            - Value:           0x0000000000000026248            - Value:           0x0000000000002000249            - Value:           0x0000000000001000250        - AbbrCode:        0x00000000251...252