[PATCH] D137882: [DWARFLibrary] Add support to re-construct cu-index
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 5 17:07:18 PST 2022
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Sounds good to me. Thanks for your patience/please only commit once the 64 bit changes to LLVM's index data structures are committed first.
In D137882#3972721 <https://reviews.llvm.org/D137882#3972721>, @ayermolo wrote:
> Updated test with 64bit printout.
> F25507161: image.png <https://reviews.llvm.org/F25507161>
> F25507166: image.png <https://reviews.llvm.org/F25507166>
>
> # RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t.dwp
> # RUN: llvm-dwarfdump --manaully-generate-unit-index --debug-cu-index %t.dwp | FileCheck %s
>
> # This test checks that we parse correctly cu-index that has entries over 4GB.
> # It is setup to work with current llvm implementation where cu-index is 32bit.
> # Once we move to 64bit internal representation, it will need to be modified.
I guess this comment needs to be updated ^
> # CHECK: 0x970c277d61e66cb3
> # CHECK-SAME: [0x0000000000000000, 0x00000000fffffff0)
> # CHECK: 0xd725a83371e7e913
> # CHECK-SAME: [0x00000000fffffff0, 0x000000010000001b)
> # CHECK: 0x93f541184fb98d75
> # CHECK-SAME: [0x000000010000001b, 0x0000000100000046)
>
> .section .debug_abbrev.dwo,"e", at progbits
> .Labbrev1:
> .byte 1 # Abbreviation Code
> .byte 17 # DW_TAG_compile_unit
> .byte 0 # DW_CHILDREN_no
> .byte 37 # DW_AT_producer
> .byte 8 # DW_FORM_string
> .byte 3 # DW_AT_name
> .byte 8 # DW_FORM_string
> .ascii "\261B" # DW_AT_GNU_dwo_id
> .byte 7 # DW_FORM_data8
> .byte 0 # EOM(1)
> .byte 0 # EOM(2)
> .byte 0 # EOM(3)
> .Labbrev_end1:
>
> .section .debug_info.dwo,"e", at progbits
> # DWO CU1
> .Lcu_begin1:
> .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit 0x2b
> .Ldebug_info_start1:
> .short 4 # DWARF version number
> .long 0 # Offset Into Abbrev. Section
> .byte 8 # Address Size (in bytes)
> .byte 1 # Abbrev DW_TAG_compile_unit
> .asciz "Hand-written DWARF" # DW_AT_producer
> .byte '1', '.', 'c', 0 # DW_AT_name
> .quad 0x970c277d61e66cb3 # DW_AT_GNU_dwo_id
> .zero 0xfffffff0 - 0x2b # 0xfffffff0 is mimimum reserved length
> .Ldebug_info_end1:
>
> # DWO CU2
> .Lcu_begin2:
> .long .Ldebug_info_end2-.Ldebug_info_start2 # Length of Unit 0x2b
> .Ldebug_info_start2:
> .short 4 # DWARF version number
> .long 0 # Offset Into Abbrev. Section
> .byte 8 # Address Size (in bytes)
> .byte 1 # Abbrev DW_TAG_compile_unit
> .asciz "Hand-written DWARF" # DW_AT_producer
> .byte '2', '.', 'c', 0 # DW_AT_name
> .quad 0xd725a83371e7e913 # DW_AT_GNU_dwo_id
> .Ldebug_info_end2:
>
> # DWO CU3
> .Lcu_begin3:
> .long .Ldebug_info_end3-.Ldebug_info_start3 # Length of Unit 0x2b
> .Ldebug_info_start3:
> .short 4 # DWARF version number
> .long 0 # Offset Into Abbrev. Section
> .byte 8 # Address Size (in bytes)
> .byte 1 # Abbrev DW_TAG_compile_unit
> .asciz "Hand-written DWARF" # DW_AT_producer
> .byte '3', '.', 'c', 0 # DW_AT_name
> .quad 0x93f541184fb98d75 # DW_AT_GNU_dwo_id
> .Ldebug_info_end3:
>
> .section .debug_cu_index,"", at progbits
> .long 2 # DWARF version number
> .long 2 # Section count
> .long 3 # Unit count
> .long 8 # Slot count
>
> .quad 0x970c277d61e66cb3, 0, 0, 0xd725a83371e7e913, 0, 0x93f541184fb98d75, 0, 0 # Hash table
> .long 1, 0, 0, 2, 0, 3, 0, 0 # Index table
>
> .long 1 # DW_SECT_INFO
> .long 3 # DW_SECT_ABBREV
> # Offsets
> # row 0
> .long .Lcu_begin1-.debug_info.dwo
> .long .Labbrev1-.debug_abbrev.dwo
> # row 1
> .long .Lcu_begin2-.debug_info.dwo
> .long .Labbrev1-.debug_abbrev.dwo
> # row 2
> .long 0x1b # setting this manually, otherwis llvm-mc crashes
> .long .Labbrev1-.debug_abbrev.dwo
> # Lengths
> # row 0
> .long .Ldebug_info_end1-.Lcu_begin1
> .long .Labbrev_end1-.Labbrev1
> # row 1
> .long .Ldebug_info_end2-.Lcu_begin2
> .long .Labbrev_end1-.Labbrev1
> # row 2
> .long .Ldebug_info_end3-.Lcu_begin3
> .long .Labbrev_end1-.Labbrev1
================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:95
uint64_t getAbbrOffset() const { return AbbrOffset; }
+ void setAbbrOffset(uint64_t Offset) { AbbrOffset = Offset; }
std::optional<uint64_t> getDWOId() const { return DWOId; }
----------------
This change is unneeded/can be removed, yeah?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137882/new/
https://reviews.llvm.org/D137882
More information about the llvm-commits
mailing list