[PATCH] D137882: [DWARFLibrary] Add support to re-construct cu-index

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 14:21:54 PST 2022


ayermolo added a comment.

bin/llvm-lit -a /data/users/ayermolo/server-llvm/llvm-project/llvm/test/tools/llvm-dwp/X86/invalid-cu-index.s

F25484289: image.png <https://reviews.llvm.org/F25484289>

bin/llvm-dwarfdump --manaully-generate-unit-index --debug-cu-index /data/users/ayermolo/llvm-build-release/test/tools/llvm-dwp/X86/Output/invalid-cu-index.s.tmp.dwp
F25484297: image.png <https://reviews.llvm.org/F25484297>
bin/llvm-dwarfdump --debug-cu-index /data/users/ayermolo/llvm-build-release/test/tools/llvm-dwp/X86/Output/invalid-cu-index.s.tmp.dwp
F25484301: image.png <https://reviews.llvm.org/F25484301>

  # This test checks that with invalid offset in the cu index
  # we can reconstruct it manually.
  
  # 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.
  
  # CHECK:        0x970c277d61e66cb3
  # CHECK-SAME: [0x00000000, 0xfffffff0)
  # CHECK:      0xd725a83371e7e913
  # CHECK-SAME: [0xfffffff0, 0x0000001b)
  # CHECK:      0x93f541184fb98d75
  # CHECK-SAME: [0x0000001b, 0x00000046)
  
          .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, otherwise 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


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