[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 22 02:16:42 PDT 2024
weliveindetail wrote:
The test caused a crash in the past:
```
> bin/lldb.exe llvm-project-build-main/tools/lldb/test/Shell/SymbolFile/DWARF/x86/Output/ms-abi.cpp.tmp.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 mp9"
Exception Code: 0x80000003
...
#6 0x00007ffabb6be846 clang::MSInheritanceAttr::getInheritanceModel llvm-project-build-main\tools\clang\include\clang\AST\Attrs.inc:6878:0
#7 0x00007ffabb6be846 clang::CXXRecordDecl::getMSInheritanceModel(void) const llvm-project\clang\lib\AST\MicrosoftCXXABI.cpp:235:0
#8 0x00007ffabb6be8f8 llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *>::getFromOpaqueValue llvm-project\llvm\include\llvm\ADT\PointerUnion.h:196:0
#9 0x00007ffabb6be8f8 llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *> >::getFromVoidPointer llvm-project\llvm\include\llvm\ADT\PointerUnion.h:271:0
#10 0x00007ffabb6be8f8 llvm::PointerIntPairInfo<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *>,3,llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *> > >::getPointer llvm-project\llvm\include\llvm\ADT\PointerIntPair.h:191:0
#11 0x00007ffabb6be8f8 llvm::PointerIntPair<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *>,3,unsigned int,llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *> >,llvm::PointerIntPairInfo<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *>,3,llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Type const *,clang::ExtQuals const *> > > >::getPointer llvm-project\llvm\include\llvm\ADT\PointerIntPair.h:94:0
#12 0x00007ffabb6be8f8 clang::QualType::isNull llvm-project\clang\include\clang\AST\Type.h:1013:0
#13 0x00007ffabb6be8f8 clang::QualType::getCommonPtr llvm-project\clang\include\clang\AST\Type.h:961:0
#14 0x00007ffabb6be8f8 clang::QualType::getTypePtr llvm-project\clang\include\clang\AST\Type.h:7923:0
#15 0x00007ffabb6be8f8 clang::QualType::operator-> llvm-project\clang\include\clang\AST\Type.h:1005:0
#16 0x00007ffabb6be8f8 clang::MemberPointerType::isMemberFunctionPointer llvm-project\clang\include\clang\AST\Type.h:3541:0
#17 0x00007ffabb6be8f8 getMSMemberPointerSlots llvm-project\clang\lib\AST\MicrosoftCXXABI.cpp:285:0
#18 0x00007ffabb6bef45 `anonymous namespace'::MicrosoftCXXABI::getMemberPointerInfo llvm-project\clang\lib\AST\MicrosoftCXXABI.cpp:310:0
#19 0x00007ffabb340010 clang::ASTContext::getTypeInfoImpl(class clang::Type const *) const llvm-project\clang\lib\AST\ASTContext.cpp:2305:0
#20 0x00007ffabb33f24c clang::ASTContext::getTypeInfo(class clang::Type const *) const llvm-project\clang\lib\AST\ASTContext.cpp:1930:0
#21 0x00007ffab4a6c2f7 clang::ASTContext::getTypeSize(class clang::QualType) const llvm-project\clang\include\clang\AST\ASTContext.h:2466:0
#22 0x00007ffab4aa9e75 lldb_private::TypeSystemClang::GetBitSize(void *, class lldb_private::ExecutionContextScope *) llvm-project\lldb\source\Plugins\TypeSystem\Clang\TypeSystemClang.cpp:4825:0
```
Now it survives:
```
(lldb) target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 mp9
(SITYPE) mp1 = <Unable to determine byte size.>
(MITYPE) mp2 = <Unable to determine byte size.>
(MI2TYPE) mp3 = <Unable to determine byte size.>
(VITYPE) mp4 = <Unable to determine byte size.>
(VI2TYPE) mp5 = <Unable to determine byte size.>
(UITYPE) mp6 = <Unable to determine byte size.>
(MITYPE *) mp7 = 0x0000000000000000
(VI2TYPE *) mp8 = 0x0000000000000000
error: Unable to determine byte size.
```
Next, we might want to query the complete type on demand to determine the actual byte sizes.
https://github.com/llvm/llvm-project/pull/112928
More information about the lldb-commits
mailing list