xref: /llvm-project/llvm/test/tools/llvm-locstats/locstats-bytes-overflow.yaml (revision 40c2bdf6d191fa475a968692f317e660d6425be6)
1# RUN: yaml2obj %s -o %t.o
2# RUN: %llvm-locstats %t.o 2>&1 | FileCheck %s
3# RUN: rm %t.o
4
5## Check that we are covering the situation when a stat field overflows.
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  (0xffffffffffffffff)
16##       DW_TAG_variable
17##         DW_AT_location (0x00000023:
18##            [0x0000000000000003, 0x0000000000000005): DW_OP_reg2 RCX)
19##   DW_TAG_subprogram
20##     DW_AT_low_pc    (0x0000000000000000)
21##     DW_AT_high_pc   (0xffffffffffffffff)
22##     DW_TAG_variable
23##       DW_AT_location        (0x00000023:
24##             [0x0000000000000003, 0x0000000000000005): DW_OP_reg2 RCX)
25
26# CHECK: warning: "sum_all_variables(#bytes in parent scope)" field overflowed.
27# CHECK: PC ranges covered: tainted
28
29--- !ELF
30FileHeader:
31  Class:   ELFCLASS[[BITS=64]]
32  Data:    ELFDATA2LSB
33  Type:    ET_EXEC
34  Machine: EM_X86_64
35Sections:
36  - Name:         .debug_loc
37    Type:         SHT_PROGBITS
38    AddressAlign: 0x01
39    Content:      '00000000000000000600000000000000010055000000000000000000000000000000000300000000000000050000000000000001005200000000000000000000000000000000'
40  - Name:         .debug_ranges
41    Type:         SHT_PROGBITS
42    AddressAlign: 0x01
43    Content:      '000000000000000003000000000000000500000000000000080000000000000000000000000000000000000000000000'
44DWARF:
45  debug_abbrev:
46    - Table:
47      - Code:     1
48        Tag:      DW_TAG_compile_unit
49        Children: DW_CHILDREN_yes
50        Attributes:
51          - Attribute: DW_AT_low_pc
52            Form:      DW_FORM_addr
53          - Attribute: DW_AT_high_pc
54            Form:      DW_FORM_data8
55      - Code:     2
56        Tag:      DW_TAG_subprogram
57        Children: DW_CHILDREN_yes
58        Attributes:
59          - Attribute: DW_AT_low_pc
60            Form:      DW_FORM_addr
61          - Attribute: DW_AT_high_pc
62            Form:      DW_FORM_data8
63      - Code:     3
64        Tag:      DW_TAG_variable
65        Children: DW_CHILDREN_no
66        Attributes:
67          - Attribute: DW_AT_location
68            Form:      DW_FORM_sec_offset
69  debug_info:
70    - Version:    4
71      AbbrOffset: 0x00
72      Entries:
73        - AbbrCode: 1 ## DW_TAG_compile_unit
74          Values:
75            - Value: 0x00 ## DW_AT_low_pc
76            - Value: 0x0b ## DW_AT_high_pc
77        - AbbrCode: 2 ## DW_TAG_subprogram
78          Values:
79            - Value: 0x00 ## DW_AT_low_pc
80            - Value: 0xFFFFFFFFFFFFFFFF ## DW_AT_high_pc
81        - AbbrCode: 3 ## DW_TAG_variable
82          Values:
83            - Value: 0x23 ## DW_AT_sec_offset
84        - AbbrCode: 0 ## NULL
85        - AbbrCode: 2 ## DW_TAG_subprogram
86          Values:
87            - Value: 0x00 ## DW_AT_low_pc
88            - Value: 0xFFFFFFFFFFFFFFFF ## DW_AT_high_pc
89        - AbbrCode: 3 ## DW_TAG_variable
90          Values:
91            - Value: 0x23 ## DW_AT_sec_offset
92        - AbbrCode: 0 ## NULL
93        - AbbrCode: 0 ## NULL
94