[Lldb-commits] [lldb] [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #90663)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 12:35:19 PDT 2024


clayborg wrote:

This is causing a clang assertion due:
```
(lldb) type lookup std::ios_base
Assertion failed: (DD && "queried property of class with no definition"), function data, file DeclCXX.h, line 464.
bt
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert
    frame #0: 0x0000000180acaa60 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x0000000180b02c20 libsystem_pthread.dylib`pthread_kill + 288
    frame #2: 0x0000000180a0fa20 libsystem_c.dylib`abort + 180
    frame #3: 0x0000000180a0ed10 libsystem_c.dylib`__assert_rtn + 284
    frame #4: 0x000000012223ba64 LLDB`clang::CXXRecordDecl::data(this=0x0000000119ec5518) const at DeclCXX.h:464:5
    frame #5: 0x00000001223b7914 LLDB`clang::CXXRecordDecl::hasUserDeclaredMoveConstructor(this=0x0000000119ec5518) const at DeclCXX.h:858:12
    frame #6: 0x0000000122399c0c LLDB`lldb_private::TypeSystemClang::CompleteTagDeclarationDefinition(type=0x000000050296fd10) at TypeSystemClang.cpp:8370:28
  * frame #7: 0x000000012222e4ac LLDB`DWARFASTParserClang::CompleteRecordType(this=0x000000050296faa0, die=0x00000001761932d0 0x00000004be848030 (0x000000000090cdd5), type=0x000000050296fca0, clang_type=0x000000050296fd10) at DWARFASTParserClang.cpp:2291:3
    frame #8: 0x000000012222f150 LLDB`DWARFASTParserClang::CompleteTypeFromDWARF(this=0x000000050296faa0, die=0x00000001761932d0 0x00000004be848030 (0x000000000090cdd5), type=0x000000050296fca0, clang_type=0x000000050296fd10) at DWARFASTParserClang.cpp:2356:12
    frame #9: 0x00000001222b6eac LLDB`lldb_private::plugin::dwarf::SymbolFileDWARF::CompleteType(this=0x000000011912e218, compiler_type=0x000000050296fd10) at SymbolFileDWARF.cpp:1659:23
    frame #10: 0x00000001218952e0 LLDB`lldb_private::Type::ResolveCompilerType(this=0x000000050296fca0, compiler_type_resolve_state=Full) at Type.cpp:715:24
    frame #11: 0x0000000121895520 LLDB`lldb_private::Type::GetFullCompilerType(this=0x000000050296fca0) at Type.cpp:755:3
    frame #12: 0x00000001218e49c8 LLDB`lldb_private::Language::ImageListTypeScavenger::Find_Impl(this=0x0000000118ebd000, exe_scope=0x000000011a810e00, key="std::ios_base", results=size=0) at Language.cpp:473:43
    frame #13: 0x00000001218e47f8 LLDB`lldb_private::Language::TypeScavenger::Find(this=0x0000000118ebd000, exe_scope=0x000000011a810e00, key="std::ios_base", results=size=0, append=true) at Language.cpp:456:13
    frame #14: 0x000000012418c958 LLDB`CommandObjectTypeLookup::DoExecute(this=0x0000000118e7a200, raw_command_line="std::ios_base", result=0x000000016fdfe2f0) at CommandObjectType.cpp:2667:24
    frame #15: 0x000000012175fe3c LLDB`lldb_private::CommandObjectRaw::Execute(this=0x0000000118e7a200, args_string="std::ios_base", result=0x000000016fdfe2f0) at CommandObject.cpp:850:7
    frame #16: 0x0000000121733c74 LLDB`lldb_private::CommandInterpreter::HandleCommand(this=0x0000000100739130, command_line="type lookup std::ios_base", lazy_add_to_history=eLazyBoolCalculate, result=0x000000016fdfe2f0, force_repeat_command=false) at CommandInterpreter.cpp:2038:14
    frame #17: 0x0000000121738594 LLDB`lldb_private::CommandInterpreter::IOHandlerInputComplete(this=0x0000000100739130, io_handler=0x0000000118eb5918, line="type lookup std::ios_base") at CommandInterpreter.cpp:3118:3
    frame #18: 0x00000001214c9004 LLDB`lldb_private::IOHandlerEditline::Run(this=0x0000000118eb5918) at IOHandler.cpp:600:22
    frame #19: 0x000000012145982c LLDB`lldb_private::Debugger::RunIOHandlers(this=0x000000010185fe00) at Debugger.cpp:1092:16
    frame #20: 0x0000000121739bc4 LLDB`lldb_private::CommandInterpreter::RunCommandInterpreter(this=0x0000000100739130, options=0x0000000118e94340) at CommandInterpreter.cpp:3380:16
    frame #21: 0x00000001211496f0 LLDB`lldb::SBDebugger::RunCommandInterpreter(this=0x000000016fdfeb90, options=0x000000016fdfe878) at SBDebugger.cpp:1288:14
    frame #22: 0x0000000100006338 lldb`Driver::MainLoop(this=0x000000016fdfeb70) at Driver.cpp:558:20
    frame #23: 0x0000000100006e54 lldb`main(argc=7, argv=0x000000016fdff308) at Driver.cpp:807:26
    frame #24: 0x000000018077a0e0 dyld`start + 2360
```
The DIE being passed to `DWARFASTParserClang::CompleteRecordType()` looks like:
```
0x0090cdbf: DW_TAG_compile_unit
              DW_AT_producer	("clang version 15.0.7 (mononoke://mononoke.internal.tfbnw.net/fbsource 79a342ef1fab2184ef28a1c26022c7cbaec90e83)")
              DW_AT_language	(DW_LANG_C_plus_plus_14)
              DW_AT_name	("fbcode/folly/detail/UniqueInstance.cpp")
              DW_AT_dwo_name	("buck-out/v2/gen/fbcode/0765d56217397ee3/hphp/hhvm/__hhvm_link__/libunique_instance.a/UniqueInstance.cpp.o.opt.o")

0x0090cdc7:   DW_TAG_namespace
                DW_AT_name	("std")

0x0090cdd5:     DW_TAG_class_type
                  DW_AT_name	("ios_base")
                  DW_AT_declaration	(true)

0x0090cdd7:       DW_TAG_class_type
                    DW_AT_name	("Init")
                    DW_AT_declaration	(true)

0x0090cdda:       DW_TAG_typedef
                    DW_AT_type	(0x0090ce4e "std::_Ios_Seekdir")
                    DW_AT_name	("seekdir")
                    DW_AT_decl_file	(0x11)
                    DW_AT_decl_line	(479)

0x0090cde4:       DW_TAG_typedef
                    DW_AT_type	(0x0090ce45 "std::_Ios_Openmode")
                    DW_AT_name	("openmode")
                    DW_AT_decl_file	(0x11)
                    DW_AT_decl_line	(447)

0x0090cdee:       DW_TAG_typedef
                    DW_AT_type	(0x0090ce3c "std::_Ios_Iostate")
                    DW_AT_name	("iostate")
                    DW_AT_decl_file	(0x11)
                    DW_AT_decl_line	(416)

0x0090cdf8:       NULL
```
So this DIE is just a declaration. Shouldn't this code have tried to find a non declaration DIE for "std::ios_base"?

https://github.com/llvm/llvm-project/pull/90663


More information about the lldb-commits mailing list