File
Retrieve files from the debuggee's filesystem. Useful when debugging a remote process over SSH or similar, where e.g. /proc/FOO/maps is needed from the remote system.
can_download_remote_file()
¶
get(path)
¶
Retrieves the contents of the specified file on the system where the current process is being debugged.
Returns:
Type | Description |
---|---|
bytes | A byte array, or None. |
get_file(path, try_local_path=False)
¶
Downloads the specified file from the system where the current process is being debugged.
If the path
is prefixed with "target:" the prefix is stripped (to support remote target paths properly).
If the try_local_path
is set to True
and the path
exists locally and "target:" prefix is not present, it will return the local path instead of downloading the file.
Returns:
Type | Description |
---|---|
str | The local path to the file |
get_proc_exe_file()
¶
Returns the local path to the debugged file name.
is_vfile_qemu_user_bug()
¶
readlink(path)
¶
readlink(path) -> str
Read the link specified by 'path' on the system being debugged.
Handles local, qemu-usermode, and remote debugging cases.
remote_files_dir()
¶
reset_remote_files()
¶
vfile_close(fd)
¶
Closes a previously opened file descriptor.
:param fd: File descriptor (integer). :return: None, or raises an exception if an error occurs.
vfile_open(filename, flags, mode)
¶
Opens a file on the remote system and returns the file descriptor.
:param filename: The path to the file (string). :param flags: Flags passed to the open call (integer, base 16). These correspond to the constant values in the enum OpenOptions
from LLDB’s File.h
, not the traditional open(2)
flags. :param mode: Mode bits for the file (integer, base 16). :return: File descriptor (integer), or raises an exception if an error occurs.
vfile_pread(fd, size, offset)
¶
Reads data from a file descriptor.
:param fd: File descriptor (integer). :param size: Number of bytes to read (integer, base 16). :param offset: Offset in the file to start reading from (integer, base 16). :return: Tuple of (bytes_read, data) where bytes_read is an integer and data is the binary data.
vfile_readfile(filename, chunk_size=1000)
¶
Reads the entire content of a file on the remote system.
:param filename: The path to the file (string). :param chunk_size: The number of bytes to read in each iteration (integer). :return: The complete content of the file as bytes.
vfile_readlink(pathname)
¶
Reads the target of a symbolic link on the remote system.
:param pathname: The path to the symbolic link (string). :param buffer_size: The size of the buffer to read into (integer). :return: The target of the symbolic link as a string.