Take the 2-minute tour ×

I would like to exit out the current method that I'm stepping through.

-(void)helloWorld {
    // I would like to return here, so that "World" isn't printed.

I have tried the following, but without luck.

(lldb) expr return
<no result>

Is this possible with lldb?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

When you are debugging using Xcode and when your program is paused at a breakpoint, you can drag the little green arrow to any other line in the function. E.g. in the following code:

Xcode breakpoint

if I want to skip the NSLog(@"B"), I can simply drag the green arrow from line 20 to line 23, which means the function will simply "return" from anywhere I want.

share|improve this answer
I have seen several people report that under LLDB and ARC, dragging the PC to a new location can cause crashes. There are still some kinks to be worked out. Also, if you are familiar with GDB, but not LLDB, save a copy of this cheat sheet: lldb.llvm.org/lldb-gdb.html –  Steve Weller Oct 13 '12 at 14:06
Yeah, in general dragging the pc around is very risky unless you understand all of the runtime / memory allocation / initialization going on behind the scenes. If you have a series of simple statements you can often get away with it but anything more sophisticated and it is fraught with hidden gotchas. –  Jason Molenda Oct 13 '12 at 20:56

Unfortunately in Xcode 4.5.x there is no way to force an early return from a function. In the current lldb sources over at http://lldb.llvm.org/ there is a newly added command, thread return, which does what you want - it includes the ability to specify the return value of the function. This won't be in Xcode until the next major release, though.

share|improve this answer

Your Answer


