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