XCode 6 — new debugging features

As one of the goodies launched during current WWDC 2013, Apple has released a developer preview of Xcode 5 and detailed some of the new features it offers such as Automatic Configuration, Test Navigator, Bots, Auto Layout, Asset Management, Debug Gauges, Source Control, and more.

Looking over some of the videos of the WWDC Sessions Videos, this seem to be the first XCode version that is completely built around ARC, as core memory management technology, and proudly announced as the “best ever”, stable, fast and sleek.

I had a chance to play with it and these are the first impressions.

Interface

We have a lot of things to cover today, but first let’s go over the changes in interface.

The first impression I had is that the available space for code is much bigger. This is mostly an illusion due to the diminished height of the top instrument bar and usage of lighter colors for project navigator toolbar and the navigator toolbar:

XCode 4.6 main window

XCode 4.6 — a breakthorugh at its time, now seem a bit old fashioned but, nevertheless, still a powerful, extremely stable excellent tool. Time will tell with the fifth version will raise to the bar set by its predecessor.

XCode 5.0 preview, main window

XCode 5.0, preview version — a sleeker top toolbar aligned with the last minimalist approach in UI design showcased by Apple with their iOS 7 and Maverick products. Notice the lighter colors of project navigator toolbar and the additional button for Test Navigator.

On debugging side, first thing you’ll notice is that breakpoint activation button has been moved from tool bar down to the debugger toolbar. Apple rationale is that this is much natural, because the breakpoint activation button is right to the other buttons that you use for debugging (run, pause, step into, step over etc). FYI, the breakpoint activation shortcut is the same (Cmd + Y).

Enabling/ disabling individual breakpoints was kept in the breakpoints navigator. Breakpoint icons have a bigger size (better).

Creating special breakpoints (until now, symbolic and exception) has been supplemented with additional creation of breakpoints for OpenGL ES errors and unit test error breakpoint. These two behave like exception breakpoints, but are triggered by related issues.

What I find interesting here is this additional OpenGL ES error breakpoint that clearly indicate Apple’s orientation towards additional support for game development.

Debug Navigator

First thing that you will notice here is the brand new Debug Gauges panel. You might choose here to display your stack based on threads (and jump to individual files that you want to explore for debugging) or on GCD mode, when you want your threads to be organized by queues.

Debug Gauges panel tightly integrates Instruments optimization support directly into XCode. There are multiple debug gauges that can show you the performance and characteristics. Two of them are universal, the CPU and the memory. Since those are universal we’ll gonna take at look at them more closely today.

XCode Debugging Reports (Improved Data Inspection)

If you click on the CPU Gauge, it brings you a CPU report. Some

CPU Gauge, XCode 5.0 preview edition

CPU Gauge, XCode 5.0 preview edition — CPU usage gauge shows the total CPU and is dependent on the number of cores. A 100% CPU for a dual-core iOS device, indicate a 50% utilization. The small inner blue arc is the indicator for the last minutes of CPU utilization.

Second indicator is the CPU for the whole system. Utilization over time. Discussion with separate threads. The best place to do this is in Instruments (profile Instruments).

Memory Gauge, XCode 5.0 preview edition

Memory Gauge, XCode 5.0 preview edition —

Data Tips and Quick Look

Well this is new. And cool. Up to XCode 4.6, stack variable (data) introspection could be done only in the variables’ view of the debugging panel. In XCode 5.0 you can do this (and more) directly in the code.

If you’ve been programming for a while, you know that you hit run, you do some debugging, then program again etc. You have your code editor, and when you hit a breakpoint, the debug area comes up, showing useful information.

A lot of times, we get all context we need from code and it would be great to see the whole method that you are on it. Hide the debug area, use it when you need it, have more space for coding and move your debugging experience inside the code. This looks like this: hover an object and get a popover with data tips. Notice (in image below) the two icons, the eye and the info button:

Data Tips and Quick Look: hovering

Data Tips and Quick Look: hovering over an object pushes a popover with data tips.

All extraneous information is stripped, you have a quick glance to object info in these tips. Clicking the info button, provide the results as if you’d typed in lldb console “po calculator“:

Quick Look - object description

Quick Look — object description; this is equivalent with typing po calculator in the debugger console.

Data Tips and Quick Look — debug console display

Another example of using the info button inside data tips popover; notice the description of the object — in this case the UIResponder parent of _displayField label — and the corresponding text that appears in the debugger console.

Data Tips and Quick Look — debug console display

Same as above, for a CALayer instance.

Another neat implementation of this feature, is a visual representation of sizes. Look below:

Quick Look and Info Button for CGSize

Information displayed for a CGSize struct as width and height.

Quick Look and Info Button for CGSize

Quick look of a CGSize struct. How nice, a graphical representation !

That’s it for today. I got tired of writing so much. More to come (I hope). 🙂

 

 
 
Filed in Apple Programming, XCode. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *