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

[lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types #94400

Merged

Conversation

Michael137
Copy link
Member

@Michael137 Michael137 commented Jun 4, 2024

This is a follow-up of #92328 (comment)

Clang attaches DW_AT_declaration to static inline data members and dsymutil indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5.

Fixes TestConstStaticIntegralMember.py on DWARFv5.

…ss/union types

This is a follow-up of llvm#92328 (comment)

Clang attaches `DW_AT_declaration` to static inline data members
and `dsymutil` indexes these constants. Skipping these caused
the expression evaluator to fail to find such constants when
using DWARFv5.

Fixes `TestConstStaticIntegralMember.py` on DWARFv5.
@llvmbot llvmbot added the lldb label Jun 4, 2024
@Michael137 Michael137 changed the title [lldb][DebugNames] Only skip processing of DW_AT_declarations for cla… [lldb][DebugNames] Only skip processing of DW_AT_declarations for class/union types Jun 4, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 4, 2024

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

This is a follow-up of #92328 (comment)

Clang attaches DW_AT_declaration to static inline data members and dsymutil indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5.

Fixes TestConstStaticIntegralMember.py on DWARFv5.


Full diff: https://github.com/llvm/llvm-project/pull/94400.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (+2-1)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 56717bab1ecd8..6330470b970e7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry(
     return true;
   // Clang erroneously emits index entries for declaration DIEs in case when the
   // definition is in a type unit (llvm.org/pr77696). Weed those out.
-  if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
+  if (die.IsStructUnionOrClass() &&
+      die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
     return true;
   return callback(die);
 }

@Michael137
Copy link
Member Author

We might want to consider not omitting these constants into the index with dsymutil (since it's not spec conforming). And instead fix the expression evaluator to find the constants from context (but iirc that was a non-trivial undertaking).

@Michael137 Michael137 merged commit afe6ab7 into llvm:main Jun 4, 2024
7 checks passed
@Michael137 Michael137 deleted the bugfix/lldb-declarations-in-dsym-index-fix branch June 4, 2024 21:17
labath added a commit that referenced this pull request Jun 6, 2024
… for class/union types"

and two follow-up commits. The reason is the crash we've discovered when
processing -gsimple-template-names binaries. I'm committing a minimal
reproducer as a separate patch.

This reverts the following commits:
- 51dd4ea (#92328)
- 3d9d485 (#93839)
- afe6ab7 (#94400)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants