Skip to content

Instantly share code, notes, and snippets.

@norio-nomura
Last active April 16, 2018 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norio-nomura/6654bea680baa61bb326d0ef4869615a to your computer and use it in GitHub Desktop.
Save norio-nomura/6654bea680baa61bb326d0ef4869615a to your computer and use it in GitHub Desktop.
Symbolicate crash from core on Linux
$ docker run --privileged -it -v `pwd`:`pwd` -w `pwd` --rm norionomura/swift:41
root@e8fbffcc2ed0:~# ulimit -c unlimited
root@e8fbffcc2ed0:~# echo 'let i: Int? = nil; i!'>main.swift
root@e8fbffcc2ed0:~# swift main.swift
main.swift:1:21: warning: expression of type 'Int' is unused
let i: Int? = nil; i!
~^
Fatal error: Unexpectedly found nil while unwrapping an Optional value
Current stack trace:
0 libswiftCore.so 0x00007fcc7bd96750 _swift_stdlib_reportFatalError + 171
1 libswiftCore.so 0x00007fcc7bb04ad6 <unavailable> + 1366742
2 libswiftCore.so 0x00007fcc7bd3f383 <unavailable> + 3703683
3 libswiftCore.so 0x00007fcc7bb04ad6 <unavailable> + 1366742
4 libswiftCore.so 0x00007fcc7bc70d80 <unavailable> + 2858368
5 libswiftCore.so 0x00007fcc7bb046b0 _fatalErrorMessage(_:_:file:line:flags:) + 19
7 swift 0x0000000000fed1ce <unavailable> + 12505550
8 swift 0x0000000000ff1692 <unavailable> + 12523154
9 swift 0x00000000004d9076 <unavailable> + 888950
10 swift 0x00000000004c35d3 <unavailable> + 800211
11 swift 0x00000000004beecc <unavailable> + 782028
12 swift 0x00000000004778c4 <unavailable> + 489668
13 libc.so.6 0x00007fcc7e2af740 __libc_start_main + 240
14 swift 0x0000000000475179 <unavailable> + 479609
/usr/bin/swift[0x3f24d54]
/usr/bin/swift[0x3f25096]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fcc7fb85390]
/usr/lib/swift/linux/libswiftCore.so(+0x2b9d80)[0x7fcc7bc70d80]
/usr/lib/swift/linux/libswiftCore.so(_T0s18_fatalErrorMessages5NeverOs12StaticStringV_A2E4fileSu4lines6UInt32V5flagstF+0x13)[0x7fcc7bb046c3]
[0x7fcc7ffb408c]
/usr/bin/swift[0xfed1ce]
/usr/bin/swift[0xff1692]
/usr/bin/swift[0x4d9076]
/usr/bin/swift[0x4c35d3]
/usr/bin/swift[0x4beecc]
/usr/bin/swift[0x4778c4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fcc7e2af830]
/usr/bin/swift[0x475179]
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -interpret main.swift -disable-objc-interop -color-diagnostics -module-name main
Illegal instruction (core dumped)
root@e8fbffcc2ed0:~# lldb swift -c core -o "bt 10" -b
(lldb) target create "swift" --core "core"
Core file '/root/core' (x86_64) was loaded.
(lldb) bt 10
* thread #1, name = 'swift', stop reason = signal SIGILL
* frame #0: 0x00007fcc7bc70d80 libswiftCore.so`function signature specialization <Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage(Swift.StaticString, Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 96
frame #1: 0x00007fcc7bb046c3 libswiftCore.so`Swift._fatalErrorMessage(Swift.StaticString, Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 19
frame #2: 0x00007fcc7ffb408c JIT(0x773dcf0)`main at main.swift:1
frame #3: 0x0000000000fed1ce swift`llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 574
frame #4: 0x0000000000ff1692 swift`llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, char const* const*) + 1298
frame #5: 0x00000000004d9076 swift`swift::RunImmediately(swift::CompilerInstance&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 2502
frame #6: 0x00000000004c35d3 swift`performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 14003
frame #7: 0x00000000004beecc swift`swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3292
frame #8: 0x00000000004778c4 swift`main + 2436
frame #9: 0x00007fcc7e2af830 libc.so.6`__libc_start_main + 240
root@e8fbffcc2ed0:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment