Xcode:如何退出lldb swift repl

时间:2015-02-18 13:44:18

标签: xcode debugging swift lldb

我做了一个错字调试我的项目并出现在lldb swift REPL现在我不知道如何退出它同时不退出我调试的程序。所以我输入了expr -r - myVariable而不是expr -R - myVariable。以下就是我所看到的。 (如果你想亲自尝试我使用Xcode 6.1,C ++代码项目,并且myVariable必须存在)

(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

(这里我的申请被终止,lldb被自杀了)

1 个答案:

答案 0 :(得分:44)

使用单个冒号,您可以离开Swift REPL并返回lldb:

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

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

使用:quit,您可以停止整个调试会话:

(lldb) repl
3> 
4> 
5> :quit
5> Program ended with exit code: 9