[Lldb-commits] [PATCH] D131437: Don't index the skeleton CU when we have a fission compile unit.
Jordan Rupprecht via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 13 10:54:08 PDT 2022
rupprecht added a comment.
In D131437#3751366 <https://reviews.llvm.org/D131437#3751366>, @bkramer wrote:
> This seems to trigger a use after free in `lldb-api :: functionalities/thread/create_after_attach/TestCreateAfterAttach.py`
>
> asan log:
>
> ==4741==ERROR: AddressSanitizer: heap-use-after-free on address 0x62f00023bf58 at pc 0x563639db88f1 bp 0x7ffd942412f0 sp 0x7ffd942412e8
> READ of size 4 at 0x62f00023bf58 thread T0
> #0 0x563639db88f0 in HasChildren lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:124:37
> #1 0x563639db88f0 in GetFirstChild lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:148:12
> #2 0x563639db88f0 in GetFirstChild lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp:101:34
> #3 0x563639db88f0 in child_iterator lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h:107:57
> #4 0x563639db88f0 in DWARFDIE::children() const lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp:466:27
> #5 0x563639d9f4e1 in DWARFASTParserClang::EnsureAllDIEsInDeclContextHaveBeenParsed(lldb_private::CompilerDeclContext) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2203:37
> #6 0x563639f1ab62 in lldb_private::TypeSystemClang::DeclContextFindDeclByName(void*, lldb_private::ConstString, bool) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:9494:22
> #7 0x563639f489fd in lldb_private::CompilerDeclContext::FindDeclByName(lldb_private::ConstString, bool) lldb/source/Symbol/CompilerDeclContext.cpp:20:27
> #8 0x563639b6113c in lldb_private::ClangExpressionDeclMap::LookupLocalVariable(lldb_private::NameSearchContext&, lldb_private::ConstString, lldb_private::SymbolContext&, lldb_private::CompilerDeclContext const&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1084:20
> #9 0x563639b5d7cf in lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&, std::__u::shared_ptr<lldb_private::Module>, lldb_private::CompilerDeclContext const&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1434:9
> #10 0x563639b5c9df in lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:728:5
> #11 0x563639b3df83 in lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName) lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:180:3
> #12 0x56363d02aa30 in clang::DeclContext::lookup(clang::DeclarationName) const clang/lib/AST/DeclBase.cpp:1706:17
> #13 0x56363c2bca5b in LookupDirect(clang::Sema&, clang::LookupResult&, clang::DeclContext const*) clang/lib/Sema/SemaLookup.cpp:1108:39
> #14 0x56363c2b67f5 in CppNamespaceLookup(clang::Sema&, clang::LookupResult&, clang::ASTContext&, clang::DeclContext*, (anonymous namespace)::UnqualUsingDirectiveSet&) clang/lib/Sema/SemaLookup.cpp:1207:16
> #15 0x56363c2b5a1e in clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) clang/lib/Sema/SemaLookup.cpp:1495:15
> #16 0x56363c2bc0f2 in clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool, bool) clang/lib/Sema/SemaLookup.cpp:2259:9
> #17 0x56363bdb50b8 in clang::Sema::BuildUsingDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, bool, clang::SourceLocation, clang::CXXScopeSpec&, clang::DeclarationNameInfo, clang::SourceLocation, clang::ParsedAttributesView const&, bool, bool) clang/lib/Sema/SemaDeclCXX.cpp:12329:5
> #18 0x56363bdb49f3 in clang::Sema::ActOnUsingDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, clang::UnqualifiedId&, clang::SourceLocation, clang::ParsedAttributesView const&) clang/lib/Sema/SemaDeclCXX.cpp:11833:7
> #19 0x56363b49df12 in clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) clang/lib/Parse/ParseDeclCXX.cpp:803:26
> #20 0x56363b49c27d in clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) clang/lib/Parse/ParseDeclCXX.cpp:512:10
> #21 0x56363b46c161 in clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) clang/lib/Parse/ParseDecl.cpp:1797:12
> #22 0x56363b55fb99 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) clang/lib/Parse/ParseStmt.cpp:247:16
> #23 0x56363b55cfb6 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) clang/lib/Parse/ParseStmt.cpp:115:20
> #24 0x56363b56c048 in clang::Parser::ParseCompoundStatementBody(bool) clang/lib/Parse/ParseStmt.cpp:1171:11
> #25 0x56363b56e32d in clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) clang/lib/Parse/ParseStmt.cpp:2442:21
> #26 0x56363b5988a8 in clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) clang/lib/Parse/Parser.cpp:1428:10
> #27 0x56363b47493a in clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) clang/lib/Parse/ParseDecl.cpp:2117:27
> #28 0x56363b5971c9 in clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) clang/lib/Parse/Parser.cpp:1179:10
> #29 0x56363b596633 in clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) clang/lib/Parse/Parser.cpp:1193:12
> #30 0x56363b594dbc in clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) clang/lib/Parse/Parser.cpp:1019:12
> #31 0x56363b592079 in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) clang/lib/Parse/Parser.cpp:737:12
> #32 0x56363b453bbe in clang::ParseAST(clang::Sema&, bool, bool) clang/lib/Parse/ParseAST.cpp:162:20
> #33 0x563639b7608c in lldb_private::ClangExpressionParser::ParseInternal(lldb_private::DiagnosticManager&, clang::CodeCompleteConsumer*, unsigned int, unsigned int) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:1176:5
> #34 0x563639b9e617 in lldb_private::ClangUserExpression::TryParse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContextScope*, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:580:35
> #35 0x563639b9ecff in lldb_private::ClangUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:679:24
> #36 0x563639aa5039 in lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, std::__u::shared_ptr<lldb_private::ValueObject>&, lldb_private::Status&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>*, lldb_private::ValueObject*) lldb/source/Expression/UserExpression.cpp:271:27
> #37 0x56363a090e07 in lldb_private::Target::EvaluateExpression(llvm::StringRef, lldb_private::ExecutionContextScope*, std::__u::shared_ptr<lldb_private::ValueObject>&, lldb_private::EvaluateExpressionOptions const&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>*, lldb_private::ValueObject*) lldb/source/Target/Target.cpp:2520:25
> #38 0x56363980c17d in lldb_private::CommandObjectExpression::EvaluateExpression(llvm::StringRef, lldb_private::Stream&, lldb_private::Stream&, lldb_private::CommandReturnObject&) lldb/source/Commands/CommandObjectExpression.cpp:402:38
> #39 0x56363980d703 in lldb_private::CommandObjectExpression::DoExecute(llvm::StringRef, lldb_private::CommandReturnObject&) lldb/source/Commands/CommandObjectExpression.cpp:626:7
> #40 0x563639ad9301 in lldb_private::CommandObjectRaw::Execute(char const*, lldb_private::CommandReturnObject&) lldb/source/Interpreter/CommandObject.cpp:769:17
> #41 0x563639ac357c in lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&) lldb/source/Interpreter/CommandInterpreter.cpp:1988:14
>
> 0x62f00023bf58 is located 47960 bytes inside of 53152-byte region [0x62f000230400,0x62f00023d3a0)
> freed by thread T0 here:
> #0 0x563639384022 in operator delete(void*, unsigned long) compiler-rt/lib/asan/asan_new_delete.cpp:164:3
> #1 0x563639ddb422 in __libcpp_operator_delete<void *, unsigned long> include/c++/v1/new:256:3
> #2 0x563639ddb422 in __do_deallocate_handle_size<> include/c++/v1/new:282:10
> #3 0x563639ddb422 in __libcpp_deallocate include/c++/v1/new:296:14
> #4 0x563639ddb422 in deallocate include/c++/v1/__memory/allocator.h:128:13
> #5 0x563639ddb422 in deallocate include/c++/v1/__memory/allocator_traits.h:282:13
> #6 0x563639ddb422 in ~__split_buffer include/c++/v1/__split_buffer:355:9
> #7 0x563639ddb422 in std::__u::vector<DWARFDebugInfoEntry, std::__u::allocator<DWARFDebugInfoEntry>>::shrink_to_fit() include/c++/v1/vector:1525:5
> #8 0x563639dd4f07 in DWARFUnit::ClearDIEsRWLocked() lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:599:15
> #9 0x563639dd4e6a in DWARFUnit::ScopedExtractDIEs::~ScopedExtractDIEs() lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:183:9
> #10 0x563639df0f2c in reset llvm/include/llvm/ADT/Optional.h:88:12
> #11 0x563639df0f2c in ~OptionalStorage llvm/include/llvm/ADT/Optional.h:67:24
> #12 0x563639df0f2c in ~Optional llvm/include/llvm/ADT/APInt.h:33:29
> #13 0x563639df0f2c in destroy include/c++/v1/__memory/allocator.h:170:15
> #14 0x563639df0f2c in destroy<llvm::Optional<DWARFUnit::ScopedExtractDIEs>, void> include/c++/v1/__memory/allocator_traits.h:309:13
> #15 0x563639df0f2c in __base_destruct_at_end include/c++/v1/vector:833:9
> #16 0x563639df0f2c in __clear include/c++/v1/vector:827:29
> #17 0x563639df0f2c in std::__u::vector<llvm::Optional<DWARFUnit::ScopedExtractDIEs>, std::__u::allocator<llvm::Optional<DWARFUnit::ScopedExtractDIEs>>>::~vector() include/c++/v1/vector:436:9
> #18 0x563639debf7d in lldb_private::ManualDWARFIndex::Index() lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:137:1
> #19 0x563639dedbf3 in lldb_private::ManualDWARFIndex::GetGlobalVariables(DWARFUnit&, llvm::function_ref<bool (DWARFDIE)>) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:390:3
> #20 0x563639e12633 in SymbolFileDWARF::ParseVariablesForContext(lldb_private::SymbolContext const&) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3131:18
> #21 0x563639f44425 in lldb_private::CompileUnit::GetVariableList(bool) lldb/source/Symbol/CompileUnit.cpp:213:36
> #22 0x56363a04799f in lldb_private::StackFrame::GetInScopeVariableList(bool, bool) lldb/source/Target/StackFrame.cpp:487:25
> #23 0x563639b6100e in lldb_private::ClangExpressionDeclMap::LookupLocalVariable(lldb_private::NameSearchContext&, lldb_private::ConstString, lldb_private::SymbolContext&, lldb_private::CompilerDeclContext const&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1076:32
> #24 0x563639b5d7cf in lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&, std::__u::shared_ptr<lldb_private::Module>, lldb_private::CompilerDeclContext const&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1434:9
> #25 0x563639b5c9df in lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:728:5
> #26 0x563639b3df83 in lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName) lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:180:3
> #27 0x56363d02aa30 in clang::DeclContext::lookup(clang::DeclarationName) const clang/lib/AST/DeclBase.cpp:1706:17
> #28 0x56363c2bca5b in LookupDirect(clang::Sema&, clang::LookupResult&, clang::DeclContext const*) clang/lib/Sema/SemaLookup.cpp:1108:39
> #29 0x56363c2b67f5 in CppNamespaceLookup(clang::Sema&, clang::LookupResult&, clang::ASTContext&, clang::DeclContext*, (anonymous namespace)::UnqualUsingDirectiveSet&) clang/lib/Sema/SemaLookup.cpp:1207:16
> #30 0x56363c2b5a1e in clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) clang/lib/Sema/SemaLookup.cpp:1495:15
> #31 0x56363c2bc0f2 in clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool, bool) clang/lib/Sema/SemaLookup.cpp:2259:9
> #32 0x56363bdb50b8 in clang::Sema::BuildUsingDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, bool, clang::SourceLocation, clang::CXXScopeSpec&, clang::DeclarationNameInfo, clang::SourceLocation, clang::ParsedAttributesView const&, bool, bool) clang/lib/Sema/SemaDeclCXX.cpp:12329:5
> #33 0x56363bdb49f3 in clang::Sema::ActOnUsingDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, clang::UnqualifiedId&, clang::SourceLocation, clang::ParsedAttributesView const&) clang/lib/Sema/SemaDeclCXX.cpp:11833:7
> #34 0x56363b49df12 in clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) clang/lib/Parse/ParseDeclCXX.cpp:803:26
> #35 0x56363b49c27d in clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) clang/lib/Parse/ParseDeclCXX.cpp:512:10
> #36 0x56363b46c161 in clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) clang/lib/Parse/ParseDecl.cpp:1797:12
> #37 0x56363b55fb99 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) clang/lib/Parse/ParseStmt.cpp:247:16
> #38 0x56363b55cfb6 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) clang/lib/Parse/ParseStmt.cpp:115:20
> #39 0x56363b56c048 in clang::Parser::ParseCompoundStatementBody(bool) clang/lib/Parse/ParseStmt.cpp:1171:11
> #40 0x56363b56e32d in clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) clang/lib/Parse/ParseStmt.cpp:2442:21
> #41 0x56363b5988a8 in clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) clang/lib/Parse/Parser.cpp:1428:10
> #42 0x56363b47493a in clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) clang/lib/Parse/ParseDecl.cpp:2117:27
D133790 <https://reviews.llvm.org/D133790>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131437/new/
https://reviews.llvm.org/D131437
More information about the lldb-commits
mailing list