Skip to content

[DebugInfo] DW_AT_object_pointer not attached to method declarations #120973

Closed
@Michael137

Description

@Michael137

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions