Inquiry about SBFileSpec

Hello,
The SBFileSpec class of APIs can be used to read files on the local file system right ? I want to know if it can be used for reading files on the remote file system ? or do we need to use some other API ?

BR,
A Ravi Theja

The SBPlatform that you can get from your SBTarget is the way to do this correctly:

SBPlatform platform = target.GetPlatform();

SBFileSpec src("/some/remote/path/to/remote/file/file.txt", false);
SBFileSpec dst("/tmp/file.txt");
SBError error = platform.Get (src, dst);

Then you can plat with "dst" locally on your machine. This of course means that you have to be connected to the remote platform. The "lldb-server" we build can be used as a platform that can be started and allows the local LLDB to attach to the remote platform.

So on the remote machine you would start your "lldb-server" in platform mode:

remote.foo.com% lldb-server platform other.foo.com:1234 [options]

Then you can attach your platform to this:

% lldb
(lldb) platform select remote-linux
(lldb) platform connect remote.foo.com:1234

now you are connected and can run things remotely and get files from the platform:

(lldb) platform settings --working-dir "/tmp"
(lldb) file a.out
(lldb) run

Since we are connected to a platform, the main executable of any target will be sent over to the remote machine in the platform's working directory and then run from there.

And if you are connected, you can get the platform from the current target and transfer files.