119 lines · plain
1## This test checks that looking up a zero hash in the .debug_cu_index hash2## table works correctly when there's no CU with signature = 0.3##4## LLVM used to check just the signature bits to decide if the hash lookup ended5## at a match or at an empty slot. This is wrong when signature = 0 because6## empty slots have all zeros in the signature field too, and LLVM would return7## the empty slot as a valid result.8 9# REQUIRES: x86-registered-target10 11# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t --defsym MAIN=012# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t.dwp13# RUN: llvm-symbolizer --obj=%t --dwp=%t.dwp 0x0 | FileCheck %s14 15## This expected output is very uninteresting, but it's better than a crash.16# CHECK: ??:0:017 18 .section .debug_abbrev,"",@progbits19 .byte 1 # Abbreviation Code20 .byte 17 # DW_TAG_compile_unit21 .byte 0 # DW_CHILDREN_no22 .ascii "\260B" # DW_AT_GNU_dwo_name23 .byte 8 # DW_FORM_string24 .ascii "\261B" # DW_AT_GNU_dwo_id25 .byte 7 # DW_FORM_data826 .ascii "\263B" # DW_AT_GNU_addr_base27 .byte 23 # DW_FORM_sec_offset28 .byte 85 # DW_AT_ranges29 .byte 23 # DW_FORM_sec_offset30 .byte 0 # EOM(1)31 .byte 0 # EOM(2)32 .byte 0 # EOM(3)33 34## Create two CUs, with dwo_ids 0 and 1 respectively.35.ifdef MAIN36.irpc I,0137 .data38A\I:39 .long \I40 41 .text42F\I:43 nop44 45 .section .debug_info,"",@progbits46.Lcu_begin\I:47 .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit48.Ldebug_info_start\I:49 .short 4 # DWARF version number50 .long .debug_abbrev # Offset Into Abbrev. Section51 .byte 8 # Address Size (in bytes)52 .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit53 .asciz "A.dwo" # DW_AT_GNU_dwo_name54 .quad \I # DW_AT_GNU_dwo_id55 .long .debug_addr # DW_AT_GNU_addr_base56 .long .Lranges\I # DW_AT_ranges57.Ldebug_info_end\I:58 59 .section .debug_addr,"",@progbits60 .quad A\I61 .quad F\I62 63 .section .debug_ranges,"",@progbits64.Lranges\I:65 .quad F\I66 .quad F\I+167 .quad 068 .quad 069.endr70.else71## Deliberately omit compile unit 0 in the DWP. We want to check the case where72## a signature = 0 matches an empty hash slot in .debug_cu_index and the index73## in the parallel table has to be checked.74 .section .debug_abbrev.dwo,"e",@progbits75.Labbrev1:76 .byte 1 # Abbreviation Code77 .byte 17 # DW_TAG_compile_unit78 .byte 0 # DW_CHILDREN_no79 .byte 37 # DW_AT_producer80 .byte 8 # DW_FORM_string81 .byte 3 # DW_AT_name82 .byte 8 # DW_FORM_string83 .byte 0 # EOM(1)84 .byte 0 # EOM(2)85 .byte 0 # EOM(3)86.Labbrev_end1:87 88 .section .debug_info.dwo,"e",@progbits89.Lcu_begin1:90 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit91.Ldebug_info_start1:92 .short 4 # DWARF version number93 .long 0 # Offset Into Abbrev. Section94 .byte 8 # Address Size (in bytes)95 .byte 1 # Abbrev DW_TAG_compile_unit96 .asciz "Hand-written DWARF" # DW_AT_producer97 .byte '1', '.', 'c', 0 # DW_AT_name98.Ldebug_info_end1:99 100 .section .debug_cu_index,"",@progbits101 .long 2 # DWARF version number102 .long 2 # Section count103 .long 1 # Unit count104 .long 8 # Slot count105 106 .quad 1, 0, 0, 0, 0, 0, 0, 0 # Hash table107 .long 1, 0, 0, 0, 0, 0, 0, 0 # Index table108 109 .long 1 # DW_SECT_INFO110 .long 3 # DW_SECT_ABBREV111 112 .long .Lcu_begin1-.debug_info.dwo113 .long .Labbrev1-.debug_abbrev.dwo114 115 .long .Ldebug_info_end1-.Lcu_begin1116 .long .Labbrev_end1-.Labbrev1117 118.endif119