- Application Development in iOS 7
- Kyle Begeman
- 444字
- 2021-07-16 11:49:56
Debugger and debug gauges
Debugging with Xcode 5 has been greatly improved thanks to many new features added to the debugger. Apple has completely switched from the previous GDB engine to the much more powerful LLDB engine. This allows breakpoint flexibility, inline variable previews, and the finding of variable values more easily.
If you have ever debugged a project using breakpoints, you will notice some changes in the way Xcode 5 manages its breakpoints. Breakpoints are still created by clicking directly on the required line number. These breakpoints can then be enabled or disabled by clicking on them directly or using the breakpoints button that has been moved to the debug toolbar found at the bottom of the Xcode window.
Each breakpoint may also be configured to respond conditionally. By default, code will stop once it reaches a breakpoint. Once you set conditions, however, breakpoints will be ignored unless these conditions are met. You can edit these conditions by right-clicking on an individual breakpoint and selecting Edit Breakpoint. From here, set your conditions and resultant actions. These actions can include logging a message to the console, running an AppleScript or Shell Script, and even playing a sound.
Another great feature of Xcode 5's debugger is the ability to preview variables and objects during debugging using data tips. While debugging your application, hover your mouse over a variable and its value will automatically appear below your cursor. This works for standard data types, such as strings, numeric types, and Boolean types.
Data tips are very powerful when it comes to objects as well. For instance, while in debug mode, hover your mouse over an image, and a summary of information will appear about this object. Selecting the eye-shaped icon will allow you to preview the actual image right in code, as shown in the following screenshot:

Properly debugging any application also involves monitoring system resources to ensure your code is as optimized as possible. Xcode 5 introduces debug gauges, a lightweight and embedded version of some useful instruments' tools. Because debug gauges are integrated into Xcode 5, they are able to run alongside the application at all times while allowing you to observe CPU, Memory, iCloud, Energy, and OpenGL ES resources.
Debug gauges can be found through the debug navigator and will begin running automatically once you run a project. The previously mentioned resources are displayed in an easy-to-read visual graph so that you can monitor your application's performance at a glance and in real time. Additionally, access to the complete instruments software is just a single click away, which is achieved by clicking on the Profile in Instruments button shown in the following screenshot:

- Mastering ElasticSearch
- Linux系統(tǒng)文件安全實(shí)戰(zhàn)全攻略
- Linux從零開(kāi)始學(xué)(視頻教學(xué)版)
- BPEL and Java Cookbook
- 嵌入式Linux驅(qū)動(dòng)程序和系統(tǒng)開(kāi)發(fā)實(shí)例精講
- 異質(zhì)結(jié)原理與器件
- 計(jì)算機(jī)系統(tǒng)開(kāi)發(fā)與優(yōu)化實(shí)戰(zhàn)
- 數(shù)據(jù)中心系統(tǒng)工程及應(yīng)用
- Ceph分布式存儲(chǔ)實(shí)戰(zhàn)
- Application Development in iOS 7
- 深入淺出Node.js
- 操作系統(tǒng)分析
- iOS 10 開(kāi)發(fā)指南
- Learn OpenShift
- 鴻蒙入門:HarmonyOS應(yīng)用開(kāi)發(fā)