1*c0e1ad77SPavel Labath## Check that lldb can locate a static constant variable when its declaration is 2*c0e1ad77SPavel Labath## referenced by a debug_names index. This is a non-conforming extension used by 3*c0e1ad77SPavel Labath## dsymutil. 4*c0e1ad77SPavel Labath 5*c0e1ad77SPavel Labath# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t 6*c0e1ad77SPavel Labath# RUN: %lldb %t -o "target variable Class::constant" \ 7*c0e1ad77SPavel Labath# RUN: -o "expr -l c++ -- Class::constant" -o exit | FileCheck %s 8*c0e1ad77SPavel Labath 9*c0e1ad77SPavel Labath# CHECK: (lldb) target variable Class::constant 10*c0e1ad77SPavel Labath# CHECK-NEXT: (const int) Class::constant = 47 11*c0e1ad77SPavel Labath# CHECK: (lldb) expr -l c++ -- Class::constant 12*c0e1ad77SPavel Labath# CHECK-NEXT: (const int) $0 = 47 13*c0e1ad77SPavel Labath 14*c0e1ad77SPavel Labath .section .debug_abbrev,"",@progbits 15*c0e1ad77SPavel Labath .byte 1 # Abbreviation Code 16*c0e1ad77SPavel Labath .byte 17 # DW_TAG_compile_unit 17*c0e1ad77SPavel Labath .byte 1 # DW_CHILDREN_yes 18*c0e1ad77SPavel Labath .byte 37 # DW_AT_producer 19*c0e1ad77SPavel Labath .byte 8 # DW_FORM_string 20*c0e1ad77SPavel Labath .byte 19 # DW_AT_language 21*c0e1ad77SPavel Labath .byte 5 # DW_FORM_data2 22*c0e1ad77SPavel Labath .byte 0 # EOM(1) 23*c0e1ad77SPavel Labath .byte 0 # EOM(2) 24*c0e1ad77SPavel Labath .byte 3 # Abbreviation Code 25*c0e1ad77SPavel Labath .byte 2 # DW_TAG_class_type 26*c0e1ad77SPavel Labath .byte 1 # DW_CHILDREN_yes 27*c0e1ad77SPavel Labath .byte 54 # DW_AT_calling_convention 28*c0e1ad77SPavel Labath .byte 11 # DW_FORM_data1 29*c0e1ad77SPavel Labath .byte 3 # DW_AT_name 30*c0e1ad77SPavel Labath .byte 14 # DW_FORM_strp 31*c0e1ad77SPavel Labath .byte 11 # DW_AT_byte_size 32*c0e1ad77SPavel Labath .byte 11 # DW_FORM_data1 33*c0e1ad77SPavel Labath .byte 0 # EOM(1) 34*c0e1ad77SPavel Labath .byte 0 # EOM(2) 35*c0e1ad77SPavel Labath .byte 4 # Abbreviation Code 36*c0e1ad77SPavel Labath .byte 52 # DW_TAG_variable 37*c0e1ad77SPavel Labath .byte 0 # DW_CHILDREN_no 38*c0e1ad77SPavel Labath .byte 3 # DW_AT_name 39*c0e1ad77SPavel Labath .byte 14 # DW_FORM_strp 40*c0e1ad77SPavel Labath .byte 73 # DW_AT_type 41*c0e1ad77SPavel Labath .byte 19 # DW_FORM_ref4 42*c0e1ad77SPavel Labath .byte 63 # DW_AT_external 43*c0e1ad77SPavel Labath .byte 25 # DW_FORM_flag_present 44*c0e1ad77SPavel Labath .byte 60 # DW_AT_declaration 45*c0e1ad77SPavel Labath .byte 25 # DW_FORM_flag_present 46*c0e1ad77SPavel Labath .byte 28 # DW_AT_const_value 47*c0e1ad77SPavel Labath .byte 13 # DW_FORM_sdata 48*c0e1ad77SPavel Labath .byte 0 # EOM(1) 49*c0e1ad77SPavel Labath .byte 0 # EOM(2) 50*c0e1ad77SPavel Labath .byte 5 # Abbreviation Code 51*c0e1ad77SPavel Labath .byte 38 # DW_TAG_const_type 52*c0e1ad77SPavel Labath .byte 0 # DW_CHILDREN_no 53*c0e1ad77SPavel Labath .byte 73 # DW_AT_type 54*c0e1ad77SPavel Labath .byte 19 # DW_FORM_ref4 55*c0e1ad77SPavel Labath .byte 0 # EOM(1) 56*c0e1ad77SPavel Labath .byte 0 # EOM(2) 57*c0e1ad77SPavel Labath .byte 6 # Abbreviation Code 58*c0e1ad77SPavel Labath .byte 36 # DW_TAG_base_type 59*c0e1ad77SPavel Labath .byte 0 # DW_CHILDREN_no 60*c0e1ad77SPavel Labath .byte 3 # DW_AT_name 61*c0e1ad77SPavel Labath .byte 14 # DW_FORM_strp 62*c0e1ad77SPavel Labath .byte 62 # DW_AT_encoding 63*c0e1ad77SPavel Labath .byte 11 # DW_FORM_data1 64*c0e1ad77SPavel Labath .byte 11 # DW_AT_byte_size 65*c0e1ad77SPavel Labath .byte 11 # DW_FORM_data1 66*c0e1ad77SPavel Labath .byte 0 # EOM(1) 67*c0e1ad77SPavel Labath .byte 0 # EOM(2) 68*c0e1ad77SPavel Labath .byte 0 # EOM(3) 69*c0e1ad77SPavel Labath .section .debug_info,"",@progbits 70*c0e1ad77SPavel Labath.Lcu_begin0: 71*c0e1ad77SPavel Labath .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 72*c0e1ad77SPavel Labath.Ldebug_info_start0: 73*c0e1ad77SPavel Labath .short 5 # DWARF version number 74*c0e1ad77SPavel Labath .byte 1 # DWARF Unit Type 75*c0e1ad77SPavel Labath .byte 8 # Address Size (in bytes) 76*c0e1ad77SPavel Labath .long .debug_abbrev # Offset Into Abbrev. Section 77*c0e1ad77SPavel Labath .byte 1 # Abbrev [1] 0xc:0x40 DW_TAG_compile_unit 78*c0e1ad77SPavel Labath .asciz "Hand-written DWARF" # DW_AT_producer 79*c0e1ad77SPavel Labath .short 33 # DW_AT_language 80*c0e1ad77SPavel Labath.LClass: 81*c0e1ad77SPavel Labath .byte 3 # Abbrev [3] 0x29:0x10 DW_TAG_class_type 82*c0e1ad77SPavel Labath .byte 5 # DW_AT_calling_convention 83*c0e1ad77SPavel Labath .long .Linfo_string4 # DW_AT_name 84*c0e1ad77SPavel Labath .byte 1 # DW_AT_byte_size 85*c0e1ad77SPavel Labath.Lvariable: 86*c0e1ad77SPavel Labath .byte 4 # Abbrev [4] 0x2f:0x9 DW_TAG_variable 87*c0e1ad77SPavel Labath .long .Linfo_string5 # DW_AT_name 88*c0e1ad77SPavel Labath .long .Lconst_int-.Lcu_begin0 # DW_AT_type 89*c0e1ad77SPavel Labath # DW_AT_external 90*c0e1ad77SPavel Labath # DW_AT_declaration 91*c0e1ad77SPavel Labath .byte 47 # DW_AT_const_value 92*c0e1ad77SPavel Labath .byte 0 # End Of Children Mark 93*c0e1ad77SPavel Labath.Lconst_int: 94*c0e1ad77SPavel Labath .byte 5 # Abbrev [5] 0x39:0x5 DW_TAG_const_type 95*c0e1ad77SPavel Labath .long .Lint-.Lcu_begin0 # DW_AT_type 96*c0e1ad77SPavel Labath.Lint: 97*c0e1ad77SPavel Labath .byte 6 # Abbrev [6] 0x3e:0x4 DW_TAG_base_type 98*c0e1ad77SPavel Labath .long .Linfo_string6 # DW_AT_name 99*c0e1ad77SPavel Labath .byte 5 # DW_AT_encoding 100*c0e1ad77SPavel Labath .byte 4 # DW_AT_byte_size 101*c0e1ad77SPavel Labath .byte 0 # End Of Children Mark 102*c0e1ad77SPavel Labath.Ldebug_info_end0: 103*c0e1ad77SPavel Labath 104*c0e1ad77SPavel Labath .section .debug_str,"MS",@progbits,1 105*c0e1ad77SPavel Labath.Linfo_string4: 106*c0e1ad77SPavel Labath .asciz "Class" 107*c0e1ad77SPavel Labath.Linfo_string5: 108*c0e1ad77SPavel Labath .asciz "constant" 109*c0e1ad77SPavel Labath.Linfo_string6: 110*c0e1ad77SPavel Labath .asciz "int" 111*c0e1ad77SPavel Labath 112*c0e1ad77SPavel Labath .section .debug_names,"",@progbits 113*c0e1ad77SPavel Labath .long .Lnames_end0-.Lnames_start0 # Header: unit length 114*c0e1ad77SPavel Labath.Lnames_start0: 115*c0e1ad77SPavel Labath .short 5 # Header: version 116*c0e1ad77SPavel Labath .short 0 # Header: padding 117*c0e1ad77SPavel Labath .long 1 # Header: compilation unit count 118*c0e1ad77SPavel Labath .long 0 # Header: local type unit count 119*c0e1ad77SPavel Labath .long 0 # Header: foreign type unit count 120*c0e1ad77SPavel Labath .long 0 # Header: bucket count 121*c0e1ad77SPavel Labath .long 3 # Header: name count 122*c0e1ad77SPavel Labath .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size 123*c0e1ad77SPavel Labath .long 8 # Header: augmentation string size 124*c0e1ad77SPavel Labath .ascii "LLVM0700" # Header: augmentation string 125*c0e1ad77SPavel Labath .long .Lcu_begin0 # Compilation unit 0 126*c0e1ad77SPavel Labath .long .Linfo_string4 # String: Class 127*c0e1ad77SPavel Labath .long .Linfo_string5 # String: constant 128*c0e1ad77SPavel Labath .long .Linfo_string6 # String: int 129*c0e1ad77SPavel Labath .long .Lnames0-.Lnames_entries0 130*c0e1ad77SPavel Labath .long .Lnames3-.Lnames_entries0 131*c0e1ad77SPavel Labath .long .Lnames1-.Lnames_entries0 132*c0e1ad77SPavel Labath.Lnames_abbrev_start0: 133*c0e1ad77SPavel Labath .byte 1 # Abbrev code 134*c0e1ad77SPavel Labath .byte 2 # DW_TAG_class_type 135*c0e1ad77SPavel Labath .byte 3 # DW_IDX_die_offset 136*c0e1ad77SPavel Labath .byte 19 # DW_FORM_ref4 137*c0e1ad77SPavel Labath .byte 0 # End of abbrev 138*c0e1ad77SPavel Labath .byte 0 # End of abbrev 139*c0e1ad77SPavel Labath .byte 2 # Abbrev code 140*c0e1ad77SPavel Labath .byte 52 # DW_TAG_variable 141*c0e1ad77SPavel Labath .byte 3 # DW_IDX_die_offset 142*c0e1ad77SPavel Labath .byte 19 # DW_FORM_ref4 143*c0e1ad77SPavel Labath .byte 0 # End of abbrev 144*c0e1ad77SPavel Labath .byte 0 # End of abbrev 145*c0e1ad77SPavel Labath .byte 3 # Abbrev code 146*c0e1ad77SPavel Labath .byte 36 # DW_TAG_base_type 147*c0e1ad77SPavel Labath .byte 3 # DW_IDX_die_offset 148*c0e1ad77SPavel Labath .byte 19 # DW_FORM_ref4 149*c0e1ad77SPavel Labath .byte 0 # End of abbrev 150*c0e1ad77SPavel Labath .byte 0 # End of abbrev 151*c0e1ad77SPavel Labath .byte 0 # End of abbrev list 152*c0e1ad77SPavel Labath.Lnames_abbrev_end0: 153*c0e1ad77SPavel Labath.Lnames_entries0: 154*c0e1ad77SPavel Labath.Lnames0: 155*c0e1ad77SPavel Labath .byte 1 # Abbreviation code 156*c0e1ad77SPavel Labath .long .LClass-.Lcu_begin0 # DW_IDX_die_offset 157*c0e1ad77SPavel Labath .byte 0 # DW_IDX_parent 158*c0e1ad77SPavel Labath # End of list: Class 159*c0e1ad77SPavel Labath.Lnames3: 160*c0e1ad77SPavel Labath .byte 2 # Abbreviation code 161*c0e1ad77SPavel Labath .long .Lvariable-.Lcu_begin0 # DW_IDX_die_offset 162*c0e1ad77SPavel Labath .byte 0 # DW_IDX_parent 163*c0e1ad77SPavel Labath # End of list: constant 164*c0e1ad77SPavel Labath.Lnames1: 165*c0e1ad77SPavel Labath .byte 3 # Abbreviation code 166*c0e1ad77SPavel Labath .long .Lint-.Lcu_begin0 # DW_IDX_die_offset 167*c0e1ad77SPavel Labath .byte 0 # DW_IDX_parent 168*c0e1ad77SPavel Labath # End of list: int 169*c0e1ad77SPavel Labath.Lnames_end0: 170