Debug another selector while single stepping in Xcode using lldb

debugging, lldb, objective-c, xcode

Solution

The `p` command is really an alias to `expr --`. One of the options to `expr` is `-u` or `--unwind-on-error` -- in this case a breakpoint is treated as an "error" (which might be considered a bug in and of itself - it's debatable, there are use cases where it would be nonintuitive for this to behave differently.)

Anyway, you should be able to do

(lldb) expr -u false -- [self computePI]

and it will stop at the breakpoint. The `--` here indicates to `expr` that it should stop doing option parsing and everything after that is an expression to evaluate.

Problem

I am in my code stopped at a breakpoint at the (lldb) prompt. I can message objects and get their value printed on the console. ``` (lldb) p [self computePI] (float) $1 = 3.0 ``` Whoa! Something is wrong at this point. I would like to be able to step into computePI as a shortcut to figuring out which variables are messed up. However, if I put a breakpoint on that selector and try again I get: ``` (lldb) p [self computePI] error: Execution was interrupted, reason: breakpoint 5.1. The process has been returned to the state before execution. ``` It would be a real time saver if I could somehow step into computePI at this point. Is this possible or not? I have been looking at http://lldb.llvm.org and haven't seen anything. Thanks for your help. UPDATE: Based on Jason Molenda's answer I updated my ~/.lldbinit file with the following handy aliases: ``` command alias nup expr -u 0 -- command alias nupo expr -u 0 -o -- ``` That lets me use nup (in place of p) and nupo (in place of po).

Original source