Xcode: how to exit lldb swift repl

梦想的初衷 提交于 2019-12-20 09:53:32

问题


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)


回答1:


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


来源:https://stackoverflow.com/questions/28585154/xcode-how-to-exit-lldb-swift-repl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!