<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 1:47 PM, Harlan Haskins via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</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="">Is there even a way to display the call stack symbols in pure Swift without <font face="Menlo" class="">NSThread.callStackSymbols()</font>?</div></div></blockquote><br class=""></div><div>backtrace(3) and backtrace_symbols(3) should work on OS X. I expect other platforms have equivalents. Calling them from Swift would probably be unpleasant, but the right place to implement this is in stdlib/public/runtime/Errors.cpp.</div><div><br class=""></div><div>Be warned that you may not like the results. </div><div><br class=""></div><div>First, you'll need to demangle Swift and C++ symbols if you want something human-readable. </div><div><br class=""></div><div>Second, on some platforms any backtrace collected in-process will be missing lots of symbol names. For example, on current iOS you would see "<redacted>" for most frames inside the system frameworks. The symbol names can be recovered, but you need to record additional data to make that work. In iOS crash logs the additional data required is the "Binary Images" section. Recording that data and recovering the symbol names is easy for a debugger or crash reporter, but would be hard for Swift to do.</div><div><br class=""></div><div><br class=""></div><div>-- </div><div>Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div><br class=""></div><div><br class=""></div></body></html>