diff options
| author | Cary Coutant <ccoutant@gmail.com> | 2025-05-16 16:19:02 -0700 |
|---|---|---|
| committer | Cary Coutant <ccoutant@gmail.com> | 2025-05-16 16:19:02 -0700 |
| commit | da89634d117e64baed248c83e940193afed75d08 (patch) | |
| tree | 75662de5eb943b0860559a3ab62738823696a697 | |
| parent | New issue 250516.1 (reopened 090107.2). (diff) | |
Update 250407.1.
| -rw-r--r-- | md/issues/250407.1.md | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/md/issues/250407.1.md b/md/issues/250407.1.md index c0841fd..3958b12 100644 --- a/md/issues/250407.1.md +++ b/md/issues/250407.1.md | |||
| @@ -3,14 +3,14 @@ Author: Jann Horn | |||
| 3 | Email: jannh@google.com | 3 | Email: jannh@google.com |
| 4 | Champion: David Blaikie | 4 | Champion: David Blaikie |
| 5 | Submit-Date: 2025-04-07 | 5 | Submit-Date: 2025-04-07 |
| 6 | Revised-Date: | 6 | Revised-Date: 2025-05-13 |
| 7 | Closed-Date: | 7 | Closed-Date: |
| 8 | Propid: 250407.1 | 8 | Propid: 250407.1 |
| 9 | Type: Enhancement | 9 | Type: Enhancement |
| 10 | Status: Open | 10 | Status: Open |
| 11 | Version: 6 | 11 | Version: 6 |
| 12 | Format: markdown | 12 | Format: markdown |
| 13 | Revisions: | 13 | Revisions: 2025-04-14 |
| 14 | 14 | ||
| 15 | ## Background | 15 | ## Background |
| 16 | 16 | ||
| @@ -68,7 +68,7 @@ calls to the allocator subroutine. | |||
| 68 | 68 | ||
| 69 | ## Overview | 69 | ## Overview |
| 70 | 70 | ||
| 71 | I am proposing to add a new DWARF attribute `DW_AT_heapallocsite` that | 71 | Add a new DWARF attribute `DW_AT_alloc_type` that |
| 72 | can be attached to a `DW_TAG_call_site` (or `DW_TAG_inlined_subroutine`) | 72 | can be attached to a `DW_TAG_call_site` (or `DW_TAG_inlined_subroutine`) |
| 73 | for calls to allocator subroutines (or subroutines with similar | 73 | for calls to allocator subroutines (or subroutines with similar |
| 74 | semantics). The value of the attribute is essentially the type | 74 | semantics). The value of the attribute is essentially the type |
| @@ -79,31 +79,28 @@ allocated by the callee when called from the callsite. | |||
| 79 | In section "2.2 Attribute Types", Table 2.2 "Attribute names", add the | 79 | In section "2.2 Attribute Types", Table 2.2 "Attribute names", add the |
| 80 | following entry: | 80 | following entry: |
| 81 | 81 | ||
| 82 | Attribute: `DW_AT_heapallocsite` | 82 | Attribute: `DW_AT_alloc_type` |
| 83 | Identifies or Specifies: Type allocated at call site | 83 | Identifies or Specifies: Type allocated at call site |
| 84 | 84 | ||
| 85 | In section "7.5.4 Attribute Encodings", Table 7.5 "Attribute | 85 | In section "7.5.4 Attribute Encodings", Table 7.5 "Attribute |
| 86 | encodings", add the following entry: | 86 | encodings", add the following entry: |
| 87 | 87 | ||
| 88 | Attribute name: `DW_AT_heapallocsite` | 88 | Attribute name: `DW_AT_alloc_type` |
| 89 | Value: `<next available ID>` | 89 | Value: `<next available ID>` |
| 90 | Classes: reference | 90 | Classes: reference |
| 91 | 91 | ||
| 92 | At the end of section "3.4.1 Call Site Entries", append these paragraphs: | 92 | At the end of section "3.4.1 Call Site Entries", append these paragraphs: |
| 93 | 93 | ||
| 94 | > The call site may have a `DW_AT_heapallocsite` attribute referencing a | 94 | > The call site may have a `DW_AT_alloc_type` attribute referencing a |
| 95 | > debugging information entry for the type that the type-agnostic callee | 95 | > debugging information entry for the type that the type-agnostic callee |
| 96 | > operates on when called from this call site. In particular, if the | 96 | > operates on when called from this call site. In particular, if the |
| 97 | > callee's primary purpose is to allocate memory, it refers to the type | 97 | > callee's primary purpose is to allocate memory, it refers to the type |
| 98 | > of the allocated object. The referenced type may be a reasonable guess | 98 | > of the allocated object. The referenced type may be a reasonable guess |
| 99 | > if no reliable type information is available. | 99 | > if no reliable type information is available. |
| 100 | > | 100 | > |
| 101 | > *This attribute should only be used when either the callee is a | 101 | > *This attribute should only be used when either the callee is a |
| 102 | > memory allocation subroutine or the programmer has requested its use | 102 | > memory allocation subroutine or the programmer has requested its use |
| 103 | > at a specific call site or for calls to a specific subroutine. The | 103 | > at a specific call site or for calls to a specific subroutine.* |
| 104 | > meaning of this attribute, when attached to a subroutine whose primary | ||
| 105 | > purpose is not to allocate memory, is defined by the | ||
| 106 | > programmer.* | ||
| 107 | 104 | ||
| 108 | In section "3.3.8.2 Concrete Instances", before the paragraph starting | 105 | In section "3.3.8.2 Concrete Instances", before the paragraph starting |
| 109 | with "An inlined subroutine entry may have a `DW_AT_const_expr` | 106 | with "An inlined subroutine entry may have a `DW_AT_const_expr` |
| @@ -132,3 +129,13 @@ S_HEAPALLOCSITE debuginfo][3] | |||
| 132 | [1]: https://clang.llvm.org/docs/AttributeReference.html#allocator | 129 | [1]: https://clang.llvm.org/docs/AttributeReference.html#allocator |
| 133 | [2]: https://github.com/llvm/llvm-project/pull/132073 | 130 | [2]: https://github.com/llvm/llvm-project/pull/132073 |
| 134 | [3]: https://learn.microsoft.com/en-us/visualstudio/profiling/memory-usage?view=vs-2022 | 131 | [3]: https://learn.microsoft.com/en-us/visualstudio/profiling/memory-usage?view=vs-2022 |
| 132 | |||
| 133 | --- | ||
| 134 | |||
| 135 | 2025-05-13: [Revised][diff1]. | ||
| 136 | Change name to `DW_AT_alloc_type`. | ||
| 137 | Remove sentence about non-memory-allocating usage: | ||
| 138 | |||
| 139 | > <del>The meaning of this attribute, when attached to a | ||
| 140 | > subroutine whose primary purpose is not to allocate | ||
| 141 | > memory, is defined by the programmer.</del> | ||
