1 ## This test checks that looking up a zero hash in the .debug_cu_index hash
2 ## table works correctly when there's no CU with signature = 0.
4 ## LLVM used to check just the signature bits to decide if the hash lookup ended
5 ## at a match or at an empty slot. This is wrong when signature = 0 because
6 ## empty slots have all zeros in the signature field too, and LLVM would return
7 ## the empty slot as a valid result.
9 # REQUIRES: x86-registered-target
11 # RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t --defsym MAIN=0
12 # RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t.dwp
13 # RUN: llvm-symbolizer --obj=%t --dwp=%t.dwp 0x0 | FileCheck %s
15 ## This expected output is very uninteresting, but it's better than a crash.
18 .section .debug_abbrev,"",@progbits
19 .byte 1 # Abbreviation Code
20 .byte 17 # DW_TAG_compile_unit
21 .byte 0 # DW_CHILDREN_no
22 .ascii "\260B" # DW_AT_GNU_dwo_name
23 .byte 8 # DW_FORM_string
24 .ascii "\261B" # DW_AT_GNU_dwo_id
25 .byte 7 # DW_FORM_data8
26 .ascii "\263B" # DW_AT_GNU_addr_base
27 .byte 23 # DW_FORM_sec_offset
28 .byte 85 # DW_AT_ranges
29 .byte 23 # DW_FORM_sec_offset
34 ## Create two CUs, with dwo_ids 0 and 1 respectively.
45 .section .debug_info,"",@progbits
47 .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit
49 .short 4 # DWARF version number
50 .long .debug_abbrev # Offset Into Abbrev. Section
51 .byte 8 # Address Size (in bytes)
52 .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
53 .asciz "A.dwo" # DW_AT_GNU_dwo_name
54 .quad \I # DW_AT_GNU_dwo_id
55 .long .debug_addr # DW_AT_GNU_addr_base
56 .long .Lranges\I # DW_AT_ranges
59 .section .debug_addr,"",@progbits
63 .section .debug_ranges,"",@progbits
71 ## Deliberately omit compile unit 0 in the DWP. We want to check the case where
72 ## a signature = 0 matches an empty hash slot in .debug_cu_index and the index
73 ## in the parallel table has to be checked.
74 .section .debug_abbrev.dwo,"e",@progbits
76 .byte 1 # Abbreviation Code
77 .byte 17 # DW_TAG_compile_unit
78 .byte 0 # DW_CHILDREN_no
79 .byte 37 # DW_AT_producer
80 .byte 8 # DW_FORM_string
82 .byte 8 # DW_FORM_string
88 .section .debug_info.dwo,"e",@progbits
90 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
92 .short 4 # DWARF version number
93 .long 0 # Offset Into Abbrev. Section
94 .byte 8 # Address Size (in bytes)
95 .byte 1 # Abbrev DW_TAG_compile_unit
96 .asciz "Hand-written DWARF" # DW_AT_producer
97 .byte '1', '.', 'c', 0 # DW_AT_name
100 .section .debug_cu_index,"",@progbits
101 .long 2 # DWARF version number
102 .long 2 # Section count
106 .quad 1, 0, 0, 0, 0, 0, 0, 0 # Hash table
107 .long 1, 0, 0, 0, 0, 0, 0, 0 # Index table
109 .long 1 # DW_SECT_INFO
110 .long 3 # DW_SECT_ABBREV
112 .long .Lcu_begin1-.debug_info.dwo
113 .long .Labbrev1-.debug_abbrev.dwo
115 .long .Ldebug_info_end1-.Lcu_begin1
116 .long .Labbrev_end1-.Labbrev1