Friday, December 5, 2014

Xcode Consolation

Daniel Jalkut:

Those are the basics, but another trick, I believe it was called ret in Gdb, comes in handy often:

  • thread return – return immediately from the current stack frame

You could use this if you are stuck in some function that is crashed, for example, but you know that returning to the caller would allow the process to continue running as normal. Or, you could use it to completely circumvent a path of code by breaking on a function and bolting right out, optionally overriding the return value.


In fact, mucking about with system symbols is one of the great tricks of the console, and lldb’s built-in “breakpoint” command brings with it superpowers that can’t be touched by Xcode’s dumbed down GUI-based controls. For example, what if we wanted to set a breakpoint that would catch not only +controlTextColor, but any similar variation? Using lldb’s support for regular expression breakpoints, it’s a snap[…]

I fall into Group 4: appreciate the console for occasional tricks but mostly avoid the debugger entirely, in favor of logging and assertions added directly to my code. I am usually more concerned with figuring out what’s happening on a customer’s Mac than my own. So an interactive debugging session is usually not an option.

Comments RSS · Twitter

Leave a Comment