[lldb-dev] [Bug 50054] New: getASTRecordLayout called before that type's base classes are saved
via lldb-dev
lldb-dev at lists.llvm.org
Wed Apr 21 00:43:18 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50054
Bug ID: 50054
Summary: getASTRecordLayout called before that type's base
classes are saved
Product: lldb
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: lldb-dev at lists.llvm.org
Reporter: emrekultursay at google.com
CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org
Created attachment 24776
--> https://bugs.llvm.org/attachment.cgi?id=24776&action=edit
Full stack trace
This is a case where LLDB calls `Context.getASTRecordLayout(...)` for a class
BEFORE the `CXXRecordDecl::setBases()` for that same class.
As a result, `getASTRecordLayout()` computes and caches an layout without any
base classes, and subsequent calls use that cached, incorrect result.
This causes a segfault in LLDB due to downstream accesses using FieldNo values
that do not exist in ASTRecordLayout.
I can only reproduce this by attaching to a binary that a customer provided,
and I cannot share that publicly here. However, I hope maybe some LLDB experts
here might be able to guide/help by looking at the stack trace here.
* Topmost frame: Computes and saves the ASTRecordLayout for the problematic
class without any base class information.
* Frame with asterisk(*): Has not processed/saved the base classes for that
same class yet.
> clang::ASTContext::getASTRecordLayout Line 3339
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
`anonymous namespace'::EmptySubobjectMap::ComputeEmptySubobjectSizes
Line 203
`anonymous namespace'::EmptySubobjectMap::EmptySubobjectMap Line 179
clang::ASTContext::getASTRecordLayout Line 3377
clang::ASTContext::getTypeInfoImpl Line 2258
clang::ASTContext::getTypeInfo Line 1879
clang::ASTContext::getTypeInfo Line 2116
clang::ASTContext::getTypeSize Line 2122
lldb_private::TypeSystemClang::GetBitSize Line 4588
lldb_private::CompilerType::GetBitSize Line 484
lldb_private::CompilerType::GetByteSize Line 490
DWARFASTParserClang::ParseSingleMember Line 2680
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseChildMembers Line 2888
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParsePointerToMemberType Line 1362
DWARFASTParserClang::ParseTypeFromDWARF Line 530
...
DWARFASTParserClang::ParseChildParameters Line 3014
DWARFASTParserClang::ParseSubroutine Line 942
DWARFASTParserClang::ParseTypeFromDWARF Line 522
...
DWARFASTParserClang::CompleteRecordType Line 2003
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseSingleMember Line 2562
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParsePointerToMemberType Line 1362
DWARFASTParserClang::ParseTypeFromDWARF Line 530
...
DWARFASTParserClang::ParseChildParameters Line 3014
DWARFASTParserClang::ParseSubroutine Line 942
DWARFASTParserClang::ParseTypeFromDWARF Line 522
...
DWARFASTParserClang::CompleteRecordType Line 2003
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseSingleMember Line 2562
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParsePointerToMemberType Line 1362
DWARFASTParserClang::ParseTypeFromDWARF Line 530
...
DWARFASTParserClang::ParseChildParameters Line 3014
DWARFASTParserClang::ParseSubroutine Line 942
DWARFASTParserClang::ParseTypeFromDWARF Line 522
...
DWARFASTParserClang::CompleteRecordType Line 2003
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseSingleMember Line 2562
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParsePointerToMemberType Line 1362
DWARFASTParserClang::ParseTypeFromDWARF Line 530
...
DWARFASTParserClang::ParseChildParameters Line 3014
DWARFASTParserClang::ParseSubroutine Line 942
DWARFASTParserClang::ParseTypeFromDWARF Line 522
...
DWARFASTParserClang::CompleteRecordType Line 2003
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseSingleMember Line 2562
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseChildMembers Line 2888
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseChildMembers Line 2888
* DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseSingleMember Line 2562
DWARFASTParserClang::ParseChildMembers Line 2801
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParsePointerToMemberType Line 1362
DWARFASTParserClang::ParseTypeFromDWARF Line 530
...
DWARFASTParserClang::ParseChildParameters Line 3014
DWARFASTParserClang::ParseSubroutine Line 942
DWARFASTParserClang::ParseTypeFromDWARF L
...
DWARFASTParserClang::CompleteRecordType Line 2003
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
...
DWARFASTParserClang::ParseChildMembers Line 2888
DWARFASTParserClang::CompleteRecordType Line 2002
DWARFASTParserClang::CompleteTypeFromDWARF Line 2126
SymbolFileDWARF::CompleteType Line 1484
lldb_private::TypeSystemClang::CompleteTagDecl Line 9100
GetCompleteQualType Line 2607
lldb_private::TypeSystemClang::GetNumChildren Line 5166
lldb_private::TypeSystemClang::GetNumChildren Line 5281
lldb_private::ValueObjectDynamicValue::CalculateNumChildren Line 96
lldb_private::ValueObject::GetNumChildren Line 561
lldb::SBValue::GetNumChildren Line 993
lldb::SBValue::GetNumChildren Line 982
[External Code]
Full stack trace is attached.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20210421/4eff4537/attachment-0001.html>
More information about the lldb-dev
mailing list