- 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系統管理
- 從零開始寫Linux內核:一書學透核心原理與實現
- 大學計算機應用基礎實踐教程(Windows 7+Office 2013)
- VMware Horizon View 6 Desktop Virtualization Cookbook
- SOA實踐者說
- Implementing Azure DevOps Solutions
- 混沌工程實戰:手把手教你實現系統穩定性
- Java EE 8 Design Patterns and Best Practices
- 嵌入式Linux應用開發菜鳥進階
- Linux運維最佳實踐
- 嵌入式實時操作系統μC/OS原理與實踐
- Application Development in iOS 7
- Windows Server 2012網絡操作系統項目教程(第4版)
- Linux服務器配置與管理