在 Xcode 中调试时如何显示我的程序的所有线程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/929317/
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
How can I display all the threads for my program when debug in Xcode
提问by lucius
How can I display all the threads for my program when debug in Xcode? I am using eclipse for java debugging, it can show all the current threads in the program and I can suspend each one of them and show their current stack trace. Can I do that same in XCode?
在 Xcode 中调试时如何显示我的程序的所有线程?我正在使用 eclipse 进行 java 调试,它可以显示程序中的所有当前线程,我可以挂起每个线程并显示它们当前的堆栈跟踪。我可以在 XCode 中做同样的事情吗?
Thank you.
谢谢你。
回答by Paul Kahohi
Once you run your application the debug area automatically comes up. If it doesen't most likely it's because the visibility of the debug area has been turned off. To turn it on. Toggle the first view control on the top right side of the xcode window and the debug area should appear.
运行应用程序后,调试区域会自动出现。如果不是很可能,那是因为调试区域的可见性已关闭。打开它。切换 xcode 窗口右上角的第一个视图控件,应该会出现调试区域。
Once you have done that an area like the one in the image below will appear.
Click on the show debug navigator
button which is the third last in the controls on the debug navigator.
On the row immediately after next to the name of your project, there are two buttons, click on the second
单击show debug navigator
调试导航器控件中倒数第三个按钮。在您的项目名称旁边的行上,有两个按钮,单击第二个
and select view process by thread.
For the threads to appear your application has to be paused. This can be done by adding a breakpoint at a particular point of the code or manually by clicking the pause button on the debug bar below the source editor. Once paused the threads appear automatically as shown below.
要使线程出现,您的应用程序必须暂停。这可以通过在代码的特定点添加断点或通过单击源代码编辑器下方调试栏上的暂停按钮手动完成。暂停后,线程会自动出现,如下所示。
回答by Tom Jefferys
You can see the stack traces for each active thread on the debugger view. (Run->Debugger). In the top left panel you should be able to see the stack trace for the current thread. It should say something like "Thread-1" at the top, click on this and you can select any of the other threads, and view their individual stack traces.
您可以在调试器视图中查看每个活动线程的堆栈跟踪。(运行->调试器)。在左上角的面板中,您应该能够看到当前线程的堆栈跟踪。它应该在顶部显示类似“Thread-1”的内容,单击它,您可以选择任何其他线程,并查看它们各自的堆栈跟踪。