在 lldb 中,调试器可以创建platforms
用于上传文件、运行程序等的连接。默认情况下,lldb 连接到“主机”平台,即您的本地系统。您可以使用platform shell
在当前平台上运行命令,因此要获取cwd,只需执行以下操作:
(lldb) platform shell pwd
Run Code Online (Sandbox Code Playgroud)
您不能用来platform shell
更改 cwd,因为这是一个子 shell,因此它的效果不会在子 shell 执行之后持续存在。这cwd
是平台的设置,因此您可以通过以下方式更改它:
(lldb) platform settings -w <NEW_PATH>
Run Code Online (Sandbox Code Playgroud)