237 lines · yaml
1# This test verifies that: if a parent die(DW_TAG_subprogram) has zero2# length address range and has a child with normal address range then3# the "DIE address ranges are not contained in its parent's ranges"4# error is reported. It also checks that if a parent die has zero5# length address range and has children with overlapped addresses6# then the error "DIEs have overlapping address ranges" is reported.7#8# The DWARF looks like:9# 0x0000000b: DW_TAG_compile_unit10# DW_AT_name [DW_FORM_strp] ("/tmp/main.c")11# DW_AT_language (DW_LANG_C)12# DW_AT_low_pc (0x0000000000000000)13# DW_AT_ranges (0x0000000014# [0x0000000000001000, 0x0000000000002000))15#16# 0x0000001e: DW_TAG_subprogram17# DW_AT_name ("main")18# DW_AT_low_pc (0x0000000000000000)19# DW_AT_high_pc (0x0000000000000000)20#21# 0x00000033: DW_TAG_lexical_block22# DW_AT_low_pc (0x0000000000001001)23# DW_AT_high_pc (0x0000000000002000)24#25# 0x00000044: DW_TAG_lexical_block26# DW_AT_low_pc (0x0000000000001000)27# DW_AT_high_pc (0x0000000000002000)28# 0x00000055: NULL29#30# 0x00000056: NULL31 32 33# RUN: yaml2obj %s | not llvm-dwarfdump --error-display=details --verify - | FileCheck %s --implicit-check-not=error:34 35# CHECK: Verifying -: file format Mach-O 64-bit x86-6436# CHECK: Verifying .debug_abbrev...37# CHECK: Verifying .debug_info Unit Header Chain...38# CHECK: error: DIE address ranges are not contained in its parent's ranges:39# CHECK: 0x0000001e: DW_TAG_subprogram40# CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")41# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)42# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000000)43 44# CHECK: 0x00000033: DW_TAG_lexical_block45# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)46# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)47 48# CHECK: error: DIEs have overlapping address ranges:49# CHECK: 0x00000044: DW_TAG_lexical_block50# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001001)51# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)52 53# CHECK: 0x00000033: DW_TAG_lexical_block54# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)55# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)56 57# CHECK: error: DIE address ranges are not contained in its parent's ranges:58# CHECK: 0x0000001e: DW_TAG_subprogram59# CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")60# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)61# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000000)62 63# CHECK: 0x00000044: DW_TAG_lexical_block64# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001001)65# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)66 67 68--- !mach-o69FileHeader:70 magic: 0xFEEDFACF71 cputype: 0x0100000772 cpusubtype: 0x0000000373 filetype: 0x0000000174 ncmds: 475 sizeofcmds: 46476 flags: 0x0000200077 reserved: 0x0000000078LoadCommands:79 - cmd: LC_SEGMENT_6480 cmdsize: 39281 segname: ''82 vmaddr: 083 vmsize: 26184 fileoff: 52885 filesize: 26186 maxprot: 787 initprot: 788 nsects: 489 flags: 090 Sections:91 - sectname: __debug_abbrev92 segname: __DWARF93 addr: 0x000000000000000094 size: 3695 offset: 0x0000021096 align: 097 reloff: 0x0000000098 nreloc: 099 flags: 0x00000000100 reserved1: 0x00000000101 reserved2: 0x00000000102 reserved3: 0x00000000103 - sectname: __debug_info104 segname: __DWARF105 addr: 0x0000000000000024106 size: 87107 offset: 0x00000234108 align: 0109 reloff: 0x00000000110 nreloc: 0111 flags: 0x00000000112 reserved1: 0x00000000113 reserved2: 0x00000000114 reserved3: 0x00000000115 - sectname: __debug_ranges116 segname: __DWARF117 addr: 0x000000000000008B118 size: 32119 offset: 0x0000029B120 align: 0121 reloff: 0x00000000122 nreloc: 0123 flags: 0x00000000124 reserved1: 0x00000000125 reserved2: 0x00000000126 reserved3: 0x00000000127 - sectname: __debug_str128 segname: __DWARF129 addr: 0x00000000000000DB130 size: 18131 offset: 0x000002EB132 align: 0133 reloff: 0x00000000134 nreloc: 0135 flags: 0x00000000136 reserved1: 0x00000000137 reserved2: 0x00000000138 reserved3: 0x00000000139 - cmd: LC_SYMTAB140 cmdsize: 24141 symoff: 0142 nsyms: 0143 stroff: 792144 strsize: 8145 - cmd: LC_BUILD_VERSION146 cmdsize: 32147 platform: 1148 minos: 658944149 sdk: 658944150 ntools: 1151 Tools:152 - tool: 3153 version: 34734080154 - cmd: LC_DATA_IN_CODE155 cmdsize: 16156 dataoff: 792157 datasize: 0158LinkEditData:159 StringTable:160 - ' '161 - ''162 - ''163 - ''164 - ''165 - ''166 - ''167DWARF:168 debug_str:169 - ''170 - '/tmp/main.c'171 - main172 debug_abbrev:173 - Table:174 - Code: 0x00000001175 Tag: DW_TAG_compile_unit176 Children: DW_CHILDREN_yes177 Attributes:178 - Attribute: DW_AT_name179 Form: DW_FORM_strp180 - Attribute: DW_AT_language181 Form: DW_FORM_data2182 - Attribute: DW_AT_low_pc183 Form: DW_FORM_addr184 - Attribute: DW_AT_ranges185 Form: DW_FORM_sec_offset186 - Code: 0x00000002187 Tag: DW_TAG_subprogram188 Children: DW_CHILDREN_yes189 Attributes:190 - Attribute: DW_AT_name191 Form: DW_FORM_strp192 - Attribute: DW_AT_low_pc193 Form: DW_FORM_addr194 - Attribute: DW_AT_high_pc195 Form: DW_FORM_addr196 - Code: 0x00000003197 Tag: DW_TAG_lexical_block198 Children: DW_CHILDREN_no199 Attributes:200 - Attribute: DW_AT_low_pc201 Form: DW_FORM_addr202 - Attribute: DW_AT_high_pc203 Form: DW_FORM_addr204 205 debug_ranges:206 - Offset: 0x00000000207 AddrSize: 0x08208 Entries:209 - LowOffset: 0x0000000000001000210 HighOffset: 0x0000000000002000211 debug_info:212 - Version: 4213 AddrSize: 8214 Entries:215 - AbbrCode: 0x00000001216 Values:217 - Value: 0x0000000000000001218 - Value: 0x0000000000000002219 - Value: 0x0000000000000000220 - Value: 0x0000000000000000221 - AbbrCode: 0x00000002222 Values:223 - Value: 0x000000000000000D224 - Value: 0x0000000000000000225 - Value: 0x0000000000000000226 - AbbrCode: 0x00000003227 Values:228 - Value: 0x0000000000001000229 - Value: 0x0000000000002000230 - AbbrCode: 0x00000003231 Values:232 - Value: 0x0000000000001001233 - Value: 0x0000000000002000234 - AbbrCode: 0x00000000235 - AbbrCode: 0x00000000236...237