Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Standalone View
lld/test/ELF/gdb-index-dwarf5-type-unit.s
- This file was added.
# REQUIRES: x86 | |||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o | |||||
# RUN: ld.lld --gdb-index -Ttext=0x1000 %t.o -o %t | |||||
# RUN: llvm-dwarfdump --gdb-index %t | FileCheck %s | |||||
# CHECK: CU list offset = 0x18, has 1 entries: | |||||
# CHECK-NEXT: 0: Offset = 0x0, Length = 0x19 | |||||
# CHECK: Address area offset = 0x28, has 1 entries: | |||||
# CHECK-NEXT: Low/High address = [0x1000, 0x1001) (Size: 0x1), CU id = 0 | |||||
.globl main | |||||
main: | |||||
.Lfunc_begin0: | |||||
retq | |||||
.Lfunc_end0: | |||||
.section .debug_abbrev,"",@progbits | |||||
.byte 1 # Abbreviation Code | |||||
.byte 65 # DW_TAG_type_unit | |||||
.byte 0 # DW_CHILDREN_no | |||||
.byte 0 # EOM(1) | |||||
.byte 0 # EOM(2) | |||||
.byte 2 # Abbreviation Code | |||||
.byte 17 # DW_TAG_compile_unit | |||||
.byte 0 # DW_CHILDREN_no | |||||
.byte 17 # DW_AT_low_pc | |||||
.byte 1 # DW_FORM_addr | |||||
.byte 18 # DW_AT_high_pc | |||||
.byte 6 # DW_FORM_data4 | |||||
.byte 0 # EOM(1) | |||||
.byte 0 # EOM(2) | |||||
.byte 0 # EOM(3) | |||||
.macro TYPE_UNIT id signature | |||||
.section .debug_info,"G",@progbits,\signature | |||||
.long .Ldebug_info_end\id-.Ldebug_info_start\id # Length of Unit | |||||
.Ldebug_info_start\id: | |||||
.short 5 # DWARF version number | |||||
.byte 2 # DWARF Unit Type | |||||
.byte 8 # Address Size | |||||
.long .debug_abbrev # Offset Into Abbrev. Section | |||||
.quad \signature # Type Signature | |||||
.long .Ldebug_info_end\id # Type DIE Offset | |||||
.byte 1 # Abbrev [1] DW_TAG_type_unit | |||||
.Ldebug_info_end\id: | |||||
.endm | |||||
TYPE_UNIT 0, 123 | |||||
MaskRay: @dblaikie Does this test achieve a good minimality/robustness/usefulness in your opinion? | |||||
Not Done ReplyInline ActionsI think so? If I'm reading it correctly it's a type unit in a comdat, a compile unit, another compile unit in a distinct fragment of debug_info, and then another type unit in a comdat? The existence of two compilation units in separate sections with the same name isn't a use case I know of any producer producing today - but if it helps test out the generality of this functionality, it sounds OK to me. dblaikie: I think so?
If I'm reading it correctly it's a type unit in a comdat, a compile unit, another… | |||||
Thanks for confirmation.
This is super rare. ld -r --unique can create the case. I just want to make the behavior clearer/concise without adding another test. MaskRay: Thanks for confirmation.
> The existence of two compilation units in separate sections with… | |||||
Not Done ReplyInline ActionsAh, sounds good! dblaikie: Ah, sounds good! | |||||
.section .debug_info,"",@progbits | |||||
.Lcu_begin0: | |||||
.long .Lcu_end0-.Lcu_begin0-4 # Length of Unit | |||||
.short 5 # DWARF version number | |||||
.byte 1 # DWARF Unit Type | |||||
.byte 8 # Address Size | |||||
.long .debug_abbrev # Offset Into Abbrev. Section | |||||
.byte 2 # Abbrev [2] DW_TAG_compile_unit | |||||
.quad .Lfunc_begin0 # DW_AT_low_pc | |||||
.long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc | |||||
.Lcu_end0: | |||||
#.section .debug_info,"G",@progbits,1234 | |||||
# .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit | |||||
#.Ldebug_info_start0: | |||||
# .short 5 # DWARF version number | |||||
# .byte 2 # DWARF Unit Type | |||||
# .byte 8 # Address Size | |||||
# .long .debug_abbrev # Offset Into Abbrev. Section | |||||
# .quad 1234 # Type Signature | |||||
# .long .Ldebug_info_end0 # Type DIE Offset | |||||
# .byte 1 # Abbrev [1] DW_TAG_type_unit | |||||
#.Ldebug_info_end0: | |||||
TYPE_UNIT 1, 456 |
@dblaikie Does this test achieve a good minimality/robustness/usefulness in your opinion?