llvm/bolt/test/X86/dwarf5-df-types-debug-names.test

; RUN: rm -rf %t
; RUN: mkdir %t
; RUN: cd %t
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-main.s \
; RUN: -split-dwarf-file=main.dwo -o main.o
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-helper.s \
; RUN: -split-dwarf-file=helper.dwo -o helper.o
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
; RUN: llvm-dwarfdump --debug-info -r 0 main.dwo.dwo > log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 helper.dwo.dwo >> log.txt
; RUN: llvm-dwarfdump --debug-info --debug-names main.exe.bolt >> log.txt
; RUN: cat log.txt | FileCheck -check-prefix=BOLT %s

;; Tests that BOLT correctly generates .debug_names section with two CUs and foreign TUs.

; BOLT: type_signature = [[TYPE:0x[0-9a-f]*]]
; BOLT: type_signature = [[TYPE1:0x[0-9a-f]*]]
; BOLT: Compile Unit
; BOLT: type_signature = [[TYPE2:0x[0-9a-f]*]]
; BOLT: type_signature = [[TYPE1]]
; BOLT: Compile Unit
; BOLT: [[OFFSET:0x[0-9a-f]*]]: Compile Unit
; BOLT: [[OFFSET1:0x[0-9a-f]*]]: Compile Unit

; BOLT:       Name Index @ 0x0 {
; BOLT-NEXT:   Header {
; BOLT-NEXT:     Length: 0x176
; BOLT-NEXT:     Format: DWARF32
; BOLT-NEXT:     Version: 5
; BOLT-NEXT:     CU count: 2
; BOLT-NEXT:     Local TU count: 0
; BOLT-NEXT:     Foreign TU count: 3
; BOLT-NEXT:     Bucket count: 9
; BOLT-NEXT:     Name count: 9
; BOLT-NEXT:     Abbreviations table size: 0x37
; BOLT-NEXT:     Augmentation: 'BOLT'
; BOLT-NEXT:   }
; BOLT-NEXT:   Compilation Unit offsets [
; BOLT-NEXT:     CU[0]: [[OFFSET]]
; BOLT-NEXT:     CU[1]: [[OFFSET1]]
; BOLT-NEXT:   ]
; BOLT-NEXT:   Foreign Type Unit signatures [
; BOLT-NEXT:     ForeignTU[0]: [[TYPE]]
; BOLT-NEXT:     ForeignTU[1]: [[TYPE1]]
; BOLT-NEXT:     ForeignTU[2]: [[TYPE2]]
; BOLT-NEXT:   ]
; BOLT-NEXT: Abbreviations [
; BOLT-NEXT:     Abbreviation [[ABBREV:0x[0-9a-f]*]] {
; BOLT-NEXT:       Tag: DW_TAG_structure_type
; BOLT-NEXT:       DW_IDX_type_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
; BOLT-NEXT:     }
; BOLT-NEXT:     Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
; BOLT-NEXT:       Tag: DW_TAG_subprogram
; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
; BOLT-NEXT:     }
; BOLT-NEXT:     Abbreviation [[ABBREV2:0x[0-9a-f]*]] {
; BOLT-NEXT:       Tag: DW_TAG_variable
; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
; BOLT-NEXT:         DW_IDX_parent: DW_FORM_flag_present
; BOLT-NEXT:     }
; BOLT-NEXT:     Abbreviation [[ABBREV3:0x[0-9a-f]*]] {
; BOLT-NEXT:       Tag: DW_TAG_base_type
; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
; BOLT-NEXT:     }
; BOLT-NEXT:     Abbreviation [[ABBREV4:0x[0-9a-f]*]] {
; BOLT-NEXT:       Tag: DW_TAG_base_type
; BOLT-NEXT:       DW_IDX_type_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 0 [
; BOLT-NEXT:     EMPTY
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 1 [
; BOLT-NEXT:     Name 1 {
; BOLT-NEXT:       Hash: 0x7C96E4DB
; BOLT-NEXT:       String: {{.+}} "Foo2"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV]]
; BOLT-NEXT:         Tag: DW_TAG_structure_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x00
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:     Name 2 {
; BOLT-NEXT:       Hash: 0xB5063D0B
; BOLT-NEXT:       String: {{.+}} "_Z3foov"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV1]]
; BOLT-NEXT:         Tag: DW_TAG_subprogram
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000029
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:     Name 3 {
; BOLT-NEXT:       Hash: 0xFDE48034
; BOLT-NEXT:       String: {{.+}} "fooint"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV2]]
; BOLT-NEXT:         Tag: DW_TAG_variable
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x0000001a
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 2 [
; BOLT-NEXT:     Name 4 {
; BOLT-NEXT:       Hash: 0xB888030
; BOLT-NEXT:       String: {{.+}} "int"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV3]]
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000025
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: 0x5
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x02
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x0000003f
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV3]]
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000056
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 3 [
; BOLT-NEXT:     Name 5 {
; BOLT-NEXT:       Hash: 0xB887389
; BOLT-NEXT:       String: {{.+}} "foo"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV1]]
; BOLT-NEXT:         Tag: DW_TAG_subprogram
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000029
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:     Name 6 {
; BOLT-NEXT:       Hash: 0xF73809C
; BOLT-NEXT:       String: {{.+}} "Foo2a"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV]]
; BOLT-NEXT:         Tag: DW_TAG_structure_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x01
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV]]
; BOLT-NEXT:         Tag: DW_TAG_structure_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x01
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:     Name 7 {
; BOLT-NEXT:       Hash: 0xBA564846
; BOLT-NEXT:       String: {{.+}} "Foo2Int"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV]]
; BOLT-NEXT:         Tag: DW_TAG_structure_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x02
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 4 [
; BOLT-NEXT:     EMPTY
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 5 [
; BOLT-NEXT:     EMPTY
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 6 [
; BOLT-NEXT:     EMPTY
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 7 [
; BOLT-NEXT:     Name 8 {
; BOLT-NEXT:       Hash: 0x7C9A7F6A
; BOLT-NEXT:       String: {{.+}} "main"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV1]]
; BOLT-NEXT:         Tag: DW_TAG_subprogram
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x0000001a
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT:   Bucket 8 [
; BOLT-NEXT:     Name 9 {
; BOLT-NEXT:       Hash: 0x7C952063
; BOLT-NEXT:       String: {{.+}} "char"
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: 0x5
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x00
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000036
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: 0x5
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x01
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000048
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: 0x5
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_type_unit: 0x01
; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000048
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:       Entry @ {{.+}} {
; BOLT-NEXT:         Abbrev: [[ABBREV3]]
; BOLT-NEXT:         Tag: DW_TAG_base_type
; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
; BOLT-NEXT:         DW_IDX_die_offset: 0x00000064
; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
; BOLT-NEXT:       }
; BOLT-NEXT:     }
; BOLT-NEXT:   ]
; BOLT-NEXT: }