<div dir="ltr">In practice, I would need the stack trace first to figure out how to reproduce the issue, so lldb doesn't really help.<div><br></div><div>How would I go about symbolicating this further on macOS (Xcode or otherwise)?</div><div><br></div><div>From reading the docs it seems like the crash report I get is already completely symbolicated:</div><div><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">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></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 1:21 AM, Alex Blewitt <span dir="ltr"><<a href="mailto:alblue@apple.com" target="_blank">alblue@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">If you can reproduce it, and run it under lldb, it will print the source line for you:<div><br></div><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)"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">$ lldb .build/debug/main</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(lldb) target create ".build/debug/main"</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">ruCurrent executable set to '.build/debug/main' (x86_64).</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">(lldb) </span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">run</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Process 19013 launched: '/private/tmp/main/.build/<wbr>debug/main' (x86_64)</span></div><span class=""><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Hello, world!</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">fatal error: unexpectedly found nil while unwrapping an Optional value</span></div></span><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">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)"><span style="font-variant-ligatures:no-common-ligatures">Current stack trace:</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">0 libswiftCore.dylib 0x00000001002c1160 swift_reportError + 125</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">1 libswiftCore.dylib 0x00000001002ddac0 _swift_stdlib_reportFatalError + 60</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">2 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">3 libswiftCore.dylib 0x0000000100249120 partial apply for (_fatalErrorMessage(<wbr>StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">4 libswiftCore.dylib 0x00000001000ce260 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">5 libswiftCore.dylib 0x00000001001fbd00 specialized _fatalErrorMessage(<wbr>StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">6 main 0x0000000100001340 say(message : String?) -> () + 248</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">7 main 0x00000001000011e0 main + 328</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">8 libdyld.dylib 0x00007fffb444d234 start + 1</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Process 19013 stopped</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">* 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)"><span style="font-variant-ligatures:no-common-ligatures"> 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;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">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;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">-> 0x1001fbd60 <+96>: ud2 </span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> 0x1001fbd62 <+98>: nopw %cs:(%rax,%rax)</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">libswiftCore.dylib`protocol witness table accessor for <A> Swift.AnySequence<A> : Swift.Sequence in Swift:</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> 0x1001fbd70 <+0>: pushq %rbp</span></div><div style="margin:0px;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> 0x1001fbd71 <+1>: movq %rsp, %rbp</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></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)"><span style="font-variant-ligatures:no-common-ligatures">(lldb) </span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">bt</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">* 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)"><span style="font-variant-ligatures:no-common-ligatures"> * 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)"><span style="font-variant-ligatures:no-common-ligatures"><b> 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)"><span style="font-variant-ligatures:no-common-ligatures"><b> 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)"><span style="font-variant-ligatures:no-common-ligatures"> 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)"><span style="font-variant-ligatures:no-common-ligatures"> frame #4: 0x00007fffb444d235 libdyld.dylib`start + 1</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">There is a symbolication tool available for Linux in the ~/swift/utils/symbolicate-<wbr>linux-fatal, and Xcode can do the same symbolication for you as well.</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div>Alex</div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><blockquote type="cite"><div><div class="h5"><div>On 28 Apr 2017, at 22:28, Nick Snyder via swift-users <<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>> wrote:</div><br class="m_-218677909403448038Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr">I have a simple main.swift that looks like this:<div><br></div><div>```</div><div><div>print("Hello, world!")</div><div>let x: String? = nil</div><div><br></div><div>func say(message: String?) {</div><div> print(x!) // intentional crash</div><div>}</div><div><br></div><div>say(message: x)</div></div><div>```</div><div><br></div><div>Running this results in the crash</div><div><br></div><div>```</div><div><div>$ swift build && ./.build/debug/hello</div><div>Hello, world!</div><div>fatal error: unexpectedly found nil while unwrapping an Optional value</div><div>Current stack trace:</div><div>0 libswiftCore.dylib 0x0000000110120130 swift_reportError + 129</div><div>1 libswiftCore.dylib 0x000000011013cb50 _swift_stdlib_reportFatalError + 60</div><div>2 libswiftCore.dylib 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</div><div>3 libswiftCore.dylib 0x00000001100a7e90 partial apply for (_fatalErrorMessage(<wbr>StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109</div><div>4 libswiftCore.dylib 0x000000010ff2d250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342</div><div>5 libswiftCore.dylib 0x000000011005a9a0 specialized _fatalErrorMessage(<wbr>StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96</div><div>6 hello 0x000000010fee6200 main + 345</div><div>7 libdyld.dylib 0x00007fffe0375234 start + 1</div><div>Illegal instruction: 4</div></div><div>```</div><div><br></div><div>From the crash, how do I map back line 6 to an actual line in main.swift?</div></div></div></div><span class="">
______________________________<wbr>_________________<br>swift-users mailing list<br><a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br></span><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>