diff --git a/gef.py b/gef.py index af9e1736c..a8dbc8571 100644 --- a/gef.py +++ b/gef.py @@ -9189,13 +9189,8 @@ def __init__(self): def do_invoke(self, argv: List[str]) -> None: readelf = gef.session.constants["readelf"] - if is_remote_debug(): - assert gef.session.remote - elf_file = str(gef.session.remote.lfile) - elf_virtual_path = str(gef.session.remote.file) - else: - elf_file = str(gef.session.file) - elf_virtual_path = str(gef.session.file) + elf_file = str(gef.session.file) + elf_virtual_path = str(gef.session.file) func_names_filter = argv if argv else [] vmmap = gef.memory.maps @@ -10996,7 +10991,7 @@ def os(self) -> str: def pid(self) -> int: """Return the PID of the target process.""" if not self._pid: - pid = gdb.selected_inferior().pid if not gef.session.qemu_mode else gdb.selected_thread().ptid[1] + pid = gdb.selected_inferior().pid if not self.qemu_mode else gdb.selected_thread().ptid[1] if not pid: raise RuntimeError("cannot retrieve PID for target process") self._pid = pid @@ -11005,8 +11000,8 @@ def pid(self) -> int: @property def file(self) -> Optional[pathlib.Path]: """Return a Path object of the target process.""" - if gef.session.remote is not None: - return gef.session.remote.file + if self.remote is not None: + return self.remote.file progspace = gdb.current_progspace() assert progspace fpath: str = progspace.filename @@ -11016,8 +11011,8 @@ def file(self) -> Optional[pathlib.Path]: @property def cwd(self) -> Optional[pathlib.Path]: - if gef.session.remote is not None: - return gef.session.remote.root + if self.remote is not None: + return self.remote.root return self.file.parent if self.file else None @property @@ -11061,8 +11056,8 @@ def maps(self) -> Optional[pathlib.Path]: if not is_alive(): return None if not self._maps: - if gef.session.remote is not None: - self._maps = gef.session.remote.maps + if self.remote is not None: + self._maps = self.remote.maps else: self._maps = pathlib.Path(f"/proc/{self.pid}/maps") return self._maps