1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
# Test handling of (optimized-out/location-less) variables whose value is
# specified by DW_AT_const_value
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
# RUN: %lldb %t \
# RUN: -o "target variable udata data1 data2 data4 data8 string strp ref4 udata_ptr" \
# RUN: -o exit | FileCheck %s
# CHECK-LABEL: target variable
## Variable specified via DW_FORM_udata. This is typical for clang (10).
# CHECK: (unsigned long) udata = 4742474247424742
## Variables specified via fixed-size forms. This is typical for gcc (9).
# CHECK: (unsigned long) data1 = 47
# CHECK: (unsigned long) data2 = 4742
# CHECK: (unsigned long) data4 = 47424742
# CHECK: (unsigned long) data8 = 4742474247424742
## Variables specified using string forms. This behavior purely speculative -- I
## don't know of any compiler that would represent character strings this way.
# CHECK: (char[7]) string = "string"
# CHECK: (char[7]) strp = "strp"
## Bogus attribute form. Let's make sure we don't crash at least.
# CHECK: (char[7]) ref4 = <empty constant data>
## A variable of pointer type.
# CHECK: (unsigned long *) udata_ptr = 0xdeadbeefbaadf00d
.section .debug_abbrev,"",@progbits
.byte 1 # Abbreviation Code
.byte 17 # DW_TAG_compile_unit
.byte 1 # DW_CHILDREN_yes
.byte 37 # DW_AT_producer
.byte 8 # DW_FORM_string
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 2 # Abbreviation Code
.byte 15 # DW_TAG_pointer_type
.byte 0 # DW_CHILDREN_no
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 4 # Abbreviation Code
.byte 1 # DW_TAG_array_type
.byte 1 # DW_CHILDREN_yes
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 5 # Abbreviation Code
.byte 33 # DW_TAG_subrange_type
.byte 0 # DW_CHILDREN_no
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 55 # DW_AT_count
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 6 # Abbreviation Code
.byte 36 # DW_TAG_base_type
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 11 # DW_AT_byte_size
.byte 11 # DW_FORM_data1
.byte 62 # DW_AT_encoding
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.macro var code, form
.byte \code # Abbreviation Code
.byte 52 # DW_TAG_variable
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 28 # DW_AT_const_value
.byte \form
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.endm
var 10, 0xf # DW_FORM_udata
var 11, 0xb # DW_FORM_data1
var 12, 0x5 # DW_FORM_data2
var 13, 0x6 # DW_FORM_data4
var 14, 0x7 # DW_FORM_data8
var 15, 0x8 # DW_FORM_string
var 16, 0xe # DW_FORM_strp
var 17, 0x13 # DW_FORM_ref4
.byte 0 # EOM(3)
.section .debug_info,"",@progbits
.Lcu_begin0:
.long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
.Ldebug_info_start0:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte 1 # Abbrev DW_TAG_compile_unit
.asciz "Hand-written DWARF" # DW_AT_producer
.asciz "const.c" # DW_AT_name
.Lchar_arr:
.byte 4 # Abbrev DW_TAG_array_type
.long .Lchar-.Lcu_begin0 # DW_AT_type
.byte 5 # Abbrev DW_TAG_subrange_type
.long .Lulong-.Lcu_begin0 # DW_AT_type
.byte 7 # DW_AT_count
.byte 0 # End Of Children Mark
.Lchar:
.byte 6 # Abbrev DW_TAG_base_type
.asciz "char" # DW_AT_name
.byte 1 # DW_AT_byte_size
.byte 6 # DW_AT_encoding
.Lulong:
.byte 6 # Abbrev DW_TAG_base_type
.asciz "unsigned long" # DW_AT_name
.byte 8 # DW_AT_byte_size
.byte 7 # DW_AT_encoding
.Lulong_ptr:
.byte 2 # Abbrev DW_TAG_pointer_type
.long .Lulong-.Lcu_begin0 # DW_AT_type
.byte 10 # Abbrev DW_TAG_variable
.asciz "udata" # DW_AT_name
.long .Lulong-.Lcu_begin0 # DW_AT_type
.uleb128 4742474247424742 # DW_AT_const_value
.byte 11 # Abbrev DW_TAG_variable
.asciz "data1" # DW_AT_name
.long .Lulong-.Lcu_begin0 # DW_AT_type
.byte 47 # DW_AT_const_value
.byte 12 # Abbrev DW_TAG_variable
.asciz "data2" # DW_AT_name
.long .Lulong-.Lcu_begin0 # DW_AT_type
.word 4742 # DW_AT_const_value
.byte 13 # Abbrev DW_TAG_variable
.asciz "data4" # DW_AT_name
.long .Lulong-.Lcu_begin0 # DW_AT_type
.long 47424742 # DW_AT_const_value
.byte 14 # Abbrev DW_TAG_variable
.asciz "data8" # DW_AT_name
.long .Lulong-.Lcu_begin0 # DW_AT_type
.quad 4742474247424742 # DW_AT_const_value
.byte 15 # Abbrev DW_TAG_variable
.asciz "string" # DW_AT_name
.long .Lchar_arr-.Lcu_begin0 # DW_AT_type
.asciz "string" # DW_AT_const_value
.byte 16 # Abbrev DW_TAG_variable
.asciz "strp" # DW_AT_name
.long .Lchar_arr-.Lcu_begin0 # DW_AT_type
.long .Lstrp # DW_AT_const_value
.byte 17 # Abbrev DW_TAG_variable
.asciz "ref4" # DW_AT_name
.long .Lchar_arr-.Lcu_begin0 # DW_AT_type
.long .Lulong-.Lcu_begin0 # DW_AT_const_value
.byte 10 # Abbrev DW_TAG_variable
.asciz "udata_ptr" # DW_AT_name
.long .Lulong_ptr-.Lcu_begin0 # DW_AT_type
.uleb128 0xdeadbeefbaadf00d # DW_AT_const_value
.byte 0 # End Of Children Mark
.Ldebug_info_end0:
.section .debug_str,"MS",@progbits,1
.Lstrp:
.asciz "strp"
|