[Lldb-commits] [PATCH] D102445: Switch from using member_clang_type.GetByteSize() to member_type->GetByteSize() in ParseSingleMember

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 13 14:41:46 PDT 2021

shafik created this revision.
shafik added reviewers: aprantl, teemperor, labath.
shafik requested review of this revision.

We have a bug in which using `member_clang_type.GetByteSize()` triggers record layout and during this process since the record was not yet complete we ended up reaching a record that had not been layed out yet. Using `member_type->GetByteSize() ` avoids this situation since it relies on size from DWARF and will not trigger record layout.

We were not able to reduce this to minimal reproducer. The crash goes away in this case when we have a dSYM and we have seen that ordering in symbol processing can change the behavior as well.

For reference: rdar://77293040



Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2671,7 +2671,7 @@
           last_field_info.bit_offset = field_bit_offset;
           if (llvm::Optional<uint64_t> clang_type_size =
-                  member_clang_type.GetByteSize(nullptr)) {
+                  member_type->GetByteSize(nullptr)) {
             last_field_info.bit_size = *clang_type_size * character_width;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102445.345288.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210513/b2d4c412/attachment.bin>

More information about the lldb-commits mailing list