The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
Environment
Xcode 10.2.1
lldb version 7.0.0
Swift version 5.0-dev (LLVM 06f1615069, Swift d5426bc58a)
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 \~recursivemutex, 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 d5426bc58a8feea9f56436976807cec1ddd0b67e and swift from the 'master' branch. This crash does not occur when using swift-lldb and swift from the 'swift-5.0-branch' branch.
Environment
Xcode 10.2.1 lldb version 7.0.0 Swift version 5.0-dev (LLVM 06f1615069, Swift d5426bc58a)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | LLDB for Swift | |Labels | Bug, LLDBCrash | |Assignee | None | |Priority | Medium | md5: 0195b20bfcafd1f5f212126750e70ab6Issue 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 \~recursivemutex, 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 d5426bc58a8feea9f56436976807cec1ddd0b67e 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 #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff67a0c23e libsystemkernel.dylib`\_pthread_kill + 10
frame #1: 0x00007fff67ac2c1c libsystem_pthread.dylib`pthread_kill + 285
frame #2: 0x00007fff679751c9 libsystem_c.dylib`abort + 127
frame #3: 0x00007fff6793d868 libsystemc.dylib`\_assertrtn + 320
frame #4: 0x00007fff64fd6580 libc++.1.dylib`std::\_1::recursive_mutex::\~recursive_mutex() + 46
frame #5: 0x00007fff67975ef2 libsystemc.dylib`\_cxa_finalize_ranges + 351
frame #6: 0x00007fff679761de libsystem_c.dylib`exit + 55
frame #7: 0x00000001017288de LLDB`llvm::report_fatal_error(Reason=\<unavailable>, GenCrashDiag=\<unavailable>) at ErrorHandling.cpp:126:3 [opt]
frame #8: 0x000000010413ec71 LLDB`swift::irgen::TypeConverter::TypeConverter(this=0x00007ffeefbf94f8, IGM=0x0000000000000070) at GenType.cpp:1213:5 [opt]
frame #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 #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 #11: 0x00000001064f09e6 LLDB`lldb_private::SwiftASTContext::GetIRGenModule(this=0x00007ffeefbf9ff8)::$_10::operator()() const at SwiftASTContext.cpp:4598:38
frame #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 #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 #14: 0x00000001064f02a5 LLDB`std::1::call_once_param\<std::_1::tuple\<lldb_private::SwiftASTContext::GetIRGenModule()::$_10&&> >::operator(this=0x00007ffeefbf9f90)() at mutex:613:9
frame #15: 0x00000001064f017d LLDB`void std::1::call_once_proxy\<std::1::tuple\<lldb_private::SwiftASTContext::GetIRGenModule()::$10&&> >(_vp=0x00007ffeefbf9f90) at mutex:649:5
frame #16: 0x00007fff64f9b896 libc++.1.dylib`std::1::_call_once(unsigned long volatile&, void*, void ⭐(void*)) + 139
frame #17: 0x00000001064f00dc LLDB`void std::1::call_once\<lldbprivate::SwiftASTContext::GetIRGenModule()::$10>(_flag=0x0000000111a93750, \_func=0x00007ffeefbf9ff8)::$_10&&) at mutex:666:9
frame #18: 0x0000000106476810 LLDB`void llvm::call_once\<lldb_private::SwiftASTContext::GetIRGenModule()::$_10>(flag=0x0000000111a93750, F=0x00007ffeefbf9ff8)::$_10&&) at Threading.h:105:5
frame #19: 0x00000001064562a4 LLDB`lldb_private::SwiftASTContext::GetIRGenModule(this=0x0000000111a93700) at SwiftASTContext.cpp:4561:3
frame #20: 0x000000010647b764 LLDB`lldb_private::SwiftASTContext::GetSwiftTypeInfo(this=0x0000000111a93700, type=0x00000001120c1398) at SwiftASTContext.cpp:6007:26
frame #21: 0x000000010647e39d LLDB`lldb_private::SwiftASTContext::GetSwiftFixedTypeInfo(this=0x0000000111a93700, type=0x00000001120c1398) at SwiftASTContext.cpp:6020:45
frame #22: 0x000000010647e808 LLDB`lldb_private::SwiftASTContext::GetBitSize(this=0x0000000111a93700, type=0x00000001120c1398, exe_scope=0x0000000000000000) at SwiftASTContext.cpp:6065:7
frame #23: 0x0000000106732f0e LLDB`lldb_private::CompilerType::GetBitSize(this=0x00007ffeefbfa378, exe_scope=0x0000000000000000) const at CompilerType.cpp:558:27
frame #24: 0x0000000106732fab LLDB`lldb_private::CompilerType::GetByteSize(this=0x00007ffeefbfa378, exe_scope=0x0000000000000000) const at CompilerType.cpp:564:43
frame #25: 0x0000000106477781 LLDB`lldb_private::SwiftASTContext::GetPointerByteSize(this=0x0000000111a93700) at SwiftASTContext.cpp:4702:14
frame #26: 0x000000010647e7d5 LLDB`lldb_private::SwiftASTContext::GetBitSize(this=0x0000000111a93700, type=0x00000001120db110, exe_scope=0x0000000000000000) at SwiftASTContext.cpp:6062:12
frame #27: 0x0000000106732f0e LLDB`lldb_private::CompilerType::GetBitSize(this=0x00007ffeefbfada0, exe_scope=0x0000000000000000) const at CompilerType.cpp:558:27
frame #28: 0x0000000106732fab LLDB`lldb_private::CompilerType::GetByteSize(this=0x00007ffeefbfada0, exe_scope=0x0000000000000000) const at CompilerType.cpp:564:43
frame #29: 0x00000001057ca966 LLDB`DWARFASTParserSwift::ParseTypeFromDWARF(this=0x0000000111a8ce50, sc=0x00007ffeefbfb278, die=0x00007ffeefbfb480, log=0x0000000000000000, type_is_new_ptr=0x0000000000000000) at DWARFASTParserSwift.cpp:213:39
frame #30: 0x0000000105d3c138 LLDB`SymbolFileDWARF::ParseType(this=0x0000000114876a00, sc=0x00007ffeefbfb278, die=0x00007ffeefbfb480, type_is_new_ptr=0x0000000000000000) at SymbolFileDWARF.cpp:3157:30
frame #31: 0x0000000105d33eff LLDB`SymbolFileDWARF::GetTypeForDIE(this=0x0000000114876a00, die=0x00007ffeefbfb480, resolve_function_context=false) at SymbolFileDWARF.cpp:2628:17
frame #32: 0x0000000105d329fc LLDB`SymbolFileDWARF::ResolveType(this=0x0000000114876a00, die=0x00007ffeefbfb480, assert_not_being_parsed=true, resolve_function_context=false) at SymbolFileDWARF.cpp:1493:18
frame #33: 0x0000000105db6d6b LLDB`DWARFDIE::ResolveType(this=0x00007ffeefbfb480) const at DWARFDIE.cpp:135:24
frame #34: 0x0000000105d327dc LLDB`SymbolFileDWARF::ResolveTypeUID(this=0x0000000114876a00, type_uid=4294967365) at SymbolFileDWARF.cpp:1361:21
frame #35: 0x0000000105d7d240 LLDB`SymbolFileDWARFDebugMap::ResolveTypeUID(this=0x0000000111b28810, type_uid=4294967365) at SymbolFileDWARFDebugMap.cpp:709:23
frame #36: 0x0000000105f2da34 LLDB`lldb_private::Function::GetType(this=0x0000000111987000) at Function.cpp:475:24
frame #37: 0x0000000105f2d708 LLDB`lldb_private::Function::GetStartLineSourceInfo(this=0x0000000111987000, source_file=0x00007ffeefbfb8c8, line_no=0x00007ffeefbfb8c4) at Function.cpp:214:3
frame #38: 0x000000010511ed20 LLDB`lldb_private::BreakpointResolverFileLine::FilterContexts(this=0x000000011185a150, sc_list=0x00007ffeefbfbca8, is_relative=true) at BreakpointResolverFileLine.cpp:166:20
frame #39: 0x000000010511f70f LLDB`lldb_private::BreakpointResolverFileLine::SearchCallback(this=0x000000011185a150, filter=0x0000000111b6d918, context=0x00007ffeefbfbd98, addr=0x0000000000000000, containing=false) at BreakpointResolverFileLine.cpp:246:3
frame #40: 0x000000010557e457 LLDB`lldb_private::SearchFilter::DoModuleIteration(this=0x0000000111b6d918, context=0x00007ffeefbfbfc0, searcher=0x000000011185a150) at SearchFilter.cpp:287:24
frame #41: 0x000000010557e087 LLDB`lldb_private::SearchFilter::Search(this=0x0000000111b6d918, searcher=0x000000011185a150) at SearchFilter.cpp:226:5
frame #42: 0x00000001050fa3ce LLDB`lldb_private::BreakpointResolver::ResolveBreakpoint(this=0x000000011185a150, filter=0x0000000111b6d918) at BreakpointResolver.cpp:178:10
frame #43: 0x00000001050776be LLDB`lldb_private::Breakpoint::ResolveBreakpoint(this=0x000000011185a1a0) at Breakpoint.cpp:460:20
frame #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 #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 #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 #47: 0x000000010518deb4 LLDB`CommandObjectBreakpointSet::DoExecute(this=0x0000000111a2f6d0, command=0x00007ffeefbfd508, result=0x00007ffeefbfe770) at CommandObjectBreakpoint.cpp:731:23
frame #48: 0x000000010596ec5b LLDB`lldb_private::CommandObjectParsed::Execute(this=0x0000000111a2f6d0, args_string="--file 'ViewController.swift' --line 14", result=0x00007ffeefbfe770) at CommandObject.cpp:974:19
frame #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 #50: 0x00000001059860a2 LLDB`lldb_private::CommandObjectRegexCommand::DoExecute(this=0x0000000111942d00, command=(Data = "ViewController.swift:14", Length = 23), result=0x00007ffeefbfe770) at CommandObjectRegexCommand.cpp:62:28
frame #51: 0x000000010596f1a4 LLDB`lldb_private::CommandObjectRaw::Execute(this=0x0000000111942d00, args_string="ViewController.swift:14", result=0x00007ffeefbfe770) at CommandObject.cpp:996:17
frame #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 #53: 0x00000001059296be LLDB`lldb_private::CommandInterpreter::IOHandlerInputComplete(this=0x0000000111a2d210, io_handler=0x000000011184f848, line="b ViewController.swift:14") at CommandInterpreter.cpp:2808:3
frame #54: 0x00000001059d46bb LLDB`lldb_private::IOHandlerEditline::Run(this=0x000000011184f848) at IOHandler.cpp:568:22
frame #55: 0x000000010540bf84 LLDB`lldb_private::Debugger::ExecuteIOHandlers(this=0x0000000111a2c9b0) at Debugger.cpp:1067:16
frame #56: 0x000000010592ad54 LLDB`lldb_private::CommandInterpreter::RunCommandInterpreter(this=0x0000000111a2d210, auto_handle_events=true, spawn_thread=false, options=0x00007ffeefbfeb40) at CommandInterpreter.cpp:3013:16
frame #57: 0x0000000100b8fb0a LLDB`lldb::SBDebugger::RunCommandInterpreter(this=0x00007ffeefbff190, auto_handle_events=true, spawn_thread=false) at SBDebugger.cpp:1093:42
frame #58: 0x000000010000628f lldb`Driver::MainLoop(this=0x00007ffeefbff170) at Driver.cpp:769:18
frame #59: 0x00000001000073b0 lldb`main(argc=1, argv=0x00007ffeefbff618) at Driver.cpp:973:26
frame #60: 0x00007fff678cced9 libdyld.dylib`start + 1
frame #61: 0x00007fff678cced9 libdyld.dylib`start + 1