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.
5 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj -o %t
6 # RUN: llvm-dwarfdump --statistics %t | FileCheck %s
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,
13 # Add padding to ensure the function does not start at address zero.
23 .section .debug_ranges,"",@progbits
30 .section .debug_loc,"",@progbits
34 .short 1 # Loc expr size
35 .byte 85 # super-register DW_OP_reg5
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
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
60 .byte 8 # DW_FORM_string
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
69 .byte 8 # DW_FORM_string
71 .byte 19 # DW_FORM_ref4
74 .byte 5 # Abbreviation Code
75 .byte 36 # DW_TAG_base_type
76 .byte 0 # DW_CHILDREN_no
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
87 .section .debug_info,"",@progbits
89 .long .Ldebug_info_end-.Ldebug_info_start # Length of Unit
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
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