diff --git a/llvm/test/tools/llvm-dwp/X86/loclists.s b/llvm/test/tools/llvm-dwp/X86/loclists.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-dwp/X86/loclists.s @@ -0,0 +1,95 @@ +# This test checks if llvm-dwp outputs .debug_loclists. + +# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o \ +# RUN: -split-dwarf-file=%t.dwo -dwarf-version=5 +# RUN: llvm-dwp %t.dwo -o %t.dwp +# RUN: llvm-dwarfdump -debug-loclists -debug-cu-index -debug-tu-index %t.dwp | FileCheck %s + +# CHECK-DAG: .debug_loclists.dwo contents: +# CHECK: locations list header: length = 0x00000019, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001 +# CHECK-NEXT: offsets: [ +# CHECK-NEXT: 0x00000004 +# CHECK-NEXT: ] +# CHECK: DW_LLE_base_addressx (0x0000000000000000) +# CHECK-NEXT: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000004): DW_OP_reg5 RDI +# CHECK-NEXT: DW_LLE_offset_pair (0x0000000000000004, 0x0000000000000008): DW_OP_reg3 RBX + +# CHECK-DAG: .debug_cu_index contents: +# CHECK: Index Signature INFO ABBREV LOCLISTS +# CHECK: 1 {{.*}} [0x00000018, 0x0000002d) [0x00000000, 0x0000000d) [0x00000000, 0x0000001d) + +# CHECK-DAG: .debug_tu_index contents: +# CHECK: Index Signature INFO ABBREV LOCLISTS +# CHECK: 2 {{.*}} [0x00000000, 0x00000018) [0x00000000, 0x0000000d) [0x00000000, 0x0000001d) + +.Lfunc_begin0: + .space 4 +.Ltmp0: + .space 4 +.Ltmp1: +.Lfunc_end0: + .section .debug_info.dwo,"e",@progbits + .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit +.Ldebug_info_dwo_start0: + .short 5 # DWARF version number + .byte 6 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long 0 # Offset Into Abbrev. Section + .quad -4287463584810542331 # Type Signature + .long 31 # Type DIE Offset +.Ldebug_info_dwo_end0: + .section .debug_info.dwo,"e",@progbits + .long .Ldebug_info_dwo_end3-.Ldebug_info_dwo_start3 # Length of Unit +.Ldebug_info_dwo_start3: + .short 5 # DWARF version number + .byte 5 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long 0 # Offset Into Abbrev. Section + .quad 1152943841751211454 + .byte 1 # Abbrev [1] 0x14:0x349 DW_TAG_compile_unit +.Ldebug_info_dwo_end3: + .section .debug_loclists.dwo,"e",@progbits + .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length +.Ldebug_list_header_start0: + .short 5 # Version + .byte 8 # Address size + .byte 0 # Segment selector size + .long 1 # Offset entry count +.Lloclists_table_base0: + .long .Ldebug_loc0-.Lloclists_table_base0 +.Ldebug_loc0: + .byte 1 # DW_LLE_base_addressx + .byte 0 # base address index + .byte 4 # DW_LLE_offset_pair + .uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset + .uleb128 .Ltmp0-.Lfunc_begin0 # ending offset + .byte 1 # Loc expr size + .byte 85 # DW_OP_reg5 + .byte 4 # DW_LLE_offset_pair + .uleb128 .Ltmp0-.Lfunc_begin0 # starting offset + .uleb128 .Ltmp1-.Lfunc_begin0 # ending offset + .byte 1 # Loc expr size + .byte 83 # DW_OP_reg3 + .byte 0 # DW_LLE_end_of_list +.Ldebug_list_header_end0: + .section .debug_str.dwo,"eMS",@progbits,1 +.Linfo_string0: + .asciz "x_" # string offset=0 +.Linfo_string1: + .asciz "float" # string offset=3 +.Linfo_string2: + .asciz "y_" # string offset=9 + .section .debug_abbrev.dwo,"e",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 37 # DW_FORM_strx1 + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 118 # DW_AT_dwo_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) diff --git a/llvm/test/tools/llvm-dwp/X86/rnglists.s b/llvm/test/tools/llvm-dwp/X86/rnglists.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-dwp/X86/rnglists.s @@ -0,0 +1,94 @@ +# This test checks if llvm-dwp outputs .debug_rnglists. + +# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o \ +# RUN: -split-dwarf-file=%t.dwo -dwarf-version=5 +# RUN: llvm-dwp %t.dwo -o %t.dwp +# RUN: llvm-dwarfdump -debug-rnglists -debug-cu-index -debug-tu-index %t.dwp | FileCheck %s + +# CHECK-DAG: .debug_cu_index contents: +# CHECK: Index Signature INFO ABBREV RNGLISTS +# CHECK: 1 0x10001450c58e1dbe [0x00000018, 0x0000002d) [0x00000000, 0x0000000d) [0x00000000, 0x00000017) + +# CHECK-DAG: .debug_tu_index contents: +# CHECK: Index Signature INFO ABBREV RNGLISTS +# CHECK: 2 0xc47fde95e7f1db05 [0x00000000, 0x00000018) [0x00000000, 0x0000000d) [0x00000000, 0x00000017) + +# CHECK-DAG: .debug_rnglists.dwo contents: +# range list header: length = 0x00000013, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001 +# CHECK: offsets: [ +# CHECK-NEXT: 0x00000004 +# CHECK-NEXT: ] +# CHECK-NEXT: ranges: +# CHECK-NEXT: [0x0000000000000004, 0x0000000000000008) +# CHECK-NEXT: [0x000000000000000c, 0x0000000000000010) + +.Lfunc_begin0: + .space 4 +.Ltmp0: + .space 4 +.Ltmp1: + .space 4 +.Ltmp2: + .space 4 +.Ltmp3: + .space 4 +.Lfunc_end0: + .section .debug_info.dwo,"e",@progbits + .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit +.Ldebug_info_dwo_start0: + .short 5 # DWARF version number + .byte 6 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long 0 # Offset Into Abbrev. Section + .quad -4287463584810542331 # Type Signature + .long 31 # Type DIE Offset +.Ldebug_info_dwo_end0: + .section .debug_info.dwo,"e",@progbits + .long .Ldebug_info_dwo_end3-.Ldebug_info_dwo_start3 # Length of Unit +.Ldebug_info_dwo_start3: + .short 5 # DWARF version number + .byte 5 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long 0 # Offset Into Abbrev. Section + .quad 1152943841751211454 + .byte 1 # Abbrev [1] 0x14:0x349 DW_TAG_compile_unit +.Ldebug_info_dwo_end3: + .section .debug_str.dwo,"eMS",@progbits,1 +.Linfo_string0: + .asciz "x_" # string offset=0 +.Linfo_string1: + .asciz "float" # string offset=3 +.Linfo_string2: + .asciz "y_" # string offset=9 + .section .debug_abbrev.dwo,"e",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 37 # DW_FORM_strx1 + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 118 # DW_AT_dwo_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .section .debug_rnglists.dwo,"e",@progbits + .long .Ldebug_list_header_end1-.Ldebug_list_header_start1 # Length +.Ldebug_list_header_start1: + .short 5 # Version + .byte 8 # Address size + .byte 0 # Segment selector size + .long 1 # Offset entry count +.Lrnglists_dwo_table_base0: + .long .Ldebug_ranges0-.Lrnglists_dwo_table_base0 +.Ldebug_ranges0: + .byte 4 # DW_RLE_offset_pair + .uleb128 .Ltmp0-.Lfunc_begin0 # starting offset + .uleb128 .Ltmp1-.Lfunc_begin0 # ending offset + .byte 4 # DW_RLE_offset_pair + .uleb128 .Ltmp2-.Lfunc_begin0 # starting offset + .uleb128 .Ltmp3-.Lfunc_begin0 # ending offset + .byte 0 # DW_RLE_end_of_list +.Ldebug_list_header_end1: diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -663,6 +663,10 @@ {"debug_loc.dwo", {MCOFI.getDwarfLocDWOSection(), DW_SECT_EXT_LOC}}, {"debug_line.dwo", {MCOFI.getDwarfLineDWOSection(), DW_SECT_LINE}}, {"debug_abbrev.dwo", {MCOFI.getDwarfAbbrevDWOSection(), DW_SECT_ABBREV}}, + {"debug_loclists.dwo", + {MCOFI.getDwarfLoclistsDWOSection(), DW_SECT_LOCLISTS}}, + {"debug_rnglists.dwo", + {MCOFI.getDwarfRnglistsDWOSection(), DW_SECT_RNGLISTS}}, {"debug_cu_index", {CUIndexSection, static_cast(0)}}, {"debug_tu_index", {TUIndexSection, static_cast(0)}}};