Xcode 中调试器和目标输出的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20986419/
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-15 04:31:24  来源:igfitidea点击:

Difference Between Debugger and Target Output in Xcode

iosxcodedebuggingoutput

提问by Mister Mister

When I run my app in Xcode, the output area often becomes cluttered by warnings, in my case especially from iAds. Since I'm only interested in my own debug statements, is there a way to specifically output what I want to see?

当我在 Xcode 中运行我的应用程序时,输出区域经常被警告弄得杂乱无章,在我的情况下尤其是来自 iAds。由于我只对我自己的调试语句感兴趣,有没有办法专门输出我想看到的内容?

I notice there's an option to show either "Debugger Output" or "Target Output." What is the difference between these and can they help with what I'm trying to do?

我注意到有一个选项可以显示“调试器输出”或“目标输出”。这些之间有什么区别,它们可以帮助我完成我想做的事情吗?

Screenshot of option

选项截图

Another solution would be to block warnings from iAds, autolayout, etc., if that is possible. Is there a way to suppress specific warnings?

如果可能,另一种解决方案是阻止来自 iAd、自动布局等的警告。有没有办法抑制特定警告?

采纳答案by Jim Ingham

What hv88 is saying is that "Debugger output" is the text that comes from the lldb commands you've typed into the console, and "Target Output" is everything that your program writes to stdout. The debugger has no way to tell the difference between "text YOUR code writes to stdout" and "text other libraries write to stdout." It is just one output stream. So that set of choices won't help you with what you want to do.

hv88 所说的是“调试器输出”是来自您在控制台中键入的 lldb 命令的文本,“目标输出”是您的程序写入标准输出的所有内容。调试器无法区分“您的代码写入标准输出的文本”和“其他库写入标准输出的文本”之间的区别。它只是一个输出流。所以这组选择不会帮助你完成你想做的事情。

Note that the console window does have a Find entry, though you won't see it till you type Cmd-F when focused on the console window. So if you mark your output entries with some string that is unique and not to hard to type, you can use the Console Find to navigate to them quickly.

请注意,控制台窗口确实有一个“查找”条目,但在聚焦控制台窗口时键入 Cmd-F 之前您不会看到它。因此,如果您使用一些唯一且不易键入的字符串标记输出条目,则可以使用 Console Find 快速导航到它们。

回答by Jayprakash Dubey

'Debugger output' contains values that we check while debugging i.e. while debugging we check the value of variable. This value can be printed on console by clicking 'i' button on pop-up shown.

“调试器输出”包含我们在调试时检查的值,即在调试时我们检查变量的值。通过单击显示的弹出窗口中的“i”按钮,可以在控制台上打印此值。

Screenshot for displaying information

显示信息的屏幕截图

'Target output' contains values printed from NSLog, cout, println etc.

“目标输出”包含从 NSLog、cout、println 等打印的值。

'All output' contains values from Debugger and Target.

“所有输出”包含来自调试器和目标的值。

Screenshot for console window

Screenshot for console window

回答by hv88

The console displays program output and lets you enter commands to the debugger. You specify the type of output the console displays with the pop-up menu at the top of the pane:

控制台显示程序输出并允许您向调试器输入命令。您可以使用窗格顶部的弹出菜单指定控制台显示的输出类型:

All Output: Include target and debugger output.

所有输出:包括目标和调试器输出。

Debugger Output: Include debugger output only.

调试器输出:仅包括调试器输出。

Target Output: Include target output only. (e.g NSLog, printf)

目标输出:仅包括目标输出。(例如 NSLog、printf)

https://developer.apple.com/library/mac/recipes/xcode_help-debugger/articles/about_debug_area.html

https://developer.apple.com/library/mac/recipes/xcode_help-debugger/articles/about_debug_area.html