1
1
# Allow Location Descriptions on the DWARF Expression Stack <!-- omit in toc -->
2
2
3
- - [ 1. Extension] ( #extension )
4
- - [ 2. Heterogeneous Computing Devices] ( #heterogeneous-computing-devices )
5
- - [ 3. DWARF 5] ( #dwarf-5 )
6
- - [ 3.1 How DWARF Maps Source Language To Hardware] ( #how-dwarf-maps-source-language-to-hardware )
7
- - [ 3.2 Examples] ( #examples )
8
- - [ 3.2.1 Dynamic Array Size] ( #dynamic-array-size )
9
- - [ 3.2.2 Variable Location in Register] ( #variable-location-in-register )
10
- - [ 3.2.3 Variable Location in Memory] ( #variable-location-in-memory )
11
- - [ 3.2.4 Variable Spread Across Different Locations] ( #variable-spread-across-different-locations )
12
- - [ 3.2.5 Offsetting a Composite Location] ( #offsetting-a-composite-location )
13
- - [ 3.2.6 Pointer to Member] ( #pointer-to-member )
14
- - [ 3.2.7 Virtual Base Class] ( #virtual-base-class )
15
- - [ 3.3 Limitations] ( #limitations )
16
- - [ 4. Extension Solution] ( #extension-solution )
17
- - [ 4.1 Location Description] ( #location-description )
18
- - [ 4.2 Stack Location Description Operations] ( #stack-location-description-operations )
19
- - [ 4.3 Examples] ( #examples-1 )
20
- - [ 4.3.1 Source Language Variable Spilled to Part of a Vector Register] ( #source-language-variable-spilled-to-part-of-a-vector-register )
21
- - [ 4.3.2 Source Language Variable Spread Across Multiple Vector Registers] ( #source-language-variable-spread-across-multiple-vector-registers )
22
- - [ 4.3.3 Source Language Variable Spread Across Multiple Kinds of Locations] ( #source-language-variable-spread-across-multiple-kinds-of-locations )
23
- - [ 4.3.4 Address Spaces] ( #address-spaces )
24
- - [ 4.3.5 Bit Offsets] ( #bit-offsets )
25
- - [ 4.4 Call Frame Information (CFI)] ( #call-frame-information-cfi )
26
- - [ 4.5 Objects Not In Byte Aligned Global Memory] ( #objects-not-in-byte-aligned-global-memory )
27
- - [ 4.6 Higher Order Operations] ( #higher-order-operations )
28
- - [ 4.7 Objects In Multiple Places] ( #objects-in-multiple-places )
29
- - [ 5. Conclusion] ( #conclusion )
30
- - [ A. Changes to DWARF Debugging Information Format Version 5] ( #a-changes-to-dwarf-debugging-information-format-version-5 )
31
- - [ A.2 General Description] ( #a-2-general-description )
32
- - [ A.2.5 DWARF Expressions] ( #a-2-5-dwarf-expressions )
33
- - [ A.2.5.1 DWARF Expression Evaluation Context] ( #a-2-5-1-dwarf-expression-evaluation-context )
34
- - [ A.2.5.2 DWARF Expression Value] ( #a-2-5-2-dwarf-expression-value )
35
- - [ A.2.5.3 DWARF Location Description] ( #a-2-5-3-dwarf-location-description )
36
- - [ A.2.5.4 DWARF Operation Expressions] ( #a-2-5-4-dwarf-operation-expressions )
37
- - [ A.2.5.4.1 Stack Operations] ( #a-2-5-4-1-stack-operations )
38
- - [ A.2.5.4.2 Control Flow Operations] ( #a-2-5-4-2-control-flow-operations )
39
- - [ A.2.5.4.3 Value Operations] ( #a-2-5-4-3-value-operations )
40
- - [ A.2.5.4.3.1 Literal Operations] ( #a-2-5-4-3-1-literal-operations )
41
- - [ A.2.5.4.3.2 Arithmetic and Logical Operations] ( #a-2-5-4-3-2-arithmetic-and-logical-operations )
42
- - [ A.2.5.4.3.3 Type Conversion Operations] ( #a-2-5-4-3-3-type-conversion-operations )
43
- - [ A.2.5.4.3.4 Special Value Operations] ( #a-2-5-4-3-4-special-value-operations )
44
- - [ A.2.5.4.4 Location Description Operations] ( #a-2-5-4-4-location-description-operations )
45
- - [ A.2.5.4.4.1 General Location Description Operations] ( #a-2-5-4-4-1-general-location-description-operations )
46
- - [ A.2.5.4.4.2 Undefined Location Description Operations] ( #a-2-5-4-4-2-undefined-location-description-operations )
47
- - [ A.2.5.4.4.3 Memory Location Description Operations] ( #a-2-5-4-4-3-memory-location-description-operations )
48
- - [ A.2.5.4.4.4 Register Location Description Operations] ( #a-2-5-4-4-4-register-location-description-operations )
49
- - [ A.2.5.4.4.5 Implicit Location Description Operations] ( #a-2-5-4-4-5-implicit-location-description-operations )
50
- - [ A.2.5.4.4.6 Composite Location Description Operations] ( #a-2-5-4-4-6-composite-location-description-operations )
51
- - [ A.2.5.5 DWARF Location List Expressions] ( #a-2-5-5-dwarf-location-list-expressions )
52
- - [ A.3 Program Scope Entries] ( #a-3-program-scope-entries )
53
- - [ A.3.3 Subroutine and Entry Point Entries] ( #a-3-3-subroutine-and-entry-point-entries )
54
- - [ A.3.3.5 Low-Level Information] ( #a-3-3-5-low-level-information )
55
- - [ A.3.4 Call Site Entries and Parameters] ( #a-3-4-call-site-entries-and-parameters )
56
- - [ A.3.4.2 Call Site Parameters] ( #a-3-4-2-call-site-parameters )
57
- - [ A.3.5 Lexical Block Entries] ( #a-3-5-lexical-block-entries )
58
- - [ A.4 Data Object and Object List Entries] ( #a-4-data-object-and-object-list-entries )
59
- - [ A.4.1 Data Object Entries] ( #a-4-1-data-object-entries )
60
- - [ A.5 Type Entries] ( #a-5-type-entries )
61
- - [ A.5.7 Structure, Union, Class and Interface Type Entries] ( #a-5-7-structure-union-class-and-interface-type-entries )
62
- - [ A.5.7.3 Derived or Extended Structures, Classes and Interfaces] ( #a-5-7-3-derived-or-extended-structures-classes-and-interfaces )
63
- - [ A.5.7.8 Member Function Entries] ( #a-5-7-8-member-function-entries )
64
- - [ A.5.14 Pointer to Member Type Entries] ( #a-5-14-pointer-to-member-type-entries )
65
- - [ A.5.16 Dynamic Type Entries] ( #a-5-16-dynamic-type-entries )
66
- - [ A.6 Other Debugging Information] ( #a-6-other-debugging-information )
67
- - [ A.6.2 Line Number Information] ( #a-6-2-line-number-information )
68
- - [ A.6.4 Call Frame Information] ( #a-6-4-call-frame-information )
69
- - [ A.6.4.1 Structure of Call Frame Information] ( #a-6-4-1-structure-of-call-frame-information )
70
- - [ A.6.4.2 Call Frame Instructions] ( #a-6-4-2-call-frame-instructions )
71
- - [ A.6.4.2.1 Row Creation Instructions] ( #a-6-4-2-1-row-creation-instructions )
72
- - [ A.6.4.2.2 CFA Definition Instructions] ( #a-6-4-2-2-cfa-definition-instructions )
73
- - [ A.6.4.2.3 Register Rule Instructions] ( #a-6-4-2-3-register-rule-instructions )
74
- - [ A.6.4.2.4 Row State Instructions] ( #a-6-4-2-4-row-state-instructions )
75
- - [ A.6.4.2.5 Padding Instruction] ( #a-6-4-2-5-padding-instruction )
76
- - [ A.6.4.3 Call Frame Instruction Usage] ( #a-6-4-3-call-frame-instruction-usage )
77
- - [ A.6.4.4 Call Frame Calling Address] ( #a-6-4-4-call-frame-calling-address )
78
- - [ A.7 Data Representation] ( #a-7-data-representation )
79
- - [ A.7.4 32-Bit and 64-Bit DWARF Formats] ( #a-7-4-32-bit-and-64-bit-dwarf-formats )
80
- - [ A.7.5 Format of Debugging Information] ( #a-7-5-format-of-debugging-information )
81
- - [ A.7.5.5 Classes and Forms] ( #a-7-5-5-classes-and-forms )
82
- - [ A.7.7 DWARF Expressions] ( #a-7-7-dwarf-expressions )
83
- - [ A.7.7.1 Operation Expressions] ( #a-7-7-1-operation-expressions )
84
- - [ A.7.7.3 Location List Expressions] ( #a-7-7-3-location-list-expressions )
85
- - [ B. Further Information] ( #b-further-information )
3
+ ``` {contents}
4
+ ---
5
+ local:
6
+ ---
7
+ ```
86
8
87
9
# 1. Extension
88
10
@@ -111,20 +33,18 @@ specialized context sensitive operations are harder for both producers and
111
33
consumers than a smaller number of general composable operations that have
112
34
consistent semantics regardless of context.
113
35
114
- First, section [ 2. Heterogeneous Computing
115
- Devices] ( #heterogeneous-computing-devices ) describes heterogeneous devices and
116
- the features they have that are not addressed by DWARF 5. Then section [ 3. DWARF
117
- 5] ( #dwarf-5 ) presents a brief simplified overview of the DWARF 5 expression
36
+ First, section [ 2. Heterogeneous Computing Devices] ( #heterogeneous-computing-devices )
37
+ describes heterogeneous devices and the features they have that are not addressed by DWARF 5.
38
+ Then section [ 3. DWARF5] ( #dwarf-5 ) presents a brief simplified overview of the DWARF 5 expression
118
39
evaluation model that highlights the difficulties for supporting the
119
40
heterogeneous features. Next, section [ 4. Extension
120
41
Solution] ( #extension-solution ) provides an overview of the proposal, using
121
42
simplified examples to illustrate how it can address the issues of heterogeneous
122
43
devices and also benefit non-heterogeneous devices. Then overall conclusions are
123
- covered in section [ 5. Conclusion] ( #conclusion ) . Appendix [ A. Changes to DWARF
124
- Debugging Information Format Version
125
- 5] ( #a-changes-to-dwarf-debugging-information-format-version-5 ) gives changes
126
- relative to the DWARF Version 5 standard. Finally, appendix [ B. Further
127
- Information] ( #b-further-information ) has references to further information.
44
+ covered in section [ 5. Conclusion] ( #conclusion ) .
45
+ Appendix [ A. Changes to DWARF Debugging Information Format Version 5] ( #changes-to-dwarf-debugging-information-format-version-5 ) gives changes
46
+ relative to the DWARF Version 5 standard. Finally, appendix
47
+ [ B. Further Information] ( #further-information ) has references to further information.
128
48
129
49
# 2. Heterogeneous Computing Devices
130
50
@@ -625,7 +545,7 @@ Address requested for identifier "x" which is in register $rdi
625
545
626
546
With location descriptions on the stack, the definition of `DW_OP_use_location`
627
547
can be modified by replacing every instance of "address" with "location
628
- description", as is described in [A.5 Type Entries](#a-5- type-entries).
548
+ description", as is described in [Type Entries](#type-entries).
629
549
630
550
To implement the fully generalized version of this attribute, GCC would only
631
551
need to change the expression from `DW_OP_plus` to `DW_OP_swap,
@@ -811,8 +731,7 @@ $2 = {<A> = <invalid address>, _vptr.B = <optimized out>}
811
731
812
732
With location descriptions on the stack, the definition of
813
733
`DW_OP_data_member_location` can be modified by replacing every instance of
814
- "address" with "location description", as is described in [A.5 Type
815
- Entries](#a-5-type-entries).
734
+ "address" with "location description", as is described in [A.5 Type Entries](#type-entries).
816
735
817
736
To implement the fully generalized version of this attribute, GCC would only
818
737
need to change the last operation in the expression from `DW_OP_plus` to
@@ -1406,10 +1325,9 @@ is evaluated, it may be specified whether a value or location description is
1406
1325
required as the result kind.
1407
1326
1408
1327
If a result kind is specified, and the result of the evaluation does not match
1409
- the specified result kind, then the implicit conversions described in [2.5.4.4.3
1410
- Memory Location Description
1411
- Operations](#memory-location-description-operations) are performed if
1412
- valid. Otherwise, the DWARF expression is ill-formed.
1328
+ the specified result kind, then the implicit conversions described in
1329
+ [2.5.4.4.3 Memory Location Description Operations](#memory-location-description-operations)
1330
+ are performed if valid. Otherwise, the DWARF expression is ill-formed.
1413
1331
1414
1332
If the evaluation of a DWARF expression encounters an evaluation error, then the
1415
1333
result is an evaluation error.
@@ -1794,9 +1712,9 @@ Operations represent a postfix operation on a simple stack machine. Each stack
1794
1712
entry can hold either a value or a location description. Operations can act on
1795
1713
entries on the stack, including adding entries and removing entries. If the kind
1796
1714
of a stack entry does not match the kind required by the operation and is not
1797
- implicitly convertible to the required kind (see [2.5.4.4.3 Memory Location
1798
- Description Operations](#memory-location-description-operations)), then
1799
- the DWARF operation expression is ill-formed.
1715
+ implicitly convertible to the required kind
1716
+ (see [2.5.4.4.3 Memory Location Description Operations](#memory-location-description-operations)),
1717
+ then the DWARF operation expression is ill-formed.
1800
1718
1801
1719
Evaluation of an operation expression starts with an empty stack on which the
1802
1720
entries from the initial stack provided by the context are pushed in the order
@@ -1817,9 +1735,8 @@ The result of the evaluation is:
1817
1735
an empty operation expression for this purpose.</i>
1818
1736
1819
1737
- If the top stack entry is a location description, or can be converted to one
1820
- (see [2.5.4.4.3 Memory Location Description
1821
- Operations](#memory-location-description-operations)), then the result
1822
- is that, possibly converted, location description. Any other entries on the
1738
+ (see [2.5.4.4.3 Memory Location Description Operations](#memory-location-description-operations)),
1739
+ then the result is that, possibly converted, location description. Any other entries on the
1823
1740
stack are discarded.
1824
1741
- Otherwise the DWARF expression is ill-formed.
1825
1742
@@ -1828,9 +1745,8 @@ The result of the evaluation is:
1828
1745
1829
1746
- If the current result kind specifies a value, then:
1830
1747
- If the top stack entry is a value, or can be converted to one (see
1831
- [2.5.4.4.3 Memory Location Description
1832
- Operations](#memory-location-description-operations)), then the result is
1833
- that, possibly converted, value. Any other entries on the stack are
1748
+ [2.5.4.4.3 Memory Location Description Operations](#memory-location-description-operations)),
1749
+ then the result is that, possibly converted, value. Any other entries on the stack are
1834
1750
discarded.
1835
1751
- Otherwise the DWARF expression is ill-formed.
1836
1752
- If the current result kind is not specified, then:
@@ -1867,9 +1783,8 @@ stack assume that the top of the stack (most recently added entry) has index 0.
1867
1783
They allow the stack entries to be either a value or location description.
1868
1784
1869
1785
If any stack entry accessed by a stack operation is an incomplete composite
1870
- location description (see [2.5.4.4.6 Composite Location Description
1871
- Operations](#composite-location-description-operations)), then the DWARF
1872
- expression is ill-formed.
1786
+ location description (see [2.5.4.4.6 Composite Location Description Operations]
1787
+ (#composite-location-description-operations)), then the DWARF expression is ill-formed.
1873
1788
1874
1789
> NOTE: These operations now support stack entries that are values and location
1875
1790
> descriptions.
@@ -2346,9 +2261,8 @@ There are these special value operations currently defined:
2346
2261
undefined location storage or the offset of any bit exceeds the size of the
2347
2262
location storage LS specified by any single location description SL of L.
2348
2263
2349
- See [2.5.4.4.5 Implicit Location Description
2350
- Operations](#implicit-location-description-operations) for special
2351
- rules concerning implicit location descriptions created by the
2264
+ See [2.5.4.4.5 Implicit Location Description Operations](#implicit-location-description-operations)
2265
+ for special rules concerning implicit location descriptions created by the
2352
2266
`DW_OP_implicit_pointer` operation.
2353
2267
2354
2268
5. `DW_OP_xderef`
@@ -2606,8 +2520,8 @@ bit offset equal to V scaled by 8 (the byte size).
2606
2520
If a stack entry is required to be a location description, but it is an implicit
2607
2521
pointer value IPV with the target architecture default address space, then it is
2608
2522
implicitly converted to a location description with one single location
2609
- description specified by IPV. See [2.5.4.4.5 Implicit Location Description
2610
- Operations](#implicit-location-description-operations).
2523
+ description specified by IPV. See
2524
+ [2.5.4.4.5 Implicit Location Description Operations](#implicit-location-description-operations).
2611
2525
2612
2526
If a stack entry is required to be a value, but it is a location description L
2613
2527
with one memory location description SL in the target architecture default
@@ -3699,8 +3613,7 @@ Frame Description Entries (FDE). There is at least one CIE in every non-empty
3699
3613
value of length must be an integral multiple of the address size specified
3700
3614
in the `address_size` field.
3701
3615
3702
- 2. `CIE_id` (4 or 8 bytes, see [7.4 32-Bit and 64-Bit DWARF
3703
- Formats](#32-bit-and-64-bit-dwarf-formats))
3616
+ 2. `CIE_id` (4 or 8 bytes, see [7.4 32-Bit and 64-Bit DWARF Formats](#bit-and-64-bit-dwarf-formats))
3704
3617
3705
3618
A constant that is used to distinguish CIEs from FDEs.
3706
3619
@@ -3796,8 +3709,7 @@ An FDE contains the following fields, in order:
3796
3709
of the length field plus the value of length must be an integral multiple of
3797
3710
the address size.
3798
3711
3799
- 2. `CIE_pointer` (4 or 8 bytes, see [7.4 32-Bit and 64-Bit DWARF
3800
- Formats](#32-bit-and-64-bit-dwarf-formats))
3712
+ 2. `CIE_pointer` (4 or 8 bytes, see [7.4 32-Bit and 64-Bit DWARF Formats](#bit-and-64-bit-dwarf-formats))
3801
3713
3802
3714
A constant offset into the `.debug_frame` section that denotes the CIE that
3803
3715
is associated with this FDE.
0 commit comments