162 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o3 4# RUN: llvm-dwarfdump -v %t.o | FileCheck -check-prefix=INPUT %s5# INPUT: .debug_info contents:6# INPUT: DW_TAG_variable7# 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_variable14# 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)20 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 %s23# CHECK: duplicate symbol: bar24# CHECK-NEXT: >>> defined at test.c:225# CHECK-NEXT: >>> {{.*}}:(bar)26# CHECK-NEXT: >>> defined at test.c:227# CHECK-NEXT: >>> {{.*}}:(.data+0x0)28# CHECK: duplicate symbol: foo29# CHECK-NEXT: >>> defined at test.c:130# CHECK-NEXT: >>> {{.*}}:(foo)31# CHECK-NEXT: >>> defined at test.c:132# CHECK-NEXT: >>> {{.*}}:(.bss+0x0)33 34# Used reduced output from following code and clang35# version 6.0.0 (trunk 316661) to produce this input file:36# Source (test.c):37# int foo = 0;38# int bar = 1;39# Invocation: clang -g -S test.c40 41.text42.file "test.c"43.file 1 "test.c"44 45.type bar,@object46.data47.globl bar48.p2align 249bar:50 .long 151 .size bar, 452 53.type foo,@object54.bss55.globl foo56.p2align 257foo:58 .long 059 .size foo, 460 61.section .debug_str,"MS",@progbits,162.Linfo_string0:63 .asciz "clang version 6.0.0"64.Linfo_string1:65 .asciz "test.c"66.Linfo_string2:67 .asciz "/home/path/"68.Linfo_string3:69 .asciz "foo"70.Linfo_string4:71 .asciz "int"72.Linfo_string5:73 .asciz "bar"74 75.section .debug_abbrev,"",@progbits76 .byte 1 # Abbreviation Code77 .byte 17 # DW_TAG_compile_unit78 .byte 1 # DW_CHILDREN_yes79 .byte 37 # DW_AT_producer80 .byte 14 # DW_FORM_strp81 .byte 19 # DW_AT_language82 .byte 5 # DW_FORM_data283 .byte 3 # DW_AT_name84 .byte 14 # DW_FORM_strp85 .byte 16 # DW_AT_stmt_list86 .byte 23 # DW_FORM_sec_offset87 .byte 27 # DW_AT_comp_dir88 .byte 14 # DW_FORM_strp89 .ascii "\264B" # DW_AT_GNU_pubnames90 .byte 25 # DW_FORM_flag_present91 .byte 0 # EOM(1)92 .byte 0 # EOM(2)93 94 .byte 2 # Abbreviation Code95 .byte 52 # DW_TAG_variable96 .byte 0 # DW_CHILDREN_no97 .byte 3 # DW_AT_name98 .byte 14 # DW_FORM_strp99 .byte 73 # DW_AT_type100 .byte 19 # DW_FORM_ref4101 .byte 63 # DW_AT_external102 .byte 25 # DW_FORM_flag_present103 .byte 58 # DW_AT_decl_file104 .byte 11 # DW_FORM_data1105 .byte 59 # DW_AT_decl_line106 .byte 11 # DW_FORM_data1107 .byte 2 # DW_AT_location108 .byte 24 # DW_FORM_exprloc109 .byte 0 # EOM(1)110 .byte 0 # EOM(2)111 112 .byte 3 # Abbreviation Code113 .byte 36 # DW_TAG_base_type114 .byte 0 # DW_CHILDREN_no115 .byte 3 # DW_AT_name116 .byte 14 # DW_FORM_strp117 .byte 62 # DW_AT_encoding118 .byte 11 # DW_FORM_data1119 .byte 11 # DW_AT_byte_size120 .byte 11 # DW_FORM_data1121 .byte 0 # EOM(1)122 .byte 0 # EOM(2)123 .byte 0 # EOM(3)124 125.section .debug_info,"",@progbits126.Lcu_begin0:127 .long 76 # Length of Unit128 .short 4 # DWARF version number129 .long .debug_abbrev # Offset Into Abbrev. Section130 .byte 8 # Address Size (in bytes)131 132 .byte 1 # Abbrev [1] 0xb:0x45 DW_TAG_compile_unit133 .long .Linfo_string0 # DW_AT_producer134 .short 12 # DW_AT_language135 .long .Linfo_string1 # DW_AT_name136 .long 0 # DW_AT_stmt_list137 .long .Linfo_string2 # DW_AT_comp_dir138 139 .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable140 .long .Linfo_string3 # DW_AT_name141 .long 51 # DW_AT_type142 .byte 1 # DW_AT_decl_file143 .byte 1 # DW_AT_decl_line144 .byte 9 # DW_AT_location145 .byte 3146 .quad foo147 148 .byte 3 # Abbrev [3] 0x33:0x7 DW_TAG_base_type149 .long .Linfo_string4 # DW_AT_name150 .byte 5 # DW_AT_encoding151 .byte 4 # DW_AT_byte_size152 153 .byte 2 # Abbrev [2] 0x3a:0x15 DW_TAG_variable154 .long .Linfo_string5 # DW_AT_name155 .long 51 # DW_AT_type156 .byte 1 # DW_AT_decl_file157 .byte 2 # DW_AT_decl_line158 .byte 9 # DW_AT_location159 .byte 3160 .quad bar161 .byte 0 # End Of Children Mark162