<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" 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; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ lldb .build/debug/main</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" 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; color: rgb(0, 0, 0);" 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; color: #000000" class="">run</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Process 19013 launched: '/private/tmp/main/.build/debug/main' (x86_64)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Hello, world!</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" 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; line-height: normal; color: rgb(0, 0, 0);" 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; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Current stack trace:</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001002c1160 swift_reportError + 125</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">1&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001002ddac0 _swift_stdlib_reportFatalError + 60</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer&lt;A&gt; ((UnsafeBufferPointer&lt;UInt8&gt;) -&gt; A) -&gt; A + 342</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">3&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0000000100249120 partial apply for (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -&gt; Never).(closure #2) + 109</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">4&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer&lt;A&gt; ((UnsafeBufferPointer&lt;UInt8&gt;) -&gt; A) -&gt; A + 342</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">5&nbsp; &nbsp; libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001001fbd00 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -&gt; Never + 96</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">6&nbsp; &nbsp; main&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0000000100001340 say(message : String?) -&gt; () + 248</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">7&nbsp; &nbsp; main&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001000011e0 main + 328</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">8&nbsp; &nbsp; libdyld.dylib&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00007fffb444d234 start + 1</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Process 19013 stopped</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" 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; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization &lt;preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead&gt; of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -&gt; Swift.Never + 96</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">libswiftCore.dylib`function signature specialization &lt;preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead&gt; of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -&gt; Swift.Never:</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-&gt;&nbsp; 0x1001fbd60 &lt;+96&gt;: ud2 &nbsp; &nbsp;</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; 0x1001fbd62 &lt;+98&gt;: nopw &nbsp; %cs:(%rax,%rax)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">libswiftCore.dylib`protocol witness table accessor for &lt;A&gt; Swift.AnySequence&lt;A&gt; : Swift.Sequence in Swift:</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; 0x1001fbd70 &lt;+0&gt;:&nbsp; pushq&nbsp; %rbp</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; 0x1001fbd71 &lt;+1&gt;:&nbsp; movq &nbsp; %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; color: #000000" 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="">&nbsp; * frame #0: 0x00000001001fbd60 libswiftCore.dylib`function signature specialization &lt;preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead&gt; of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -&gt; 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="">&nbsp; &nbsp; frame #1: 0x0000000100001438 main`say(message=nil) -&gt; () 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="">&nbsp; &nbsp; 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="">&nbsp; &nbsp; 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="">&nbsp; &nbsp; 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-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><blockquote type="cite" class=""><div class="">On 28 Apr 2017, at 22:28, Nick Snyder via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><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="">&nbsp; &nbsp; 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 &amp;&amp; ./.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 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0000000110120130 swift_reportError + 129</div><div class="">1 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x000000011013cb50 _swift_stdlib_reportFatalError + 60</div><div class="">2 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer&lt;A&gt; ((UnsafeBufferPointer&lt;UInt8&gt;) -&gt; A) -&gt; A + 342</div><div class="">3 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001100a7e90 partial apply for (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -&gt; Never).(closure #2) + 109</div><div class="">4 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer&lt;A&gt; ((UnsafeBufferPointer&lt;UInt8&gt;) -&gt; A) -&gt; A + 342</div><div class="">5 &nbsp; &nbsp;libswiftCore.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x000000011005a9a0 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -&gt; Never + 96</div><div class="">6 &nbsp; &nbsp;hello &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010fee6200 main + 345</div><div class="">7 &nbsp; &nbsp;libdyld.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;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>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>