## Test that DWARFv5 .debug_loclists is correctly recognized
## and converted into the DW_FORM_sec_offset form in --garbage-collection
## case or correctly preserved in --no-garbage-collection case.
# RUN: yaml2obj %s -o %t.o
# RUN: llvm-dwarfutil %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
# RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
# RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
# RUN: llvm-dwarfutil --linker parallel %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection --build-accelerator=DWARF %t.o %t1
# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
#CHECK: No errors.
#DWARF-CHECK: DW_TAG_compile_unit
#DWARF-CHECK: DW_AT_name {{.*}}"CU1"
#DWARF-CHECK-NOT: DW_AT_loclists_base
#DWARF-CHECK: DW_TAG_variable
#DWARF-CHECK: DW_AT_name {{.*}}"var1"
#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000000c:
#DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)
#DWARF-CHECK: DW_AT_name {{.*}}"var2"
#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000014:
#DWARF-CHECK: <default>: DW_OP_reg5 RDI)
#DWARF-CHECK: DW_TAG_variable
#DWARF-CHECK: DW_AT_name {{.*}}"var3"
#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000018:
#DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI
#DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
#UPD-DWARF-CHECK: DW_TAG_compile_unit
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"CU1"
#UPD-DWARF-CHECK: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)
#UPD-DWARF-CHECK: DW_TAG_variable
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var1"
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000018:
#UPD-DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)
#UPD-DWARF-CHECK: DW_TAG_variable
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var2"
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x0000001e:
#UPD-DWARF-CHECK: <default>: DW_OP_reg5 RDI)
#UPD-DWARF-CHECK: DW_TAG_variable
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var3"
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x2) loclist = 0x00000022:
#UPD-DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI
#UPD-DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
## Following yaml description has Content of the .debug_rnglists exactly like following data vvvvvvvvvvv
## .debug_rnglists contents:
## 0x00000000: range list header: length = 0x0000003e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000005
## offsets: [
## 0x00000014 => 0x00000020
## 0x00000018 => 0x00000024
## 0x0000001c => 0x00000028
## 0x00000027 => 0x00000033
## 0x00000032 => 0x0000003e
## ]
## ranges:
## 0x00000020: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000010 => [0x0000000000001130, 0x0000000000001140)
## 0x00000023: [DW_RLE_end_of_list ]
## 0x00000024: [DW_RLE_startx_length]: 0x0000000000000001, 0x0000000000000010 => [0x0000000000001140, 0x0000000000001150)
## 0x00000027: [DW_RLE_end_of_list ]
## 0x00000028: [DW_RLE_start_length ]: 0x0000000000001150, 0x0000000000000010 => [0x0000000000001150, 0x0000000000001160)
## 0x00000032: [DW_RLE_end_of_list ]
## 0x00000033: [DW_RLE_start_length ]: 0x0000000000001160, 0x0000000000000010 => [0x0000000000001160, 0x0000000000001170)
## 0x0000003d: [DW_RLE_end_of_list ]
## 0x0000003e: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000040 => [0x0000000000001130, 0x0000000000001170)
## 0x00000041: [DW_RLE_end_of_list ]
## Following yaml description has Content of the .debug_loclists exactly like following data vvvvvvvvvvv
## .debug_loclists contents:
## 0x00000000: locations list header: length = 0x00000029, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000003
## offsets: [
## 0x0000000c => 0x00000018
## 0x00000012 => 0x0000001e
## 0x00000016 => 0x00000022
## ]
## 0x00000018:
## DW_LLE_startx_length (0x0000000000000000, 0x0000000000000010): DW_OP_reg5 RDI
## DW_LLE_end_of_list ()
##
## 0x0000001e:
## DW_LLE_default_location()
## => <default>: DW_OP_reg5 RDI
## DW_LLE_end_of_list ()
##
## 0x00000022:
## DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI
## DW_LLE_startx_length (0x0000000000000003, 0x0000000000000010): DW_OP_reg6 RBP
## DW_LLE_end_of_list ()
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x1130
Size: 0x70
- Name: .debug_rnglists
Type: SHT_PROGBITS
Flags: [ ]
Content: "3e000000050008000500000014000000180000001c000000270000003200000003001000030110000750110000000000001000076011000000000000100003004000"
- Name: .debug_loclists
Type: SHT_PROGBITS
Flags: [ ]
Content: "2900000005000800030000000c0000001200000016000000030010015500050155000301100155030310015600"
DWARF:
debug_abbrev:
- Table:
- Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_yes
Attributes:
- Attribute: DW_AT_producer
Form: DW_FORM_string
- Attribute: DW_AT_language
Form: DW_FORM_data2
- Attribute: DW_AT_name
Form: DW_FORM_string
- Attribute: DW_AT_low_pc
Form: DW_FORM_addrx
- Attribute: DW_AT_ranges
Form: DW_FORM_rnglistx
- Attribute: DW_AT_rnglists_base
Form: DW_FORM_sec_offset
- Attribute: DW_AT_loclists_base
Form: DW_FORM_sec_offset
- Attribute: DW_AT_addr_base
Form: DW_FORM_sec_offset
- Tag: DW_TAG_base_type
Children: DW_CHILDREN_no
Attributes:
- Attribute: DW_AT_name
Form: DW_FORM_string
- Tag: DW_TAG_variable
Children: DW_CHILDREN_no
Attributes:
- Attribute: DW_AT_name
Form: DW_FORM_string
- Attribute: DW_AT_const_value
Form: DW_FORM_data4
- Attribute: DW_AT_type
Form: DW_FORM_ref_addr
- Attribute: DW_AT_location
Form: DW_FORM_loclistx
debug_info:
- Version: 5
UnitType: DW_UT_compile
Entries:
- AbbrCode: 1
Values:
- CStr: by_hand
- Value: 0x04
- CStr: CU1
- Value: 0x0
- Value: 0x4
- Value: 0xc
- Value: 0xc
- Value: 0x8
- AbbrCode: 2
Values:
- CStr: int
- AbbrCode: 3
Values:
- CStr: var1
- Value: 0x00000000
- Value: 0x00000029
- Value: 0x0
- AbbrCode: 3
Values:
- CStr: var2
- Value: 0x00000000
- Value: 0x00000029
- Value: 0x1
- AbbrCode: 3
Values:
- CStr: var3
- Value: 0x00000000
- Value: 0x00000029
- Value: 0x2
- AbbrCode: 0
debug_addr:
- Version: 5
AddressSize: 0x08
Entries:
- Address: 0x1130
- Address: 0x1140
- Address: 0x1150
- Address: 0x1160
...