[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Don't overwrite DW_AT_object_pointer of definition with that of a declaration (PR #123089)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 15 09:24:17 PST 2025


================
@@ -377,7 +377,12 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {
       break;
 
     case DW_AT_object_pointer:
-      object_pointer = form_value.Reference();
+      // GetAttributes follows DW_AT_specification.
+      // DW_TAG_subprogram definitions and declarations may both
+      // have a DW_AT_object_pointer. Don't overwrite the one
+      // we parsed for the definition with the one from the declaration.
----------------
labath wrote:

This will only be true if the definition die has `DW_AT_object_pointer` *before* `DW_AT_specification`. `GetAttributes` expands the specification attribute "in place", so if the order is reversed, we will encounter the attribute from the specification first.

I don't know if there's a good reason for the way that `GetAttributes` works. It might be possible to just change it to visit the main DIE first.

https://github.com/llvm/llvm-project/pull/123089


More information about the lldb-commits mailing list