Skip to content

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.

Functions:

reset_remote_files ¤

reset_remote_files() -> None

remote_files_dir ¤

remote_files_dir()

get_proc_exe_file ¤

get_proc_exe_file() -> str

Returns the local path to the debugged file name.

can_download_remote_file ¤

can_download_remote_file() -> bool

get_file ¤

get_file(path: str, try_local_path: bool = False) -> str

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:

  • str

    The local path to the file

get ¤

get(path: str) -> bytes

Retrieves the contents of the specified file on the system where the current process is being debugged.

Returns:

  • bytes

    A byte array, or None.

readlink(path: str) -> str

readlink(path) -> str

Read the link specified by 'path' on the system being debugged.

Handles local, qemu-usermode, and remote debugging cases.

is_vfile_qemu_user_bug ¤

is_vfile_qemu_user_bug() -> bool
vfile_readlink(pathname: str | bytes) -> bytes

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.

vfile_readfile ¤

vfile_readfile(filename: str, chunk_size=1000) -> Iterator[bytes]

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_open ¤

vfile_open(filename: str, flags: int, mode: int) -> int

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.

gdb_memtox_inverse ¤

gdb_memtox_inverse(data: bytes) -> bytes

vfile_pread ¤

vfile_pread(fd: int, size: int, offset: int) -> tuple[int, bytes]

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_close ¤

vfile_close(fd)

Closes a previously opened file descriptor.

:param fd: File descriptor (integer). :return: None, or raises an exception if an error occurs.