I have several breakpoints set in a particular class in an XCode project. Everything I discuss below takes place in this one class file.
I set the breakpoints on -(int16_t)areaNbr
by clicking in the gutter, and set no conditions or anything on them. I confirmed they existed as far as LLDB is concerned by running breakpoint list
from the LLDB prompt.
The project scheme is set to build for debugging, not release.
I run the project in the simulator, and stop at a breakpoint in a different method than the one in question, at which time I want to go to the LLDB prompt and call po [self areaNbr]
and step through areaNbr
.
Please note, as this may be quite relevant, I have NO code in the project itself that calls-(int16_t)areaNbr
Now, I CAN get this to stop at my breakpoints on -(int16_t)areaNbr
if I add some code to the project that calls the method.
For example, if I add something like NSLog(@"... %d", [self areaNbr])
I know the issue has nothing to do with compiling away the method simply because nothing calls it, because if that were true, then my call to po [self areaNbr]
wouldn't be spitting out the result to the debugger window as pictured below. So the method is being compiled, and certainly recognized as existing by the debugger for execution purposes... just not for stepping purposes.
FYI, [self area]
is returning "Area01"
Calling breakpoint list
in LLDB returns the following
By default, lldb does not stop at breakpoints in hand-called code. The majority of folks use expr
& expr -O --
i.e. po
to print values & objects and were annoyed if they stopped at breakpoints they had set for other purposes.
However, it is easy to control this behavior, just use:
(lldb) expr -i 0 -- [self areaNbr]
Then you will stop at your breakpoint.
In this example, I left out the -O which is the object printing part, since if you just want to call this method, you likely don't care about calling description
on the result after the expression is evaluated.
You can see all the options for expression evaluation by doing:
(lldb) help expr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With