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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:47:04  来源:igfitidea点击:

Xcode full stack trace

xcodestack-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 btcommand in (lldb).

使用bt(lldb) 中的命令。

Once paused or after a crash, just type btinto the debug console.
It will print the full stack trace.

一旦暂停或崩溃后,只需bt在调试控制台中输入即可。
它将打印完整的堆栈跟踪。

sample output of bt command

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 show full stack trace

在 Xcode 6 中,您可以单击显示完整堆栈跟踪的窗格左下角的按钮。 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 中,您可以移动显示堆栈跟踪的窗格底部的滑块。它控制显示的撞击轨迹的数量。

Slider controlling the stack trace

控制堆栈跟踪的滑块

回答by Buntylm

You can add breakpointbefore 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 zombieobjects. Reference

您可以breakpoint在抛出异常之前添加。首先转到Breakpoint Navigator(cmd + 6)。在左下角鼠标单击加号按钮。或者您可以使用Instruments(/Developer/Applications/Instruments) 来帮助检测zombieobjects. 参考

And When you add breakpoint review the picture will create by Xcode.

并且当您添加断点检查时,图片将通过Xcode.

enter image description here

在此处输入图片说明

You can expand the stack trace using the slider at bottom use step overand overfor line by line logs.

您可以使用底部使用的滑块step overover逐行日志扩展堆栈跟踪。

thanks hope this will help you

谢谢希望这会帮助你