Xcode Debugging: Reset Current LineTweet
When inside a debugger and stepping through code, line be line, have you ever wanted to move to the top of a loop and restart, including resetting counters, without having to restart the application/debugger? Here’s a cool trick you can use within Xcode to do just that. In the figure below, notice that the current value of the variable name is America/Antigua.
Also notice in the figure above that the current point of execution (the red arrow) is inside the for loop. In the next figure, notice that America/Antigua is fourth down in the list of known time zones. Therefore, we know that this is our fourth time through the for loop.
Here’s the tip: we can click/drag the red arrow in the debugger and move it back up to line 117. By doing so, we can start the for loop again from the beginning.
See the figure below and notice that this time through the loop the variable name is Europe/Andora , the first entry in the list.
Rather than restart a debugging session to reset a variable or begin at the top of a loop, try this approach instead. This is one of many good tips you’ll find in the book Xcode 3 Unleashed .