189 lines · plain
1# Test handling of (optimized-out/location-less) variables whose value is2# specified by DW_AT_const_value3 4# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t5# RUN: %lldb %t \6# RUN: -o "target variable udata data1 data2 data4 data8 string strp ref4 udata_ptr" \7# RUN: -o "target variable --format x data16" \8# RUN: -o exit | FileCheck %s9 10# CHECK-LABEL: target variable11## Variable specified via DW_FORM_udata. This is typical for clang (10).12# CHECK: (unsigned long) udata = 474247424742474213## Variables specified via fixed-size forms. This is typical for gcc (9).14# CHECK: (unsigned long) data1 = 4715# CHECK: (unsigned long) data2 = 474216# CHECK: (unsigned long) data4 = 4742474217# CHECK: (unsigned long) data8 = 474247424742474218## Variables specified using string forms. This behavior purely speculative -- I19## don't know of any compiler that would represent character strings this way.20# CHECK: (char[7]) string = "string"21# CHECK: (char[7]) strp = "strp"22## Bogus attribute form. Let's make sure we don't crash at least.23# CHECK: (char[7]) ref4 = <empty constant data>24## A variable of pointer type.25# CHECK: (unsigned long *) udata_ptr = 0xdeadbeefbaadf00d26# CHECK: (unsigned __int128) data16 = 0xdeadbeefbaadf00ddeadbeefbaadf00d27 28 29 .section .debug_abbrev,"",@progbits30 .byte 1 # Abbreviation Code31 .byte 17 # DW_TAG_compile_unit32 .byte 1 # DW_CHILDREN_yes33 .byte 37 # DW_AT_producer34 .byte 8 # DW_FORM_string35 .byte 3 # DW_AT_name36 .byte 8 # DW_FORM_string37 .byte 0 # EOM(1)38 .byte 0 # EOM(2)39 .byte 2 # Abbreviation Code40 .byte 15 # DW_TAG_pointer_type41 .byte 0 # DW_CHILDREN_no42 .byte 73 # DW_AT_type43 .byte 19 # DW_FORM_ref444 .byte 0 # EOM(1)45 .byte 0 # EOM(2)46 .byte 4 # Abbreviation Code47 .byte 1 # DW_TAG_array_type48 .byte 1 # DW_CHILDREN_yes49 .byte 73 # DW_AT_type50 .byte 19 # DW_FORM_ref451 .byte 0 # EOM(1)52 .byte 0 # EOM(2)53 .byte 5 # Abbreviation Code54 .byte 33 # DW_TAG_subrange_type55 .byte 0 # DW_CHILDREN_no56 .byte 73 # DW_AT_type57 .byte 19 # DW_FORM_ref458 .byte 55 # DW_AT_count59 .byte 11 # DW_FORM_data160 .byte 0 # EOM(1)61 .byte 0 # EOM(2)62 .byte 6 # Abbreviation Code63 .byte 36 # DW_TAG_base_type64 .byte 0 # DW_CHILDREN_no65 .byte 3 # DW_AT_name66 .byte 8 # DW_FORM_string67 .byte 11 # DW_AT_byte_size68 .byte 11 # DW_FORM_data169 .byte 62 # DW_AT_encoding70 .byte 11 # DW_FORM_data171 .byte 0 # EOM(1)72 .byte 0 # EOM(2)73.macro var code, form74 .byte \code # Abbreviation Code75 .byte 52 # DW_TAG_variable76 .byte 0 # DW_CHILDREN_no77 .byte 3 # DW_AT_name78 .byte 8 # DW_FORM_string79 .byte 73 # DW_AT_type80 .byte 19 # DW_FORM_ref481 .byte 28 # DW_AT_const_value82 .byte \form83 .byte 0 # EOM(1)84 .byte 0 # EOM(2)85.endm86 var 10, 0xf # DW_FORM_udata87 var 11, 0xb # DW_FORM_data188 var 12, 0x5 # DW_FORM_data289 var 13, 0x6 # DW_FORM_data490 var 14, 0x7 # DW_FORM_data891 var 15, 0x8 # DW_FORM_string92 var 16, 0xe # DW_FORM_strp93 var 17, 0x13 # DW_FORM_ref494 var 18, 0x1e # DW_FORM_data1695 .byte 0 # EOM(3)96 .section .debug_info,"",@progbits97.Lcu_begin0:98 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit99.Ldebug_info_start0:100 .short 4 # DWARF version number101 .long .debug_abbrev # Offset Into Abbrev. Section102 .byte 8 # Address Size (in bytes)103 .byte 1 # Abbrev DW_TAG_compile_unit104 .asciz "Hand-written DWARF" # DW_AT_producer105 .asciz "const.c" # DW_AT_name106.Lchar_arr:107 .byte 4 # Abbrev DW_TAG_array_type108 .long .Lchar-.Lcu_begin0 # DW_AT_type109 .byte 5 # Abbrev DW_TAG_subrange_type110 .long .Lulong-.Lcu_begin0 # DW_AT_type111 .byte 7 # DW_AT_count112 .byte 0 # End Of Children Mark113.Lchar:114 .byte 6 # Abbrev DW_TAG_base_type115 .asciz "char" # DW_AT_name116 .byte 1 # DW_AT_byte_size117 .byte 6 # DW_AT_encoding118.Lulong:119 .byte 6 # Abbrev DW_TAG_base_type120 .asciz "unsigned long" # DW_AT_name121 .byte 8 # DW_AT_byte_size122 .byte 7 # DW_AT_encoding123.Lulong_ptr:124 .byte 2 # Abbrev DW_TAG_pointer_type125 .long .Lulong-.Lcu_begin0 # DW_AT_type126.Lu128:127 .byte 6 # Abbrev DW_TAG_base_type128 .asciz "Lu128" # DW_AT_name129 .byte 16 # DW_AT_byte_size130 .byte 7 # DW_AT_encoding131 132 .byte 10 # Abbrev DW_TAG_variable133 .asciz "udata" # DW_AT_name134 .long .Lulong-.Lcu_begin0 # DW_AT_type135 .uleb128 4742474247424742 # DW_AT_const_value136 137 .byte 11 # Abbrev DW_TAG_variable138 .asciz "data1" # DW_AT_name139 .long .Lulong-.Lcu_begin0 # DW_AT_type140 .byte 47 # DW_AT_const_value141 142 .byte 12 # Abbrev DW_TAG_variable143 .asciz "data2" # DW_AT_name144 .long .Lulong-.Lcu_begin0 # DW_AT_type145 .word 4742 # DW_AT_const_value146 147 .byte 13 # Abbrev DW_TAG_variable148 .asciz "data4" # DW_AT_name149 .long .Lulong-.Lcu_begin0 # DW_AT_type150 .long 47424742 # DW_AT_const_value151 152 .byte 14 # Abbrev DW_TAG_variable153 .asciz "data8" # DW_AT_name154 .long .Lulong-.Lcu_begin0 # DW_AT_type155 .quad 4742474247424742 # DW_AT_const_value156 157 .byte 15 # Abbrev DW_TAG_variable158 .asciz "string" # DW_AT_name159 .long .Lchar_arr-.Lcu_begin0 # DW_AT_type160 .asciz "string" # DW_AT_const_value161 162 .byte 16 # Abbrev DW_TAG_variable163 .asciz "strp" # DW_AT_name164 .long .Lchar_arr-.Lcu_begin0 # DW_AT_type165 .long .Lstrp # DW_AT_const_value166 167 .byte 17 # Abbrev DW_TAG_variable168 .asciz "ref4" # DW_AT_name169 .long .Lchar_arr-.Lcu_begin0 # DW_AT_type170 .long .Lulong-.Lcu_begin0 # DW_AT_const_value171 172 .byte 10 # Abbrev DW_TAG_variable173 .asciz "udata_ptr" # DW_AT_name174 .long .Lulong_ptr-.Lcu_begin0 # DW_AT_type175 .uleb128 0xdeadbeefbaadf00d # DW_AT_const_value176 177 .byte 18 # Abbrev DW_TAG_variable178 .asciz "data16" # DW_AT_name179 .long .Lu128-.Lcu_begin0 # DW_AT_type180 .quad 0xdeadbeefbaadf00d # DW_AT_const_value181 .quad 0xdeadbeefbaadf00d # DW_AT_const_value182 183 .byte 0 # End Of Children Mark184.Ldebug_info_end0:185 186 .section .debug_str,"MS",@progbits,1187.Lstrp:188 .asciz "strp"189