1
1
.. _amdgpu-dwarf-6-proposal-for-heterogeneous-debugging :
2
2
3
- ====================================================
3
+ ****************************************************
4
4
DWARF Version 6 Proposal For Heterogeneous Debugging
5
- ====================================================
5
+ ****************************************************
6
6
7
7
.. contents ::
8
8
:local:
9
9
10
10
.. warning ::
11
11
12
- This section describes a **provisional proposal ** for DWARF Version 6
12
+ This document describes a **provisional proposal ** for DWARF Version 6
13
13
[:ref: `DWARF <amdgpu-dwarf-DWARF >`] to support heterogeneous debugging. It is
14
14
not currently fully implemented and is subject to change.
15
15
16
16
Introduction
17
- ------------
17
+ ============
18
18
19
19
This document proposes a set of backwards compatible extensions to DWARF Version
20
20
5 [:ref: `DWARF <amdgpu-dwarf-DWARF >`] for consideration of inclusion into a
@@ -100,7 +100,7 @@ denote the current lane, much like ``DW_OP_push_object_address`` denotes the
100
100
current object. The ``DW_OP_*piece `` operations only allow literal indices.
101
101
Therefore, a way to use a computed offset of an arbitrary ___location description
102
102
(such as a vector register) is required. See ``DW_OP_LLVM_push_lane ``,
103
- ``DW_OP_LLVM_offset ``, ``DW_OP_LLVM_offset_constu ``, and
103
+ ``DW_OP_LLVM_offset ``, ``DW_OP_LLVM_offset_uconst ``, and
104
104
``DW_OP_LLVM_bit_offset ``.
105
105
106
106
If the source language is mapped onto the AMDGPU wavefronts in a SIMT manner
@@ -173,16 +173,26 @@ allowing current DWARF expressions to remain legal. See
173
173
174
174
The ``DW_OP_plus `` and ``DW_OP_minus `` can be defined to operate on a memory
175
175
___location description in the default target architecture specific address space
176
- and a generic type value to produce an updated memory ___location description.
177
- This allows them to continue to be used to offset an address. To generalize
176
+ and a generic type value to produce an updated memory ___location description. This
177
+ allows them to continue to be used to offset an address. To generalize
178
178
offsetting to any ___location description, including ___location descriptions that
179
- describe when bytes are in registers, are implicit, or a composite of these,
180
- the ``DW_OP_LLVM_offset ``, ``DW_OP_LLVM_offset_constu `` and
181
- ``DW_OP_LLVM_bit_offset `` operations are added. These do not perform wrapping
182
- which would be hard to define for ___location descriptions of non-memory kinds.
183
- This allows ``DW_OP_push_object_address `` to push a ___location description that
184
- may be in a register, or be an implicit value, and the DWARF expression of
185
- ``DW_TAG_ptr_to_member_type `` can contain ``DW_OP_LLVM_offset `` to offset
179
+ describe when bytes are in registers, are implicit, or a composite of these, the
180
+ ``DW_OP_LLVM_offset ``, ``DW_OP_LLVM_offset_uconst ``, and
181
+ ``DW_OP_LLVM_bit_offset `` offset operations are added. Unlike ``DW_OP_plus ``,
182
+ ``DW_OP_plus_uconst ``, and ``DW_OP_minus `` arithmetic operations, these do not
183
+ define that integer overflow causes wrap-around. The offset operations can
184
+ operate on ___location storage of any size. For example, implicit ___location storage
185
+ could be any number of bits in size. It is simpler to define offsets that exceed
186
+ the size of the ___location storage as being ill-formed, than having to force an
187
+ implementation to support potentially infinite precision offsets to allow it to
188
+ correctly track a series of positive and negative offsets that may transiently
189
+ overflow or underflow, but end up in range. This is simple for the arithmetic
190
+ operations as they are defined in terms of two's compliment arithmetic on a base
191
+ type of a fixed size.
192
+
193
+ Having the offset operations allows ``DW_OP_push_object_address `` to push a
194
+ ___location description that may be in a register, or be an implicit value, and the
195
+ DWARF expression of ``DW_TAG_ptr_to_member_type `` can contain them to offset
186
196
within it. ``DW_OP_LLVM_bit_offset `` generalizes DWARF to work with bit fields
187
197
which is not possible in DWARF Version 5.
188
198
@@ -340,10 +350,17 @@ implemented as an LLVM vendor extension to DWARF Version 5. If accepted these
340
350
names would not include the "\ ``LLVM ``\ " and would not use encodings in the
341
351
vendor range.
342
352
343
- The proposal is organized to follow the section ordering of DWARF Version 5.
344
- It includes notes to indicate the corresponding DWARF Version 5 sections to
345
- which they pertain. Other notes describe additional changes that may be worth
346
- considering, and to raise questions.
353
+ The proposal is described in
354
+ :ref: `amdgpu-dwarf-proposed-changes-relative-to-dwarf-version-5 ` and is
355
+ organized to follow the section ordering of DWARF Version 5. It includes notes
356
+ to indicate the corresponding DWARF Version 5 sections to which they pertain.
357
+ Other notes describe additional changes that may be worth considering, and to
358
+ raise questions.
359
+
360
+ .. _amdgpu-dwarf-proposed-changes-relative-to-dwarf-version-5 :
361
+
362
+ Proposed Changes Relative to DWARF Version 5
363
+ ============================================
347
364
348
365
General Description
349
366
-------------------
@@ -648,7 +665,9 @@ stack assume that the top of the stack (most recently added entry) has index 0.
648
665
They allow the stack entries to be either a value or ___location description.
649
666
650
667
If any stack entry accessed by a stack operation is an incomplete composite
651
- ___location description, then the DWARF expression is ill-formed.
668
+ ___location description (see
669
+ :ref: `amdgpu-dwarf-composite-___location-description-operations `), then the DWARF
670
+ expression is ill-formed.
652
671
653
672
.. note ::
654
673
@@ -753,14 +772,21 @@ expression.
753
772
unsigned offset, respectively, of a debugging information entry D in the
754
773
current compilation unit.
755
774
756
- ``DW_OP_LLVM_call_ref `` has one operand that is a 4-byte unsigned value in
757
- the 32-bit DWARF format, or an 8-byte unsigned value in the 64-bit DWARF
758
- format, that represents an offset of a debugging information entry D in a
775
+ ``DW_OP_call_ref `` has one operand that is a 4-byte unsigned value in the
776
+ 32-bit DWARF format, or an 8-byte unsigned value in the 64-bit DWARF format,
777
+ that represents an offset of a debugging information entry D in a
759
778
``.debug_info `` section, which may be contained in an executable or shared
760
- object file other than that containing the operation. For references from one
761
- executable or shared object file to another, the relocation must be
779
+ object file other than that containing the operation. For references from
780
+ one executable or shared object file to another, the relocation must be
762
781
performed by the consumer.
763
782
783
+ .. note:
784
+
785
+ It is unclear how crossing from one executable or shared object file to
786
+ another can work. How would a consumer know which executable or shared
787
+ object file is being referenced? In an ELF file the DWARF is in a
788
+ non-ALLOC segment so standard dynamic relocations cannot be used.
789
+
764
790
*Operand interpretation of * ``DW_OP_call2 ``\ *, * ``DW_OP_call4 ``\ *, and *
765
791
``DW_OP_call_ref `` *is exactly like that for * ``DW_FORM_ref2 ``\ *,
766
792
``DW_FORM_ref4``\ *, and * ``DW_FORM_ref_addr ``\ *, respectively. *
@@ -1161,7 +1187,7 @@ There are these special value operations currently defined:
1161
1187
on the stack with the generic type.
1162
1188
1163
1189
*This operation is deprecated as the * ``DW_OP_LLVM_form_aspace_address ``
1164
- operation can be used and provides greater expressiveness.*
1190
+ * operation can be used and provides greater expressiveness. *
1165
1191
1166
1192
6. ``DW_OP_xderef_size `` *Deprecated *
1167
1193
@@ -1177,7 +1203,7 @@ There are these special value operations currently defined:
1177
1203
value V retrieved is left on the stack with the generic type.
1178
1204
1179
1205
*This operation is deprecated as the * ``DW_OP_LLVM_form_aspace_address ``
1180
- operation can be used and provides greater expressiveness.*
1206
+ * operation can be used and provides greater expressiveness. *
1181
1207
1182
1208
7. ``DW_OP_xderef_type `` *Deprecated *
1183
1209
@@ -1195,7 +1221,7 @@ There are these special value operations currently defined:
1195
1221
retrieved is left on the stack with the type D.
1196
1222
1197
1223
*This operation is deprecated as the * ``DW_OP_LLVM_form_aspace_address ``
1198
- operation can be used and provides greater expressiveness.*
1224
+ * operation can be used and provides greater expressiveness. *
1199
1225
1200
1226
8. ``DW_OP_entry_value `` *Deprecated *
1201
1227
@@ -1304,9 +1330,9 @@ General Location Description Operations
1304
1330
to the size of the ___location storage specified by SL, then the DWARF
1305
1331
expression is ill-formed.
1306
1332
1307
- 2. ``DW_OP_LLVM_offset_constu `` *New *
1333
+ 2. ``DW_OP_LLVM_offset_uconst `` *New *
1308
1334
1309
- ``DW_OP_LLVM_offset_constu `` has a single unsigned LEB128 integer operand
1335
+ ``DW_OP_LLVM_offset_uconst `` has a single unsigned LEB128 integer operand
1310
1336
that represents a byte displacement B.
1311
1337
1312
1338
The operation is equivalent to performing ``DW_OP_constu B;
@@ -1316,6 +1342,12 @@ General Location Description Operations
1316
1342
displacements in two bytes than can be done with * ``DW_OP_lit*;
1317
1343
DW_OP_LLVM_offset ``\ *. *
1318
1344
1345
+ .. note ::
1346
+
1347
+ Should this be named ``DW_OP_LLVM_offset_uconst `` to match
1348
+ ``DW_OP_plus_uconst ``, or ``DW_OP_LLVM_offset_constu `` to match
1349
+ ``DW_OP_constu ``?
1350
+
1319
1351
3. ``DW_OP_LLVM_bit_offset `` *New *
1320
1352
1321
1353
``DW_OP_LLVM_bit_offset `` pops two stack entries. The first must be an
@@ -1582,7 +1614,7 @@ type.
1582
1614
entry corresponding to the current subprogram as described in
1583
1615
:ref: `amdgpu-dwarf-debugging-information-entry-attributes `.
1584
1616
1585
- The ___location description L is updated as if the ``DW_OP_LLVM_offset_constu
1617
+ The ___location description L is updated as if the ``DW_OP_LLVM_offset_uconst
1586
1618
B `` operation was applied. The updated L is pushed on the stack.
1587
1619
1588
1620
7. ``DW_OP_breg0 ``, ``DW_OP_breg1 ``, ..., ``DW_OP_breg31 ``
@@ -1818,7 +1850,7 @@ implicit storage value starting at the bit offset.
1818
1850
1819
1851
* Otherwise the DWARF expression is ill-formed.
1820
1852
1821
- The bit offset of RL is updated as if the ``DW_OP_LLVM_offset_constu B ``
1853
+ The bit offset of RL is updated as if the ``DW_OP_LLVM_offset_uconst B ``
1822
1854
operation was applied.
1823
1855
1824
1856
If a ``DW_OP_stack_value `` operation pops a value that is the same as IPV,
@@ -1868,6 +1900,8 @@ reconstruct the value of the object when asked to dereference the pointer
1868
1900
described by E *\ :sub: `1` *which contains the * ``DW_OP_implicit_pointer `` or
1869
1901
``DW_OP_LLVM_aspace_implicit_pointer `` *operation. *
1870
1902
1903
+ .. _amdgpu-dwarf-composite-___location-description-operations :
1904
+
1871
1905
Composite Location Description Operations
1872
1906
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1873
1907
@@ -2773,7 +2807,7 @@ Debugging Information Entry Attributes
2773
2807
2774
2808
The format for the augmentation string is:
2775
2809
2776
- | ``[``\ *vendor*\ ``v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
2810
+ | ``[``\ *vendor*\ ``: v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
2777
2811
2778
2812
Where *vendor * is the producer, ``vX.Y `` specifies the major X and minor Y
2779
2813
version number of the extensions used, and *options * is an optional string
@@ -2861,7 +2895,7 @@ A null-terminated UTF-8 vendor specific augmentation string, which provides
2861
2895
additional information about the contents of this index. If provided, the
2862
2896
recommended format for augmentation string is:
2863
2897
2864
- | ``[``\ *vendor*\ ``v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
2898
+ | ``[``\ *vendor*\ ``: v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
2865
2899
2866
2900
Where *vendor * is the producer, ``vX.Y `` specifies the major X and minor Y
2867
2901
version number of the extensions used in the DWARF of the compilation unit, and
@@ -3089,7 +3123,7 @@ Description Entries. There is at least one CIE in every non-empty
3089
3123
3090
3124
The recommended format for the augmentation string is:
3091
3125
3092
- | ``[``\ *vendor*\ ``v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
3126
+ | ``[``\ *vendor*\ ``: v``\ *X*\ ``.``\ *Y*\ [\ ``:``\ *options*\ ]\ ``]``\ *
3093
3127
3094
3128
Where *vendor * is the producer, ``vX.Y `` specifies the major X and minor Y
3095
3129
version number of the extensions used, and *options * is an optional string
@@ -3583,7 +3617,7 @@ operations.
3583
3617
DW_OP_LLVM_form_aspace_address 0xe1 0
3584
3618
DW_OP_LLVM_push_lane 0xe2 0
3585
3619
DW_OP_LLVM_offset 0xe3 0
3586
- DW_OP_LLVM_offset_constu 0xe4 1 ULEB128 byte displacement
3620
+ DW_OP_LLVM_offset_uconst 0xe4 1 ULEB128 byte displacement
3587
3621
DW_OP_LLVM_bit_offset 0xe5 0
3588
3622
DW_OP_LLVM_call_frame_entry_reg 0xe6 1 ULEB128 register number
3589
3623
DW_OP_LLVM_undefined 0xe7 0
0 commit comments