<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">The stack trace printed by the process will never include file and line numbers. Swift and ObjC work the same way here.</div><div class=""><br class=""></div><div class="">You want to find the crash report generated by the OS. Either it will have file and line numbers already, or it will contain enough information to look up the file and line numbers after the fact (part of a process called "symbolication").</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 3, 2017, at 2:47 AM, Alex Blewitt <<a href="mailto:alblue@apple.com" class="">alblue@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Greg,<div class=""><br class=""></div><div class="">This occurs when compiled with swiftc -g as well. In fact, I think 'swift build', when run by default, will compile with swiftc -g. It's only when you run 'swift build --configuration release' that it will compile without it.<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ swiftc --version</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Apple Swift version 3.1 (swift-3.1.1-RELEASE)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Target: x86_64-apple-macosx10.9</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ swiftc -g main.swift</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ ./main</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Hello, world!</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">fatal error: unexpectedly found nil while unwrapping an Optional value</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Current stack trace:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0 libswiftCore.dylib 0x000000010edc7160 swift_reportError + 125</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">1 libswiftCore.dylib 0x000000010ede3ac0 _swift_stdlib_reportFatalError + 60</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2 libswiftCore.dylib 0x000000010ebd4260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">3 libswiftCore.dylib 0x000000010ed4f120 partial apply for (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">4 libswiftCore.dylib 0x000000010ebd4260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">5 libswiftCore.dylib 0x000000010ed01d00 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">6 main 0x000000010eb91340 say(message : String?) -> () + 248</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">7 main 0x000000010eb911e0 main + 328</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">8 libdyld.dylib 0x00007fffb444d234 start + 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Illegal instruction: 4</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">Note that lldb can symbolicate the result and identify the return value, by looking at the backtrace:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ lldb main</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="color: rgb(169, 169, 169);" class="">(lldb)</span> target create "main"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Current executable set to 'main' (x86_64).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(169, 169, 169); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(lldb) </span><span style="font-variant-ligatures: no-common-ligatures;" class="">run</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Process 33032 launched: '/tmp/main' (x86_64)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Hello, world!</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">fatal error: unexpectedly found nil while unwrapping an Optional value</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2017-05-03 10:41:17.340963+0100 main[33032:55100807] fatal error: unexpectedly found nil while unwrapping an Optional value</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Current stack trace:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0 libswiftCore.dylib 0x00000001002c1160 swift_reportError + 125</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">1 libswiftCore.dylib 0x00000001002ddac0 _swift_stdlib_reportFatalError + 60</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">3 libswiftCore.dylib 0x0000000100249120 partial apply for (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">4 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">5 libswiftCore.dylib 0x00000001001fbd00 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">6 main 0x0000000100001340 say(message : String?) -> () + 248</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">7 main 0x00000001000011e0 main + 328</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">8 libdyld.dylib 0x00007fffb444d234 start + 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Process 33032 stopped</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization <preserving fragile attribute, 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</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-> 0x1001fbd60 <+96>: ud2 </span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 0x1001fbd62 <+98>: nopw %cs:(%rax,%rax)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">libswiftCore.dylib`protocol witness table accessor for <A> Swift.AnySequence<A> : Swift.Sequence in Swift:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 0x1001fbd70 <+0>: pushq %rbp</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 0x1001fbd71 <+1>: movq %rsp, %rbp</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(169, 169, 169); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(lldb) </span><span style="font-variant-ligatures: no-common-ligatures;" class="">bt</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> * frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization <preserving fragile attribute, 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</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> frame #1: 0x0000000100001438 main`say(message=nil) -> () at main.swift:5</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> frame #2: 0x0000000100001328 main`main at main.swift:8</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> frame #3: 0x00007fffb444d235 libdyld.dylib`start + 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> frame #4: 0x00007fffb444d235 libdyld.dylib`start + 1</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">I suspect this is because Swift is generating a .dSYM which is read by LLDB but either not read or not loaded by the swift runtime when producing the backtrace:</span></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ find .</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM/Contents</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM/Contents/Info.plist</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM/Contents/Resources</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM/Contents/Resources/DWARF</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.dSYM/Contents/Resources/DWARF/main</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">./main.swift</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Here's the main file, for repeatability:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ cat main.swift </span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">print("Hello, world!")</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">let x: String? = nil</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">func say(message: String?) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> print(x!) // intentional crash</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">say(message: x)</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></span></div><div class="">Alex</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2 May 2017, at 22:43, Greg Parker <<a href="mailto:gparker@apple.com" class="">gparker@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">That doesn't look symbolicated. If it were symbolicated, and the build used -g, you would have a file and line number for the main+345 frame.</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 2, 2017, at 2:31 PM, Nick Snyder via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">In practice, I would need the stack trace first to figure out how to reproduce the issue, so lldb doesn't really help.<div class=""><br class=""></div><div class="">How would I go about symbolicating this further on macOS (Xcode or otherwise)?</div><div class=""><br class=""></div><div class="">From reading the docs it seems like the crash report I get is already completely symbolicated:</div><div class=""><a href="https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-_DETERMINING_WHETHER_A_CRASH_REPORT_IS_SYMBOLICATED" class="">https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-_DETERMINING_WHETHER_A_CRASH_REPORT_IS_SYMBOLICATED</a><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 2, 2017 at 1:21 AM, Alex Blewitt <span dir="ltr" class=""><<a href="mailto:alblue@apple.com" target="_blank" class="">alblue@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">If you can reproduce it, and run it under lldb, it will print the source line for you:<div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(169,169,169);background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">$ lldb .build/debug/main</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">(lldb) target create ".build/debug/main"</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">ruCurrent executable set to '.build/debug/main' (x86_64).</span></div><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">(lldb) </span><span style="font-variant-ligatures: no-common-ligatures;" class="">run</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Process 19013 launched: '/private/tmp/main/.build/<wbr class="">debug/main' (x86_64)</span></div><span class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Hello, world!</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">fatal error: unexpectedly found nil while unwrapping an Optional value</span></div></span><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">2017-05-02 09:17:11.351608+0100 asdf[19013:54205130] fatal error: unexpectedly found nil while unwrapping an Optional value</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Current stack trace:</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">0 libswiftCore.dylib 0x00000001002c1160 swift_reportError + 125</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">1 libswiftCore.dylib 0x00000001002ddac0 _swift_stdlib_reportFatalError + 60</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">2 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">3 libswiftCore.dylib 0x0000000100249120 partial apply for (_fatalErrorMessage(<wbr class="">StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">4 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">5 libswiftCore.dylib 0x00000001001fbd00 specialized _fatalErrorMessage(<wbr class="">StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">6 main 0x0000000100001340 say(message : String?) -> () + 248</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">7 main 0x00000001000011e0 main + 328</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">8 libdyld.dylib 0x00007fffb444d234 start + 1</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Process 19013 stopped</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization <preserving fragile attribute, 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</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never:</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-> 0x1001fbd60 <+96>: ud2 </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> 0x1001fbd62 <+98>: nopw %cs:(%rax,%rax)</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">libswiftCore.dylib`protocol witness table accessor for <A> Swift.AnySequence<A> : Swift.Sequence in Swift:</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> 0x1001fbd70 <+0>: pushq %rbp</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> 0x1001fbd71 <+1>: movq %rsp, %rbp</span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(169,169,169);background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">(lldb) </span><span style="font-variant-ligatures: no-common-ligatures;" class="">bt</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> * frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization <preserving fragile attribute, 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</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><b class=""> frame #1: 0x0000000100001438 main`say(message=nil) -> () at main.swift:5</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><b class=""> frame #2: 0x0000000100001328 main`main at main.swift:8</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> frame #3: 0x00007fffb444d235 libdyld.dylib`start + 1</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> frame #4: 0x00007fffb444d235 libdyld.dylib`start + 1</span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class="">There is a symbolication tool available for Linux in the ~/swift/utils/symbolicate-<wbr class="">linux-fatal, and Xcode can do the same symbolication for you as well.</span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div class="">Alex</div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div class=""><blockquote type="cite" class=""><div class=""><div class="h5"><div class="">On 28 Apr 2017, at 22:28, Nick Snyder via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>> wrote:</div><br class="m_-218677909403448038Apple-interchange-newline"></div></div><div class=""><div class=""><div class="h5"><div dir="ltr" class="">I have a simple main.swift that looks like this:<div class=""><br class=""></div><div class="">```</div><div class=""><div class="">print("Hello, world!")</div><div class="">let x: String? = nil</div><div class=""><br class=""></div><div class="">func say(message: String?) {</div><div class=""> print(x!) // intentional crash</div><div class="">}</div><div class=""><br class=""></div><div class="">say(message: x)</div></div><div class="">```</div><div class=""><br class=""></div><div class="">Running this results in the crash</div><div class=""><br class=""></div><div class="">```</div><div class=""><div class="">$ swift build && ./.build/debug/hello</div><div class="">Hello, world!</div><div class="">fatal error: unexpectedly found nil while unwrapping an Optional value</div><div class="">Current stack trace:</div><div class="">0 libswiftCore.dylib 0x0000000110120130 swift_reportError + 129</div><div class="">1 libswiftCore.dylib 0x000000011013cb50 _swift_stdlib_reportFatalError + 60</div><div class="">2 libswiftCore.dylib 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</div><div class="">3 libswiftCore.dylib 0x00000001100a7e90 partial apply for (_fatalErrorMessage(<wbr class="">StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</div><div class="">4 libswiftCore.dylib 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</div><div class="">5 libswiftCore.dylib 0x000000011005a9a0 specialized _fatalErrorMessage(<wbr class="">StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</div><div class="">6 hello 0x000000010fee6200 main + 345</div><div class="">7 libdyld.dylib 0x00007fffe0375234 start + 1</div><div class="">Illegal instruction: 4</div></div><div class="">```</div><div class=""><br class=""></div><div class="">From the crash, how do I map back line 6 to an actual line in main.swift?</div></div></div></div><span class="">
______________________________<wbr class="">_________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class=""></span><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></div></blockquote></div><br class=""></body></html>