1f65cfff6SPavel Labath# This tests the computation of the scope bytes covered by local variables. In 2f65cfff6SPavel Labath# particular, the case when the variable starts in the middle of the enclosing 3f65cfff6SPavel Labath# scope, and the compile unit has both DW_AT_ranges and DW_AT_low_pc attributes. 4f65cfff6SPavel Labath 5f65cfff6SPavel Labath# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj -o %t 6f65cfff6SPavel Labath# RUN: llvm-dwarfdump --statistics %t | FileCheck %s 7f65cfff6SPavel Labath 8*481c3b8cSFangrui Song# CHECK: "sum_all_local_vars(#bytes in parent scope)": 12, 9*481c3b8cSFangrui Song# CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 8, 10f65cfff6SPavel Labath 11f65cfff6SPavel Labath .text 12f65cfff6SPavel Labath 13f65cfff6SPavel Labath# Add padding to ensure the function does not start at address zero. 14f65cfff6SPavel Labath .zero 256 15f65cfff6SPavel Labath 16f65cfff6SPavel Labathf: # @f 17f65cfff6SPavel Labath.Lf_begin: 18f65cfff6SPavel Labath .zero 4 19f65cfff6SPavel Labath.Lx_begin: 20f65cfff6SPavel Labath .zero 8 21f65cfff6SPavel Labath.Lf_end: 22f65cfff6SPavel Labath 23f65cfff6SPavel Labath .section .debug_ranges,"",@progbits 24f65cfff6SPavel Labath.Ldebug_ranges: 25f65cfff6SPavel Labath .quad .Lf_begin 26f65cfff6SPavel Labath .quad .Lf_end 27f65cfff6SPavel Labath .quad 0 28f65cfff6SPavel Labath .quad 0 29f65cfff6SPavel Labath 30f65cfff6SPavel Labath .section .debug_loc,"",@progbits 31f65cfff6SPavel Labath.Ldebug_loc: 32f65cfff6SPavel Labath .quad .Lx_begin 33f65cfff6SPavel Labath .quad .Lf_end 34f65cfff6SPavel Labath .short 1 # Loc expr size 35f65cfff6SPavel Labath .byte 85 # super-register DW_OP_reg5 36f65cfff6SPavel Labath .quad 0 37f65cfff6SPavel Labath .quad 0 38f65cfff6SPavel Labath 39f65cfff6SPavel Labath 40f65cfff6SPavel Labath .section .debug_abbrev,"",@progbits 41f65cfff6SPavel Labath .byte 1 # Abbreviation Code 42f65cfff6SPavel Labath .byte 17 # DW_TAG_compile_unit 43f65cfff6SPavel Labath .byte 1 # DW_CHILDREN_yes 44f65cfff6SPavel Labath .byte 37 # DW_AT_producer 45f65cfff6SPavel Labath .byte 8 # DW_FORM_string 46f65cfff6SPavel Labath .byte 17 # DW_AT_low_pc 47f65cfff6SPavel Labath .byte 1 # DW_FORM_addr 48f65cfff6SPavel Labath .byte 85 # DW_AT_ranges 49f65cfff6SPavel Labath .byte 23 # DW_FORM_sec_offset 50f65cfff6SPavel Labath .byte 0 # EOM(1) 51f65cfff6SPavel Labath .byte 0 # EOM(2) 52f65cfff6SPavel Labath .byte 2 # Abbreviation Code 53f65cfff6SPavel Labath .byte 46 # DW_TAG_subprogram 54f65cfff6SPavel Labath .byte 1 # DW_CHILDREN_yes 55f65cfff6SPavel Labath .byte 17 # DW_AT_low_pc 56f65cfff6SPavel Labath .byte 1 # DW_FORM_addr 57f65cfff6SPavel Labath .byte 18 # DW_AT_high_pc 58f65cfff6SPavel Labath .byte 6 # DW_FORM_data4 59f65cfff6SPavel Labath .byte 3 # DW_AT_name 60f65cfff6SPavel Labath .byte 8 # DW_FORM_string 61f65cfff6SPavel Labath .byte 0 # EOM(1) 62f65cfff6SPavel Labath .byte 0 # EOM(2) 63f65cfff6SPavel Labath .byte 3 # Abbreviation Code 64f65cfff6SPavel Labath .byte 52 # DW_TAG_variable 65f65cfff6SPavel Labath .byte 0 # DW_CHILDREN_no 66f65cfff6SPavel Labath .byte 2 # DW_AT_location 67f65cfff6SPavel Labath .byte 23 # DW_FORM_sec_offset 68f65cfff6SPavel Labath .byte 3 # DW_AT_name 69f65cfff6SPavel Labath .byte 8 # DW_FORM_string 70f65cfff6SPavel Labath .byte 73 # DW_AT_type 71f65cfff6SPavel Labath .byte 19 # DW_FORM_ref4 72f65cfff6SPavel Labath .byte 0 # EOM(1) 73f65cfff6SPavel Labath .byte 0 # EOM(2) 74f65cfff6SPavel Labath .byte 5 # Abbreviation Code 75f65cfff6SPavel Labath .byte 36 # DW_TAG_base_type 76f65cfff6SPavel Labath .byte 0 # DW_CHILDREN_no 77f65cfff6SPavel Labath .byte 3 # DW_AT_name 78f65cfff6SPavel Labath .byte 8 # DW_FORM_string 79f65cfff6SPavel Labath .byte 62 # DW_AT_encoding 80f65cfff6SPavel Labath .byte 11 # DW_FORM_data1 81f65cfff6SPavel Labath .byte 11 # DW_AT_byte_size 82f65cfff6SPavel Labath .byte 11 # DW_FORM_data1 83f65cfff6SPavel Labath .byte 0 # EOM(1) 84f65cfff6SPavel Labath .byte 0 # EOM(2) 85f65cfff6SPavel Labath .byte 0 # EOM(3) 86f65cfff6SPavel Labath 87f65cfff6SPavel Labath .section .debug_info,"",@progbits 88f65cfff6SPavel Labath.Lcu_begin: 89f65cfff6SPavel Labath .long .Ldebug_info_end-.Ldebug_info_start # Length of Unit 90f65cfff6SPavel Labath.Ldebug_info_start: 91f65cfff6SPavel Labath .short 4 # DWARF version number 92f65cfff6SPavel Labath .long .debug_abbrev # Offset Into Abbrev. Section 93f65cfff6SPavel Labath .byte 8 # Address Size (in bytes) 94f65cfff6SPavel Labath .byte 1 # Abbrev [1] 0xb:0x64 DW_TAG_compile_unit 95f65cfff6SPavel Labath .asciz "Hand-written DWARF" # DW_AT_producer 96f65cfff6SPavel Labath .quad 0 # DW_AT_low_pc 97f65cfff6SPavel Labath .long .Ldebug_ranges # DW_AT_ranges 98f65cfff6SPavel Labath .byte 2 # Abbrev [2] 0x2a:0x28 DW_TAG_subprogram 99f65cfff6SPavel Labath .quad .Lf_begin # DW_AT_low_pc 100f65cfff6SPavel Labath .long .Lf_end-.Lf_begin # DW_AT_high_pc 101f65cfff6SPavel Labath .asciz "f" # DW_AT_name 102f65cfff6SPavel Labath .byte 3 # Abbrev [3] 0x43:0xe DW_TAG_variable 103f65cfff6SPavel Labath .long .Ldebug_loc # DW_AT_location 104f65cfff6SPavel Labath .asciz "x" # DW_AT_name 105f65cfff6SPavel Labath .long .Lint # DW_AT_type 106f65cfff6SPavel Labath .byte 0 # End Of Children Mark 107f65cfff6SPavel Labath.Lint: 108f65cfff6SPavel Labath .byte 5 # Abbrev [5] 0x67:0x7 DW_TAG_base_type 109f65cfff6SPavel Labath .asciz "int" # DW_AT_name 110f65cfff6SPavel Labath .byte 5 # DW_AT_encoding 111f65cfff6SPavel Labath .byte 4 # DW_AT_byte_size 112f65cfff6SPavel Labath .byte 0 # End Of Children Mark 113f65cfff6SPavel Labath.Ldebug_info_end: 114