2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4 # RUN: llvm-dwarfdump -v %t.o | FileCheck -check-prefix=INPUT %s
5 # INPUT: .debug_info contents:
6 # INPUT: DW_TAG_variable
7 # INPUT-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000027] = "foo")
8 # INPUT-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0033 => {0x00000033} "int")
9 # INPUT-NEXT: DW_AT_external [DW_FORM_flag_present] (true)
10 # INPUT-NEXT: DW_AT_decl_file [DW_FORM_data1] ("/home/path/test.c")
11 # INPUT-NEXT: DW_AT_decl_line [DW_FORM_data1] (1)
12 # INPUT-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0)
13 # INPUT: DW_TAG_variable
14 # INPUT-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002f] = "bar")
15 # INPUT-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0033 => {0x00000033} "int")
16 # INPUT-NEXT: DW_AT_external [DW_FORM_flag_present] (true)
17 # INPUT-NEXT: DW_AT_decl_file [DW_FORM_data1] ("/home/path/test.c")
18 # INPUT-NEXT: DW_AT_decl_line [DW_FORM_data1] (2)
19 # INPUT-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0)
21 ## Check we use information from .debug_info in messages.
22 # RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
23 # CHECK: duplicate symbol: bar
24 # CHECK-NEXT: >>> defined at test.c:2
25 # CHECK-NEXT: >>> {{.*}}:(bar)
26 # CHECK-NEXT: >>> defined at test.c:2
27 # CHECK-NEXT: >>> {{.*}}:(.data+0x0)
28 # CHECK: duplicate symbol: foo
29 # CHECK-NEXT: >>> defined at test.c:1
30 # CHECK-NEXT: >>> {{.*}}:(foo)
31 # CHECK-NEXT: >>> defined at test.c:1
32 # CHECK-NEXT: >>> {{.*}}:(.bss+0x0)
34 # Used reduced output from following code and clang
35 # version 6.0.0 (trunk 316661) to produce this input file:
39 # Invocation: clang -g -S test.c
61 .section .debug_str,"MS",@progbits,1
63 .asciz "clang version 6.0.0"
75 .section .debug_abbrev,"",@progbits
76 .byte 1 # Abbreviation Code
77 .byte 17 # DW_TAG_compile_unit
78 .byte 1 # DW_CHILDREN_yes
79 .byte 37 # DW_AT_producer
80 .byte 14 # DW_FORM_strp
81 .byte 19 # DW_AT_language
82 .byte 5 # DW_FORM_data2
84 .byte 14 # DW_FORM_strp
85 .byte 16 # DW_AT_stmt_list
86 .byte 23 # DW_FORM_sec_offset
87 .byte 27 # DW_AT_comp_dir
88 .byte 14 # DW_FORM_strp
89 .ascii "\264B" # DW_AT_GNU_pubnames
90 .byte 25 # DW_FORM_flag_present
94 .byte 2 # Abbreviation Code
95 .byte 52 # DW_TAG_variable
96 .byte 0 # DW_CHILDREN_no
98 .byte 14 # DW_FORM_strp
100 .byte 19 # DW_FORM_ref4
101 .byte 63 # DW_AT_external
102 .byte 25 # DW_FORM_flag_present
103 .byte 58 # DW_AT_decl_file
104 .byte 11 # DW_FORM_data1
105 .byte 59 # DW_AT_decl_line
106 .byte 11 # DW_FORM_data1
107 .byte 2 # DW_AT_location
108 .byte 24 # DW_FORM_exprloc
112 .byte 3 # Abbreviation Code
113 .byte 36 # DW_TAG_base_type
114 .byte 0 # DW_CHILDREN_no
116 .byte 14 # DW_FORM_strp
117 .byte 62 # DW_AT_encoding
118 .byte 11 # DW_FORM_data1
119 .byte 11 # DW_AT_byte_size
120 .byte 11 # DW_FORM_data1
125 .section .debug_info,"",@progbits
127 .long 76 # Length of Unit
128 .short 4 # DWARF version number
129 .long .debug_abbrev # Offset Into Abbrev. Section
130 .byte 8 # Address Size (in bytes)
132 .byte 1 # Abbrev [1] 0xb:0x45 DW_TAG_compile_unit
133 .long .Linfo_string0 # DW_AT_producer
134 .short 12 # DW_AT_language
135 .long .Linfo_string1 # DW_AT_name
136 .long 0 # DW_AT_stmt_list
137 .long .Linfo_string2 # DW_AT_comp_dir
139 .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable
140 .long .Linfo_string3 # DW_AT_name
141 .long 51 # DW_AT_type
142 .byte 1 # DW_AT_decl_file
143 .byte 1 # DW_AT_decl_line
144 .byte 9 # DW_AT_location
148 .byte 3 # Abbrev [3] 0x33:0x7 DW_TAG_base_type
149 .long .Linfo_string4 # DW_AT_name
150 .byte 5 # DW_AT_encoding
151 .byte 4 # DW_AT_byte_size
153 .byte 2 # Abbrev [2] 0x3a:0x15 DW_TAG_variable
154 .long .Linfo_string5 # DW_AT_name
155 .long 51 # DW_AT_type
156 .byte 1 # DW_AT_decl_file
157 .byte 2 # DW_AT_decl_line
158 .byte 9 # DW_AT_location
161 .byte 0 # End Of Children Mark