Description
Previous ID | SR-10527 |
Radar | None |
Original Reporter | ivhernandez (JIRA User) |
Type | Bug |
Environment
Xcode 10.2.1
lldb version 7.0.0
Swift version 5.0-dev (LLVM 06f1615069, Swift d5426bc)
Additional Detail from JIRA
Votes | 0 |
Component/s | LLDB for Swift |
Labels | Bug, LLDBCrash |
Assignee | None |
Priority | Medium |
md5: 0195b20bfcafd1f5f212126750e70ab6
Issue Description:
Repro Steps:
-
Create a new single view application Xcode project.
-
Set deployment target to 11.4 or anything below 12.0.
-
Build application.
-
Boot, install, launch on a simulator with simctl.
-
Attach to process by pid with swift-lldb.
-
Run command: `b ViewController.swift:14`
The crash is occuring in GenType.cpp in swift::irgen::TypeConverter::TypeConverter() with error:
_LLVM ERROR: Cannot read '/Users/ivanhernandez/Desktop/GitHub_Clones/swift-lldb/build/Debug/LLDB.framework/Resources/Swift/iphonesimulator/layouts-x86_64.yaml'
Assertion failed: (e == 0), function ~recursive_mutex, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/libcxx/libcxx-400.9.4/src/mutex.cpp, line 64._
This occurs when using a deployment target under 12.0. Looks like the crash is avoided in iOS >= 12.0 because the TypeConverter constructor returns early if SupportsObjCMetadataUpdateCallback(Triple) is true which happens when iOS version is >=12.2 or macOS version >= 10.14.4. When using deployment target 12.0 or greater, the triple is set to "x86_64--macosx12.2.0" for some reason and 12.2.0 >= 10.14.4 so the constructor exits early. On iOS 11.4 and lower, the triple is "x86_64-apple-ios11.4.0". The constructor does not returns early and instead tries to read LLDB.framework/Resources/Swift/iphonesimulator/layouts-x86_64.yaml which doesn't exist and swift-lldb crashes.
I am using swift-lldb built from the 'stable' branch at commit d5426bc and swift from the 'master' branch. This crash does not occur when using swift-lldb and swift from the 'swift-5.0-branch' branch.
*Stack trace: *
(lldb) bt
-
thread [DON'T MERGE] Test pull request #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff67a0c23e libsystem_kernel.dylib`__pthread_kill + 10
frame [DON'T MERGE] Test pull request #1: 0x00007fff67ac2c1c libsystem_pthread.dylib`pthread_kill + 285
frame [lldb][NFC] Actually test which method we call in TestCallOverriddenMethod #2: 0x00007fff679751c9 libsystem_c.dylib`abort + 127
frame [lldb] Fix merge after r375160 #3: 0x00007fff6793d868 libsystem_c.dylib`__assert_rtn + 320
frame Apple/stable/20190619 #4: 0x00007fff64fd6580 libc++.1.dylib`std::__1::recursive_mutex::~recursive_mutex() + 46
frame [compiler-rt] Use signal on Windows #5: 0x00007fff67975ef2 libsystem_c.dylib`__cxa_finalize_ranges + 351
frame Cherry-pick "Fix darwin-ld-lto test for some special path" to stable #6: 0x00007fff679761de libsystem_c.dylib`exit + 55
frame Test pull request system #7: 0x00000001017288de LLDB`llvm::report_fatal_error(Reason=<unavailable>, GenCrashDiag=<unavailable>) at ErrorHandling.cpp:126:3 [opt]
frame Recover from a bad merge #8: 0x000000010413ec71 LLDB`swift::irgen::TypeConverter::TypeConverter(this=0x00007ffeefbf94f8, IGM=0x0000000000000070) at GenType.cpp:1213:5 [opt]
frame [Monorepo fixup] Reset lld contents in the swift/master branch to mat… #9: 0x000000010416b6f8 LLDB`swift::irgen::IRGenModule::IRGenModule(this=0x0000000114858800, irgen=0x0000000111aa9560, target=0x00007ffeefbf99c0, SF=0x0000000000000000, LLVMContext=0x000000010801b860, ModuleName=(Data = "", Length = 0), OutputFilename=(Data = "", Length = 0), MainInputFilenameForDebugInfo=(Data = "", Length = 0)) at IRGenModule.cpp:155:18 [opt]
frame Cherrypick upstream reproducer changes. #10: 0x000000010416d03e LLDB`swift::irgen::IRGenModule::IRGenModule(this=<unavailable>, irgen=<unavailable>, target=<unavailable>, SF=<unavailable>, LLVMContext=<unavailable>, ModuleName=(Data = "", Length = 0), OutputFilename=(Data = "", Length = 0), MainInputFilenameForDebugInfo=(Data = "", Length = 0)) at IRGenModule.cpp:155:40 [opt] -
frame [VirtualFileSystem] Support virtual working directory in the RedirectingFS #11: 0x00000001064f09e6 LLDB`lldb_private::SwiftASTContext::GetIRGenModule(this=0x00007ffeefbf9ff8)::$_10::operator()() const at SwiftASTContext.cpp:4598:38
frame Fix compiler errors. #12: 0x00000001064f02fd LLDB`decltype(**f=0x00007ffeefbf9ff8)::$10>(fp)()) std::1::_invoke<lldb_private::SwiftASTContext::GetIRGenModule()::$_10>(lldb_private::SwiftASTContext::GetIRGenModule()::$_10&&) at type_traits:4339:1
frame [CMake] Fix the static bindings workflow. #13: 0x00000001064f02d8 LLDB`void std::1::call_once_param<std::1::tuple<lldb_private::SwiftASTContext::GetIRGenModule()::$10&&> >::execute<>(this=0x00007ffeefbf9f90, (null)=_tuple_indices<> @ 0x00007ffeefbf9ef8) at mutex:621:9
frame Upstream arm64e and Pointer Authentication support #14: 0x00000001064f02a5 LLDB`std::1::call_once_param<std::_1::tuple<lldb_private::SwiftASTContext::GetIRGenModule()::$_10&&> >::operator(this=0x00007ffeefbf9f90)() at mutex:613:9
frame [LLDB] Cherrypick tablegen dependencies #15: 0x00000001064f017d LLDB`void std::1::call_once_proxy<std::1::tuple<lldb_private::SwiftASTContext::GetIRGenModule()::$10&&> >(_vp=0x00007ffeefbf9f90) at mutex:649:5
frame monorepo fixup: Merge --theirs all the untracked dirs in swift/master #16: 0x00007fff64f9b896 libc++.1.dylib`std::1::_call_once(unsigned long volatile&, void*, void ⭐(void*)) + 139
frame move registrations out of SwiftREPL::CompleteCode #17: 0x00000001064f00dc LLDB`void std::**1::call_once<lldb_private::SwiftASTContext::GetIRGenModule()::$10>(_flag=0x0000000111a93750, __func=0x00007ffeefbf9ff8)::$_10&&) at mutex:666:9
frame [SwiftLanguageRuntime] Get rid of some legacy. #18: 0x0000000106476810 LLDB`void llvm::call_once<lldb_private::SwiftASTContext::GetIRGenModule()::$_10>(flag=0x0000000111a93750, F=0x00007ffeefbf9ff8)::$_10&&) at Threading.h:105:5
frame [lldb] Adjust for the new class_rw_t layout. #19: 0x00000001064562a4 LLDB`lldb_private::SwiftASTContext::GetIRGenModule(this=0x0000000111a93700) at SwiftASTContext.cpp:4561:3
frame Reintroduce some seemingly unused code. A test fails. #20: 0x000000010647b764 LLDB`lldb_private::SwiftASTContext::GetSwiftTypeInfo(this=0x0000000111a93700, type=0x00000001120c1398) at SwiftASTContext.cpp:6007:26
frame Fix a couple of SwiftREPL crashes. #21: 0x000000010647e39d LLDB`lldb_private::SwiftASTContext::GetSwiftFixedTypeInfo(this=0x0000000111a93700, type=0x00000001120c1398) at SwiftASTContext.cpp:6020:45
frame [TableGen] Fix default and description of UseAllCompilerFlags #22: 0x000000010647e808 LLDB`lldb_private::SwiftASTContext::GetBitSize(this=0x0000000111a93700, type=0x00000001120c1398, exe_scope=0x0000000000000000) at SwiftASTContext.cpp:6065:7
frame Skip TestIndirectEnumVariables.py tests on macOS (56608695) #23: 0x0000000106732f0e LLDB`lldb_private::CompilerType::GetBitSize(this=0x00007ffeefbfa378, exe_scope=0x0000000000000000) const at CompilerType.cpp:558:27
frame XFAIL TestIndirectEnumVariables.py #24: 0x0000000106732fab LLDB`lldb_private::CompilerType::GetByteSize(this=0x00007ffeefbfa378, exe_scope=0x0000000000000000) const at CompilerType.cpp:564:43
frame Dwarfdump base addr entry support #25: 0x0000000106477781 LLDB`lldb_private::SwiftASTContext::GetPointerByteSize(this=0x0000000111a93700) at SwiftASTContext.cpp:4702:14
frame LLD cherry-picks #26: 0x000000010647e7d5 LLDB`lldb_private::SwiftASTContext::GetBitSize(this=0x0000000111a93700, type=0x00000001120db110, exe_scope=0x0000000000000000) at SwiftASTContext.cpp:6062:12
frame [Driver] Force llvm to install its handlers before lldb's #27: 0x0000000106732f0e LLDB`lldb_private::CompilerType::GetBitSize(this=0x00007ffeefbfada0, exe_scope=0x0000000000000000) const at CompilerType.cpp:558:27
frame Revert "XFAIL TestIndirectEnumVariables.py" #28: 0x0000000106732fab LLDB`lldb_private::CompilerType::GetByteSize(this=0x00007ffeefbfada0, exe_scope=0x0000000000000000) const at CompilerType.cpp:564:43
frame Reapply: Port swift specific compiler-rt code to Windows #29: 0x00000001057ca966 LLDB`DWARFASTParserSwift::ParseTypeFromDWARF(this=0x0000000111a8ce50, sc=0x00007ffeefbfb278, die=0x00007ffeefbfb480, log=0x0000000000000000, type_is_new_ptr=0x0000000000000000) at DWARFASTParserSwift.cpp:213:39
frame Static analyzer cherrypicks 1 #30: 0x0000000105d3c138 LLDB`SymbolFileDWARF::ParseType(this=0x0000000114876a00, sc=0x00007ffeefbfb278, die=0x00007ffeefbfb480, type_is_new_ptr=0x0000000000000000) at SymbolFileDWARF.cpp:3157:30
frame ValueObject: Fix a crash related to children address type computation #31: 0x0000000105d33eff LLDB`SymbolFileDWARF::GetTypeForDIE(this=0x0000000114876a00, die=0x00007ffeefbfb480, resolve_function_context=false) at SymbolFileDWARF.cpp:2628:17
frame [TSan] Fix CI test failures #32: 0x0000000105d329fc LLDB`SymbolFileDWARF::ResolveType(this=0x0000000114876a00, die=0x00007ffeefbfb480, assert_not_being_parsed=true, resolve_function_context=false) at SymbolFileDWARF.cpp:1493:18
frame More fixup for "[TSan] Turn on ignore_interceptors_accesses" #33: 0x0000000105db6d6b LLDB`DWARFDIE::ResolveType(this=0x00007ffeefbfb480) const at DWARFDIE.cpp:135:24
frame Disable the 2 failing tests for now to make the branch baseline green #34: 0x0000000105d327dc LLDB`SymbolFileDWARF::ResolveTypeUID(this=0x0000000114876a00, type_uid=4294967365) at SymbolFileDWARF.cpp:1361:21
frame [lit] Drop the user-site packages directory from search paths when ru… #35: 0x0000000105d7d240 LLDB`SymbolFileDWARFDebugMap::ResolveTypeUID(this=0x0000000111b28810, type_uid=4294967365) at SymbolFileDWARFDebugMap.cpp:709:23
frame Cherry-pick bugfixes #36: 0x0000000105f2da34 LLDB`lldb_private::Function::GetType(this=0x0000000111987000) at Function.cpp:475:24
frame [TSan] Fix test failing on Linux #37: 0x0000000105f2d708 LLDB`lldb_private::Function::GetStartLineSourceInfo(this=0x0000000111987000, source_file=0x00007ffeefbfb8c8, line_no=0x00007ffeefbfb8c4) at Function.cpp:214:3
frame Cherry-pick fixes for rdar://problem/48167864 #38: 0x000000010511ed20 LLDB`lldb_private::BreakpointResolverFileLine::FilterContexts(this=0x000000011185a150, sc_list=0x00007ffeefbfbca8, is_relative=true) at BreakpointResolverFileLine.cpp:166:20
frame Disable Clang modules on swift-lldb. #39: 0x000000010511f70f LLDB`lldb_private::BreakpointResolverFileLine::SearchCallback(this=0x000000011185a150, filter=0x0000000111b6d918, context=0x00007ffeefbfbd98, addr=0x0000000000000000, containing=false) at BreakpointResolverFileLine.cpp:246:3
frame Revert "Disable Clang modules on swift-lldb." #40: 0x000000010557e457 LLDB`lldb_private::SearchFilter::DoModuleIteration(this=0x0000000111b6d918, context=0x00007ffeefbfbfc0, searcher=0x000000011185a150) at SearchFilter.cpp:287:24
frame lldb: correct default value for Boolean #41: 0x000000010557e087 LLDB`lldb_private::SearchFilter::Search(this=0x0000000111b6d918, searcher=0x000000011185a150) at SearchFilter.cpp:226:5
frame Add JSON file for swift-5.1-branch monorepo checkout; skip swift-ast-… #42: 0x00000001050fa3ce LLDB`lldb_private::BreakpointResolver::ResolveBreakpoint(this=0x000000011185a150, filter=0x0000000111b6d918) at BreakpointResolver.cpp:178:10
frame Disable clang modules in LLDB #43: 0x00000001050776be LLDB`lldb_private::Breakpoint::ResolveBreakpoint(this=0x000000011185a1a0) at Breakpoint.cpp:460:20
frame Fast forward apple/stable/20190619 to Sep 4. #44: 0x000000010614a78d LLDB`lldb_private::Target::AddBreakpoint(this=0x0000000113005e00, bp_sp=std::_1::shared_ptr<lldb_private::Breakpoint>::element_type @ 0x000000011185a1a0 strong=3 weak=2, internal=false) at Target.cpp:681:10
frame Cherry-pick more commits #45: 0x000000010614ca67 LLDB`lldb_private::Target::CreateBreakpoint(this=0x0000000113005e00, filter_sp=std::1::shared_ptr<lldb_private::SearchFilter>::element_type @ 0x0000000111b6d918 strong=4 weak=1, resolver_sp=std::_1::shared_ptr<lldb_private::BreakpointResolver>::element_type @ 0x000000011185a150 strong=2 weak=1, internal=false, request_hardware=false, resolve_indirect_symbols=true) at Target.cpp:660:5
frame Avoid adding any framework paths in /System/Library in process_one_mo… #46: 0x000000010614cfef LLDB`lldb_private::Target::CreateBreakpoint(this=0x0000000113005e00, containingModules=0x0000000111a2f8f8, file=0x00007ffeefbfc950, line_no=14, column=0, offset=0, check_inlines=eLazyBoolYes, skip_prologue=eLazyBoolYes, internal=false, hardware=false, move_to_nearest_code=eLazyBoolYes) at Target.cpp:393:10
frame Avoid adding any framework paths in /System/Library in process_one_mo… #47: 0x000000010518deb4 LLDB`CommandObjectBreakpointSet::DoExecute(this=0x0000000111a2f6d0, command=0x00007ffeefbfd508, result=0x00007ffeefbfe770) at CommandObjectBreakpoint.cpp:731:23
frame Revert "ValueObject: Fix a crash related to children address type com… #48: 0x000000010596ec5b LLDB`lldb_private::CommandObjectParsed::Execute(this=0x0000000111a2f6d0, args_string="--file 'ViewController.swift' --line 14", result=0x00007ffeefbfe770) at CommandObject.cpp:974:19
frame [lldb][NFC] Make LLVMUserExpression::DoExecute return early #49: 0x00000001059215f4 LLDB`lldb_private::CommandInterpreter::HandleCommand(this=0x0000000111a2d210, command_line="breakpoint set --file 'ViewController.swift' --line 14", lazy_add_to_history=eLazyBoolCalculate, result=0x00007ffeefbfe770, override_context=0x0000000000000000, repeat_on_empty_command=true, no_context_switching=true) at CommandInterpreter.cpp:1772:14
frame [test] RenameModules
toObjectFile
(NFC) #50: 0x00000001059860a2 LLDB`lldb_private::CommandObjectRegexCommand::DoExecute(this=0x0000000111942d00, command=(Data = "ViewController.swift:14", Length = 23), result=0x00007ffeefbfe770) at CommandObjectRegexCommand.cpp:62:28
frame [ClangExpressionDeclMap] Remove divergence from upstream lldb. #51: 0x000000010596f1a4 LLDB`lldb_private::CommandObjectRaw::Execute(this=0x0000000111942d00, args_string="ViewController.swift:14", result=0x00007ffeefbfe770) at CommandObject.cpp:996:17
frame Mark all Swift-specific changes in API with comments. NFC #52: 0x00000001059215f4 LLDB`lldb_private::CommandInterpreter::HandleCommand(this=0x0000000111a2d210, command_line="b ViewController.swift:14", lazy_add_to_history=eLazyBoolCalculate, result=0x00007ffeefbfe770, override_context=0x0000000000000000, repeat_on_empty_command=true, no_context_switching=false) at CommandInterpreter.cpp:1772:14
frame Cherrypick/latest reproducers #53: 0x00000001059296be LLDB`lldb_private::CommandInterpreter::IOHandlerInputComplete(this=0x0000000111a2d210, io_handler=0x000000011184f848, line="b ViewController.swift:14") at CommandInterpreter.cpp:2808:3
frame Mark all Swift-specific changes in Breakpoint with comments. NFC #54: 0x00000001059d46bb LLDB`lldb_private::IOHandlerEditline::Run(this=0x000000011184f848) at IOHandler.cpp:568:22
frame [SystemInitializerCommon] Remove divergence from upstream. #55: 0x000000010540bf84 LLDB`lldb_private::Debugger::ExecuteIOHandlers(this=0x0000000111a2c9b0) at Debugger.cpp:1067:16
frame [MIPS/MIPS64] Remove another set of differences from upstream. #56: 0x000000010592ad54 LLDB`lldb_private::CommandInterpreter::RunCommandInterpreter(this=0x0000000111a2d210, auto_handle_events=true, spawn_thread=false, options=0x00007ffeefbfeb40) at CommandInterpreter.cpp:3013:16
frame Cherry-pick LiveDebugValues bugfix #57: 0x0000000100b8fb0a LLDB`lldb::SBDebugger::RunCommandInterpreter(this=0x00007ffeefbff190, auto_handle_events=true, spawn_thread=false) at SBDebugger.cpp:1093:42
frame [Diagnostics] Update SwiftASTContext to use the new DiagnosticConsumer interface #58: 0x000000010000628f lldb`Driver::MainLoop(this=0x00007ffeefbff170) at Driver.cpp:769:18
frame Cleanup: Skip macOS-only test on non-macOS systems and give it a uniq… #59: 0x00000001000073b0 lldb`main(argc=1, argv=0x00007ffeefbff618) at Driver.cpp:973:26
frame Cleanup: Skip macOS-only test on non-macOS systems and give it a uniq… #60: 0x00007fff678cced9 libdyld.dylib`start + 1
frame Rename a flang test case #61: 0x00007fff678cced9 libdyld.dylib`start + 1