Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: how to exit lldb swift repl

I made a typo debugging my project and appeared in lldb swift REPL now I don't know how to exit it and simultaneously do not exit from my program which I debug. So I typed expr -r -- myVariable instead of expr -R -- myVariable. and below is what I see. (if you want to try personally I use Xcode 6.1, C++ code project, and myVariable has to exist)

(lldb) expr -r -- record.mFileRecord.mVolumeName (std::string) $19 = "" 1> help expr /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856 /repl433.swift:2:5: error: consecutive statements on a line must be  separated by ';'  1> quit  /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856 /repl434.swift:2:1: error: use of unresolved identifier 'quit'  quit   1> exit  /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl435.swift:2:1: error: use of unresolved identifier 'exit'  exit    1> exit()  /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl436.swift:2:1: error: use of unresolved identifier 'exit'  exit()  ^   1> quit()  /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl437.swift:2:1: error: use of unresolved identifier 'quit'  quit()     1> .quit  /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856 /repl438.swift:2:2: error: could not find member 'quit'  .quit  ^~~   1> :quit 

(here my application terminated and lldb was self-killed)

like image 454
dev_null Avatar asked Feb 18 '15 13:02

dev_null


People also ask

How do I exit swift REPL?

One can also exit REPL into LLDB with just : and, then later quit (or exit ) using the LLDB command directly. Addendum: The LLDB command c or continue can be used to return to the Swift REPL environment. You can also type Control-D into the LLDB prompt to get back to the Swift REPL.

What does LLDB mean in Xcode?

What is LLDB? A low-level debugger (LLDB) is the default debugger used in Xcode and is part of the LLVM project. LLDB replaced GDB in XCode 5 and has several advantages, such as performance and scriptability.

Does Xcode use LLDB?

Xcode uses the LLDB as the default debugging tool. The full form of LLDB is Low-level debugger. Breakpoints help a developer to stop the execution of the program at any point.

What is LLDB in Swift?

As a reminder, LLDB is a debugger. But LLDB is not just a debugger. It is also a compiler! In addition to the functionality of a debugger, LLDB also includes a fully functioning copy of the Swift and Clang compilers. These compilers power LLDB's expression evaluator, which you may know through p and po command aliases.


1 Answers

With a single colon you can leave the Swift REPL and return to lldb:

 (lldb) repl 1>  2>  3> : (lldb) 

(Found here: http://swift.exomachina.com/how-to-use-lldb-to-debug-swift-program.)

With :quit you can stop the entire debugging session:

 (lldb) repl 3>  4>  5> :quit 5> Program ended with exit code: 9 
like image 77
Martin R Avatar answered Sep 23 '22 11:09

Martin R