Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo] DW_AT_object_pointer not attached to method declarations #120973

Open
Michael137 opened this issue Dec 23, 2024 · 3 comments
Open

[DebugInfo] DW_AT_object_pointer not attached to method declarations #120973

Michael137 opened this issue Dec 23, 2024 · 3 comments

Comments

@Michael137
Copy link
Member

Michael137 commented Dec 23, 2024

DWARF's DW_AT_object_pointer indicates which DW_TAG_formal_parameter corresponds to the function object that the method is being called on.

One motivator for this attribute from the original proposal is that it can be used to determine whether a C++ method is static or not. LLDB does need to distinguish static vs. non-static methods, but can't rely on DW_AT_object_pointer at the moment because Clang does not emit it on the declaration DIE (only on the definition). GCC emits it on both. See https://godbolt.org/z/3TWjTfWon

So LLDB currently relies on the existence of a DW_TAG_formal_parameter called this and that it is a pointer type. With C++23, we can't rely on either of these being true because of the deducing this feature: https://godbolt.org/z/h4jeT54G5 (though there's a bug in both Clang and GCC here where we don't emit the DW_AT_object_pointer for an explicit object parameter, will raise a separate issue for it)

This issue proposes adding the DW_AT_object_pointer to declarations too.

@Michael137
Copy link
Member Author

CC @adrian-prantl @dwblaikie

@Michael137
Copy link
Member Author

Came up in #120856

@llvmbot
Copy link
Member

llvmbot commented Dec 23, 2024

@llvm/issue-subscribers-debuginfo

Author: Michael Buch (Michael137)

[DWARF's `DW_AT_object_pointer`](https://dwarfstd.org/issues/050711.2.html) indicates which `DW_TAG_formal_parameter` corresponds to the function object that the method is being called on.

One motivator for this attribute from the original proposal is that it can be used to determine whether a C++ method is static or not. LLDB does need to distinguish static vs. non-static methods, but can't rely on DW_AT_object_pointer at the moment because Clang does not emit it on the declaration DIE (only on the definition). GCC emits it on both. See https://godbolt.org/z/3TWjTfWon

So LLDB currently relies on the existence of a DW_TAG_formal_parameter called this and that it is a pointer type. With C++23, we can't rely on either of these being true because of the deducing this feature: https://godbolt.org/z/h4jeT54G5 (though there's a bug in both Clang and GCC here where we don't emit the DW_AT_object_pointer for an explicit object parameter, will raise a separate issue for it)

This issue proposes adding the DW_AT_object_pointer to declarations too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants