[clang] [llvm] [clang][DebugInfo] Add symbol for debugger with VTable information. (PR #130255)
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 24 06:52:24 PDT 2025
CarlosAlbertoEnciso wrote:
> > Given the _vtable$ artificial member: use the DW_AT_containing_type to find the vtable global variable.
>
> It seems to me that this attribute should refer to a type and not a variable.
Good point. Another option is to use `DW_AT_specification`.
```
0x00000042: DW_TAG_variable
DW_AT_specification (0x0000005c "_vtable$")
DW_AT_linkage_name ("_ZTV8CDerived")
...
0x0000004c: DW_TAG_structure_type ("CDerived")
...
0x0000005c: DW_TAG_variable
DW_AT_name ("_vtable$")
DW_AT_artificial (true)
DW_AT_specification <0x00000042> --> VTable global variable
...
```
But potentially consumers can go into a loop if they follow both `DW_AT_specification`, without having additional knowledge about the `artificial` DIE.
```
0x00000042: DW_TAG_variable
DW_AT_linkage_name ("_ZTV8CDerived")
...
0x0000004c: DW_TAG_structure_type ("CDerived")
...
0x0000005c: DW_TAG_variable
DW_AT_name ("_vtable$")
DW_AT_artificial (true)
DW_AT_specification <0x00000042> --> VTable global variable
...
```
If we remove the first `DW_AT_specification`, we lost the ability to traverse the global variables (vtable's) and find their associated compound type.
https://github.com/llvm/llvm-project/pull/130255
More information about the llvm-commits
mailing list