Xcode 完整堆栈跟踪
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15946499/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode full stack trace
提问by NaXir
While debugging is there anyway to see a complete stack trace, list of methods called in main thread. Or any way to print them on command window.
虽然调试是为了查看完整的堆栈跟踪,主线程中调用的方法列表。或者以任何方式在命令窗口上打印它们。
回答by Alex Iceman
Use the bt
command in (lldb).
使用bt
(lldb) 中的命令。
Once paused or after a crash, just type bt
into the debug console.
It will print the full stack trace.
一旦暂停或崩溃后,只需bt
在调试控制台中输入即可。
它将打印完整的堆栈跟踪。
回答by Mihir Mehta
You can print the stack trace in the NSLog by
您可以通过以下方式在 NSLog 中打印堆栈跟踪
NSLog(@"Stack trace : %@",[NSThread callStackSymbols]);
Upon a crash, next to the word (lldb)
, you can type:
崩溃时,在单词旁边(lldb)
,您可以键入:
po [NSThread callStackSymbols]
Edit:
编辑:
For better output on console on Swift you can use following line instead:
为了在 Swift 的控制台上获得更好的输出,您可以使用以下行:
Thread.callStackSymbols.forEach{print(##代码##)}
回答by Gong Pengjun
In Xcode 6 you can click the button at the bottom left corner of the pane which shows the full stack trace.
在 Xcode 6 中,您可以单击显示完整堆栈跟踪的窗格左下角的按钮。
回答by Sergey A. Novitsky
In Xcode 5 you can move the slider at the bottom of the pane which shows the stack trace. It controls how much of the struck trace is shown.
在 Xcode 5 中,您可以移动显示堆栈跟踪的窗格底部的滑块。它控制显示的撞击轨迹的数量。
回答by Buntylm
You can add breakpoint
before exception is thrown. First go to Breakpoint Navigator
(cmd + 6). In the bottom left corner mouse click plus button. OR
You can use Instruments
(/Developer/Applications/Instruments) to help detect usage of zombie
objects
.
Reference
您可以breakpoint
在抛出异常之前添加。首先转到Breakpoint Navigator
(cmd + 6)。在左下角鼠标单击加号按钮。或者您可以使用Instruments
(/Developer/Applications/Instruments) 来帮助检测zombie
objects
.
参考
And When you add breakpoint review the picture will create by Xcode
.
并且当您添加断点检查时,图片将通过Xcode
.
You can expand the stack trace using the slider at bottom use step over
and over
for line by line logs.
您可以使用底部使用的滑块step over
和over
逐行日志扩展堆栈跟踪。
thanks hope this will help you
谢谢希望这会帮助你