• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: yaml2obj %s | llvm-dwarfdump --statistics - | FileCheck %s
2
3## Check that coverage for variable locations which do not cover the parent
4## scope is tracked separately in "sum_all_variables(#bytes in any scope
5## covered by DW_AT_location)".
6##
7## The yaml represents this DWARF:
8##
9## DW_TAG_compile_unit
10##   DW_AT_low_pc	(0x0000000000000000)
11##   DW_AT_high_pc	(0x000000000000000b)
12##
13##   DW_TAG_subprogram
14##     DW_AT_low_pc	(0x0000000000000000)
15##     DW_AT_high_pc	(0x000000000000000b)
16##
17##     DW_TAG_lexical_block
18##       DW_AT_ranges	(0x00000000
19##          [0x0000000000000000, 0x0000000000000003)
20##          [0x0000000000000005, 0x0000000000000008))
21##
22##       // #bytes in parent scope: 6
23##       // #bytes in any scope covered by DW_AT_location: 6
24##       // #bytes in parent scope covered by DW_AT_location: 4
25##       DW_TAG_variable
26##         DW_AT_location	(0x00000000:
27##            [0x0000000000000000, 0x0000000000000006): DW_OP_reg5 RDI)
28##
29##       // #bytes in parent scope: 6
30##       // #bytes in any scope covered by DW_AT_location: 2
31##       // #bytes in parent scope covered by DW_AT_location: 0
32##       DW_TAG_variable
33##         DW_AT_location	(0x00000023:
34##            [0x0000000000000003, 0x0000000000000005): DW_OP_reg2 RCX)
35
36# CHECK: "version": 6,
37# CHECK: "sum_all_variables(#bytes in parent scope)": 12,
38# CHECK: "sum_all_variables(#bytes in any scope covered by DW_AT_location)": 8
39# CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 4
40
41--- !ELF
42FileHeader:
43  Class:   ELFCLASS64
44  Data:    ELFDATA2LSB
45  Type:    ET_EXEC
46  Machine: EM_X86_64
47Sections:
48  - Name:         .debug_loc
49    Type:         SHT_PROGBITS
50    AddressAlign: 0x01
51    Content:      '00000000000000000600000000000000010055000000000000000000000000000000000300000000000000050000000000000001005200000000000000000000000000000000'
52  - Name:         .debug_ranges
53    Type:         SHT_PROGBITS
54    AddressAlign: 0x01
55    Content:      '000000000000000003000000000000000500000000000000080000000000000000000000000000000000000000000000'
56DWARF:
57  debug_abbrev:
58    - Table:
59      - Code:     1
60        Tag:      DW_TAG_compile_unit
61        Children: DW_CHILDREN_yes
62        Attributes:
63          - Attribute: DW_AT_low_pc
64            Form:      DW_FORM_addr
65          - Attribute: DW_AT_high_pc
66            Form:      DW_FORM_data4
67      - Code:     2
68        Tag:      DW_TAG_subprogram
69        Children: DW_CHILDREN_yes
70        Attributes:
71          - Attribute: DW_AT_low_pc
72            Form:      DW_FORM_addr
73          - Attribute: DW_AT_high_pc
74            Form:      DW_FORM_data4
75      - Code:     3
76        Tag:      DW_TAG_lexical_block
77        Children: DW_CHILDREN_yes
78        Attributes:
79          - Attribute: DW_AT_ranges
80            Form:      DW_FORM_sec_offset
81      - Code:     4
82        Tag:      DW_TAG_variable
83        Children: DW_CHILDREN_no
84        Attributes:
85          - Attribute: DW_AT_location
86            Form:      DW_FORM_sec_offset
87  debug_info:
88    - Version:    4
89      AbbrOffset: 0x00
90      Entries:
91        - AbbrCode: 1 ## DW_TAG_compile_unit
92          Values:
93            - Value: 0x00 ## DW_AT_low_pc
94            - Value: 0x0b ## DW_AT_high_pc
95        - AbbrCode: 2 ## DW_TAG_subprogram
96          Values:
97            - Value: 0x00 ## DW_AT_low_pc
98            - Value: 0x0b ## DW_AT_high_pc
99        - AbbrCode: 3 ## DW_TAG_lexical_block
100          Values:
101            - Value: 0x00 ## DW_AT_ranges
102        - AbbrCode: 4 ## DW_TAG_variable
103          Values:
104            - Value: 0x00 ## DW_AT_sec_offset
105        - AbbrCode: 4 ## DW_TAG_variable
106          Values:
107            - Value: 0x23 ## DW_AT_sec_offset
108        - AbbrCode: 0 ## NULL
109        - AbbrCode: 0 ## NULL
110        - AbbrCode: 0 ## NULL
111