262 lines · plain
1# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t --defsym MAIN=02# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.dwp --defsym DWP=03# RUN: %lldb %t -o "target variable A" -o "image lookup -v -n F1" -b | FileCheck %s4# RUN: lldb-test symbols %t | FileCheck %s --check-prefix=SYMBOLS5 6# CHECK-LABEL: target variable A7# CHECK: (INT0) A = 08# CHECK: (INT1) A = 19# CHECK: (INT2) A = 210# CHECK: (INT3) A = 311 12# CHECK-LABEL: image lookup -v -n F113# CHECK: CompileUnit: id = {0x00000001}, file = "1.c", language = "unknown"14# CHECK: Function: {{.*}}, name = "F1", range = [0x0000000000000001-0x0000000000000002)15# CHECK: Variable: {{.*}}, name = "x", type = "int", valid ranges = <block>, location = [0x0000000000000001, 0x0000000000000002) -> DW_OP_reg1 RDX16 17# SYMBOLS: Compile units:18# SYMBOLS-NEXT: CompileUnit{0x00000000}, language = "<not loaded>", file = '0.c'19# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x020# SYMBOLS-NEXT: Function{{.*}}, demangled = F021# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000000-0x00000001)22# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =23# SYMBOLS-NEXT: [0x0000000000000000, 0x0000000000000001): DW_OP_reg0 RAX24# SYMBOLS-EMPTY:25# SYMBOLS-NEXT: CompileUnit{0x00000001}, language = "<not loaded>", file = '1.c'26# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x227# SYMBOLS-NEXT: Function{{.*}}, demangled = F128# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000001-0x00000002)29# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =30# SYMBOLS-NEXT: [0x0000000000000001, 0x0000000000000002): DW_OP_reg1 RDX31# SYMBOLS-EMPTY:32# SYMBOLS-NEXT: CompileUnit{0x00000002}, language = "<not loaded>", file = '2.c'33# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x434# SYMBOLS-NEXT: Function{{.*}}, demangled = F235# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000002-0x00000003)36# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =37# SYMBOLS-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg2 RCX38# SYMBOLS-EMPTY:39# SYMBOLS-NEXT: CompileUnit{0x00000003}, language = "<not loaded>", file = '3.c'40# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x641# SYMBOLS-NEXT: Function{{.*}}, demangled = F342# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000003-0x00000004)43# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =44# SYMBOLS-NEXT: [0x0000000000000003, 0x0000000000000004): DW_OP_reg3 RBX45# SYMBOLS-EMPTY:46# SYMBOLS-NEXT: CompileUnit{0x00000004}, language = "<not loaded>", file = ''47# SYMBOLS-EMPTY:48 49 .section .debug_abbrev,"",@progbits50 .byte 1 # Abbreviation Code51 .byte 17 # DW_TAG_compile_unit52 .byte 0 # DW_CHILDREN_no53 .ascii "\260B" # DW_AT_GNU_dwo_name54 .byte 8 # DW_FORM_string55 .ascii "\261B" # DW_AT_GNU_dwo_id56 .byte 7 # DW_FORM_data857 .ascii "\263B" # DW_AT_GNU_addr_base58 .byte 23 # DW_FORM_sec_offset59 .byte 85 # DW_AT_ranges60 .byte 23 # DW_FORM_sec_offset61 .byte 0 # EOM(1)62 .byte 0 # EOM(2)63 .byte 0 # EOM(3)64 65.ifdef MAIN66.irpc I,0123467 .data68A\I:69 .long \I70 71 .text72F\I:73 nop74 75 .section .debug_info,"",@progbits76.Lcu_begin\I:77 .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit78.Ldebug_info_start\I:79 .short 4 # DWARF version number80 .long .debug_abbrev # Offset Into Abbrev. Section81 .byte 8 # Address Size (in bytes)82 .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit83 .asciz "A.dwo" # DW_AT_GNU_dwo_name84 .quad \I # DW_AT_GNU_dwo_id85 .long .debug_addr # DW_AT_GNU_addr_base86 .long .Lranges\I # DW_AT_ranges87.Ldebug_info_end\I:88 89 .section .debug_addr,"",@progbits90 .quad A\I91 .quad F\I92 93 .section .debug_ranges,"",@progbits94.Lranges\I:95 .quad F\I96 .quad F\I+197 .quad 098 .quad 099.endr100.endif101 102.ifdef DWP103# This deliberately excludes compile unit 4 to check test the case of a missing104# split unit.105.irpc I,0123106 .section .debug_str.dwo,"MSe",@progbits,1107.Lstr\I:108 .byte 'I', 'N', 'T', '0'+\I, 0109 110 .section .debug_str_offsets.dwo,"e",@progbits111.Lstr_offsets\I:112 .long .Lstr\I-.debug_str.dwo113.Lstr_offsets_end\I:114 115 .section .debug_loc.dwo,"e",@progbits116.Lloc\I:117 .byte 3 # DW_LLE_startx_length118 .uleb128 \I*2+1119 .long 1120 .short 1 # Expression size121 .byte 80+\I # super-register DW_OP_reg0+\I122 .byte 0 # DW_LLE_end_of_list123.Lloc_end\I:124 125 .section .debug_abbrev.dwo,"e",@progbits126.Labbrev\I:127 .byte \I*10+1 # Abbreviation Code128 .byte 17 # DW_TAG_compile_unit129 .byte 1 # DW_CHILDREN_yes130 .byte 37 # DW_AT_producer131 .byte 8 # DW_FORM_string132 .byte 3 # DW_AT_name133 .byte 8 # DW_FORM_string134 .byte 0 # EOM(1)135 .byte 0 # EOM(2)136 .byte \I*10+2 # Abbreviation Code137 .byte 52 # DW_TAG_variable138 .byte 0 # DW_CHILDREN_no139 .byte 3 # DW_AT_name140 .byte 8 # DW_FORM_string141 .byte 73 # DW_AT_type142 .byte 19 # DW_FORM_ref4143 .byte 2 # DW_AT_location144 .byte 24 # DW_FORM_exprloc145 .byte 0 # EOM(1)146 .byte 0 # EOM(2)147 .byte \I*10+3 # Abbreviation Code148 .byte 36 # DW_TAG_base_type149 .byte 0 # DW_CHILDREN_no150 .byte 3 # DW_AT_name151 .byte 8 # DW_FORM_string152 .byte 62 # DW_AT_encoding153 .byte 11 # DW_FORM_data1154 .byte 11 # DW_AT_byte_size155 .byte 11 # DW_FORM_data1156 .byte 0 # EOM(1)157 .byte 0 # EOM(2)158 .byte \I*10+4 # Abbreviation Code159 .byte 22 # DW_TAG_typedef160 .byte 0 # DW_CHILDREN_no161 .byte 3 # DW_AT_name162 .uleb128 0x1f02 # DW_FORM_GNU_str_index163 .byte 73 # DW_AT_type164 .byte 19 # DW_FORM_ref4165 .byte 0 # EOM(1)166 .byte 0 # EOM(2)167 .byte \I*10+5 # Abbreviation Code168 .byte 46 # DW_TAG_subprogram169 .byte 1 # DW_CHILDREN_yes170 .byte 17 # DW_AT_low_pc171 .uleb128 0x1f01 # DW_FORM_GNU_addr_index172 .byte 18 # DW_AT_high_pc173 .byte 11 # DW_FORM_data1174 .byte 3 # DW_AT_name175 .byte 8 # DW_FORM_string176 .byte 0 # EOM(1)177 .byte 0 # EOM(2)178 .byte \I*10+6 # Abbreviation Code179 .byte 5 # DW_TAG_formal_parameter180 .byte 0 # DW_CHILDREN_no181 .byte 2 # DW_AT_location182 .byte 23 # DW_FORM_sec_offset183 .byte 3 # DW_AT_name184 .byte 8 # DW_FORM_string185 .byte 73 # DW_AT_type186 .byte 19 # DW_FORM_ref4187 .byte 0 # EOM(1)188 .byte 0 # EOM(2)189 .byte 0 # EOM(3)190.Labbrev_end\I:191 192 .section .debug_info.dwo,"e",@progbits193.Lcu_begin\I:194 .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit195.Ldebug_info_start\I:196 .short 4 # DWARF version number197 .long 0 # Offset Into Abbrev. Section198 .byte 8 # Address Size (in bytes)199 .byte \I*10+1 # Abbrev DW_TAG_compile_unit200 .asciz "Hand-written DWARF" # DW_AT_producer201 .byte '0'+\I, '.', 'c', 0 # DW_AT_name202 .byte \I*10+2 # Abbrev DW_TAG_variable203 .asciz "A" # DW_AT_name204 .long .Ltypedef\I-.Lcu_begin\I# DW_AT_type205 .byte 2 # DW_AT_location206 .byte 0xfb # DW_OP_GNU_addr_index207 .byte \I*2208.Ltypedef\I:209 .byte \I*10+4 # Abbrev DW_TAG_typedef210 .byte 0 # DW_AT_name211 .long .Ltype\I-.Lcu_begin\I # DW_AT_type212.Ltype\I:213 .byte \I*10+3 # Abbrev DW_TAG_base_type214 .asciz "int" # DW_AT_name215 .byte 5 # DW_AT_encoding216 .byte 4 # DW_AT_byte_size217 218 .byte \I*10+5 # Abbrev DW_TAG_subprogram219 .uleb128 \I*2+1 # DW_AT_low_pc220 .byte 1 # DW_AT_high_pc221 .byte 'F', '0'+\I, 0 # DW_AT_name222 223 .byte \I*10+6 # Abbrev DW_TAG_formal_parameter224 .long 0 # DW_AT_location225 .asciz "x" # DW_AT_name226 .long .Ltype\I-.Lcu_begin\I # DW_AT_type227 228 .byte 0 # End Of Children Mark229 .byte 0 # End Of Children Mark230.Ldebug_info_end\I:231.endr232 233 .section .debug_cu_index,"",@progbits234 .short 2 # DWARF version number235 .short 0 # Reserved236 .long 4 # Section count237 .long 4 # Unit count238 .long 8 # Slot count239 240 .quad 0, 1, 2, 3, 0, 0, 0, 0 # Hash table241 .long 1, 2, 3, 4, 0, 0, 0, 0 # Index table242 243 .long 1 # DW_SECT_INFO244 .long 3 # DW_SECT_ABBREV245 .long 5 # DW_SECT_LOC246 .long 6 # DW_SECT_STR_OFFSETS247 248.irpc I,0123249 .long .Lcu_begin\I-.debug_info.dwo250 .long .Labbrev\I-.debug_abbrev.dwo251 .long .Lloc\I-.debug_loc.dwo252 .long .Lstr_offsets\I-.debug_str_offsets.dwo253.endr254.irpc I,0123255 .long .Ldebug_info_end\I-.Lcu_begin\I256 .long .Labbrev_end\I-.Labbrev\I257 .long .Lloc_end\I-.Lloc\I258 .long .Lstr_offsets_end\I-.Lstr_offsets\I259.endr260 261.endif262