[lldb-dev] [Bug 52257] New: lldb crashes when printing variable

via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 21 14:55:19 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52257

            Bug ID: 52257
           Summary: lldb crashes when printing variable
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: jgorbe at google.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

Reproduction steps:

1. Save the following code as crash.ii

    template <typename> struct pair {};
    struct A {
      using iterator = pair<char *>;
      pair<char *> a_[];
    };
    struct B {
      using iterator = A::iterator;
      iterator begin();
      A *tag_set_;
    };
    B b;


2. clang++ -g -c crash.ii
3. lldb -o 'print b' crash.o

On a debug lldb build close to top of tree, lldb crashes with the assertion
failure and stack trace pasted below. Note that the failure also reproduces
after building with `-fstandalone-debug`.

(lldb) target create "crash.o"
Current executable set to '/usr/local/google/home/jgorbe/lldb/crash.o'
(x86_64).
(lldb) print b
lldb:
/usr/local/google/home/jgorbe/code/llvm/llvm/../clang/include/clang/AST/DeclCXX.h:435:
struct DefinitionData &clang::CXXRecordDecl::data() const: Assertion `DD &&
"queried property of class with no definition"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments:
/usr/local/google/home/jgorbe/code/llvm-build/bin/lldb -o "print b" crash.o
 #0 0x00000000003d36da llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/usr/local/google/home/jgorbe/code/llvm/llvm/lib/Support/Unix/Signals.inc:565:11
 #1 0x00000000003d388b PrintStackTraceSignalHandler(void*)
/usr/local/google/home/jgorbe/code/llvm/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x00000000003d1f53 llvm::sys::RunSignalHandlers()
/usr/local/google/home/jgorbe/code/llvm/llvm/lib/Support/Signals.cpp:97:5
 #3 0x00000000003d3fb5 SignalHandler(int)
/usr/local/google/home/jgorbe/code/llvm/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007fd2f6dc08e0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x138e0)
 #5 0x00007fd2e70b8e71 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:50:1
 #6 0x00007fd2e70a2536 abort ./stdlib/abort.c:81:7
 #7 0x00007fd2e70a241f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #8 0x00007fd2e70a241f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #9 0x00007fd2e70b17f2 (/lib/x86_64-linux-gnu/libc.so.6+0x357f2)
#10 0x00007fd2eea9fdb7 clang::CXXRecordDecl::data() const
/usr/local/google/home/jgorbe/code/llvm/llvm/../clang/include/clang/AST/DeclCXX.h:436:13
#11 0x00007fd2eeb42095 clang::CXXRecordDecl::bases_begin() const
/usr/local/google/home/jgorbe/code/llvm/llvm/../clang/include/clang/AST/DeclCXX.h:597:58
#12 0x00007fd2f1618b49 clang::CXXRecordDecl::bases() const
/usr/local/google/home/jgorbe/code/llvm/clang/include/clang/AST/DeclCXX.h:593:35
#13 0x00007fd2f16ad990 isSafeToConvert(clang::RecordDecl const*,
clang::CodeGen::CodeGenTypes&, llvm::SmallPtrSet<clang::RecordDecl const*,
16u>&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:149:31
#14 0x00007fd2f16adbc2 isSafeToConvert(clang::QualType,
clang::CodeGen::CodeGenTypes&, llvm::SmallPtrSet<clang::RecordDecl const*,
16u>&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:177:5
#15 0x00007fd2f16adc16 isSafeToConvert(clang::QualType,
clang::CodeGen::CodeGenTypes&, llvm::SmallPtrSet<clang::RecordDecl const*,
16u>&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:181:5
#16 0x00007fd2f16adaf0 isSafeToConvert(clang::RecordDecl const*,
clang::CodeGen::CodeGenTypes&, llvm::SmallPtrSet<clang::RecordDecl const*,
16u>&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:158:9
#17 0x00007fd2f16ac6a2 isSafeToConvert(clang::RecordDecl const*,
clang::CodeGen::CodeGenTypes&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:198:3
#18 0x00007fd2f16aca62
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:832:7
#19 0x00007fd2f16ab45f
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:416:5
#20 0x00007fd2f16ab23d
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes
.cpp:98:15
#21 0x00007fd2f16abad6
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:643:17
#22 0x00007fd2f16ab23d
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:98:15
#23 0x00007fd2f1cbf1ab (anonymous
namespace)::CGRecordLowering::getStorageType(clang::FieldDecl const*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:148:17
#24 0x00007fd2f1cbda67 (anonymous
namespace)::CGRecordLowering::accumulateFields()
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:384:11
#25 0x00007fd2f1cbc5f7 (anonymous namespace)::CGRecordLowering::lower(bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:287:3
#26 0x00007fd2f1cbb847
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:884:21
#27 0x00007fd2f16acc1f
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:852:26
#28 0x00007fd2f16ab45f
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:416:5
#29 0x00007fd2f16ab23d
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:98:15
#30 0x00007fd2f16abad6
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:643:17
#31 0x00007fd2f16ab23d
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenTypes.cpp:98:15
#32 0x00007fd2f188dd3b
clang::CodeGen::CodeGenModule::getOrCreateStaticVarDecl(clang::VarDecl const&,
llvm::GlobalValue::LinkageTypes)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGDecl.cpp:258:32
#33 0x00007fd2f188d554
clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(clang::VarDecl const&,
llvm::GlobalValue::LinkageTypes)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGDecl.cpp:403:30
#34 0x00007fd2f188d31e
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGDecl.cpp:206:5
#35 0x00007fd2f188d072 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGDecl.cpp:159:49
#36 0x00007fd2f1748a60
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGStmt.cpp:1330:22
#37 0x00007fd2f1741253
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGStmt.cpp:411:5
#38 0x00007fd2f174044c clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGStmt.cpp:58:7
#39 0x00007fd2f1749abf
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CGStmt.cpp:465:3
#40 0x00007fd2f171bb9d
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenFunction.cpp:1200:5
#41 0x00007fd2f171c864
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenFunction.cpp:1392:3
#42 0x00007fd2f157e952
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenModule.cpp:4894:3
#43 0x00007fd2f1575eb9
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenModule.cpp:3253:12
#44 0x00007fd2f157ab4c
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenModule.cpp:3001:5
#45 0x00007fd2f15820a0
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/CodeGenModule.cpp:5729:5
#46 0x00007fd2f1563bc0 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/CodeGen/ModuleBuilder.cpp:169:73
#47 0x00007fd2f135a738
lldb_private::ASTResultSynthesizer::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp:110:5
#48 0x00007fd2f132dbda
lldb_private::ASTConsumerForwarder::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h:152:5
#49 0x00007fd2f2f1da96 clang::ParseAST(clang::Sema&, bool, bool)
/usr/local/google/home/jgorbe/code/llvm/clang/lib/Parse/ParseAST.cpp:162:20
#50 0x00007fd2f12f215f
lldb_private::ClangExpressionParser::ParseInternal(lldb_private::DiagnosticManager&,
clang::CodeCompleteConsumer*, unsigned int, unsigned int)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:1173:5
#51 0x00007fd2f12f2457
lldb_private::ClangExpressionParser::Parse(lldb_private::DiagnosticManager&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:1031:3
#52 0x00007fd2f1352b03
lldb_private::ClangUserExpression::TryParse(lldb_private::DiagnosticManager&,
lldb_private::ExecutionContextScope*, lldb_private::ExecutionContext&,
lldb_private::ExecutionPolicy, bool, bool)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:579:12
#53 0x00007fd2f13530a8
lldb_private::ClangUserExpression::Parse(lldb_private::DiagnosticManager&,
lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:678:8
#54 0x00007fd2ee2fe54c
lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&,
lldb_private::EvaluateExpressionOptions const&, llvm::StringRef,
llvm::StringRef, std::shared_ptr<lldb_private::ValueObject>&,
lldb_private::Status&, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, lldb_private::ValueObject*)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Expression/UserExpression.cpp:248:8
#55 0x00007fd2ee526961
lldb_private::Target::EvaluateExpression(llvm::StringRef,
lldb_private::ExecutionContextScope*,
std::shared_ptr<lldb_private::ValueObject>&,lldb_private::EvaluateExpressionOptions
const&, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, lldb_private::ValueObject*)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Target/Target.cpp:2434:23
#56 0x00007fd2f11920ec
lldb_private::CommandObjectExpression::EvaluateExpression(llvm::StringRef,
lldb_private::Stream&, lldb_private::Stream&,
lldb_private::CommandReturnObject&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Commands/CommandObjectExpression.cpp:418:38
#57 0x00007fd2f1193039
lldb_private::CommandObjectExpression::DoExecute(llvm::StringRef,
lldb_private::CommandReturnObject&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Commands/CommandObjectExpression.cpp:645:7
#58 0x00007fd2ee391d94 lldb_private::CommandObjectRaw::Execute(char const*,
lldb_private::CommandReturnObject&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Interpreter/CommandObject.cpp:1017:15
#59 0x00007fd2ee36474c lldb_private::CommandInterpreter::HandleCommand(char
const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Interpreter/CommandInterpreter.cpp:1972:3
#60 0x00007fd2ee36889a
lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
>&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Interpreter/CommandInterpreter.cpp:3024:15
#61 0x00007fd2ee22ac90 lldb_private::IOHandlerEditline::Run()
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Core/IOHandler.cpp:577:7
#62 0x00007fd2ee1ec771 lldb_private::Debugger::RunIOHandlers()
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Core/Debugger.cpp:877:16
#63 0x00007fd2ee369b14
lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInterpreterRunOptions&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/Interpreter/CommandInterpreter.cpp:3269:9
#64 0x00007fd2edb5999e
lldb::SBDebugger::RunCommandInterpreter(lldb::SBCommandInterpreterRunOptions
const&)
/usr/local/google/home/jgorbe/code/llvm/lldb/source/API/SBDebugger.cpp:1255:14
#65 0x00000000002a24e1 Driver::MainLoop()
/usr/local/google/home/jgorbe/code/llvm/lldb/tools/driver/Driver.cpp:615:17
#66 0x00000000002a344f main
/usr/local/google/home/jgorbe/code/llvm/lldb/tools/driver/Driver.cpp:944:17
#67 0x00007fd2e70a3e4a __libc_start_main ./csu/../csu/libc-start.c:314:16
#68 0x000000000029fc5a _start
(/usr/local/google/home/jgorbe/code/llvm-build/bin/lldb+0x29fc5a)
Aborted

-- 
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/20211021/33c8ec56/attachment-0001.html>


More information about the lldb-dev mailing list