Skip to content

Commit

Permalink
Review feedback updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonmessmer committed Jun 2, 2024
1 parent 4443d0d commit c37d58a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,11 @@ def size(self) -> int:
return self.page_end - self.page_start

def search_for_realpath(self) -> str:
# This function is a workaround for gdb bug #23764
# path might be wrong for remote sessions, so try a simple search for files
# that aren't found at the path indicated, which should be canonical.
"""This function is a workaround for gdb bug #23764
path might be wrong for remote sessions, so try a simple search for files
that aren't found at the path indicated, which should be canonical.
"""

# First, try the canonical path in the remote session root.
candidate1 = f"{gef.session.remote.root}/{self.path}"
Expand All @@ -702,7 +704,7 @@ def search_for_realpath(self) -> str:
# On some systems, /lib(64) might be a symlink to /usr/lib(64), so try removing
# the /usr prefix.
if self.path.startswith("/usr"):
candidate = f"{gef.session.remote.root}/{self.path[4:]}"
candidate = f"{gef.session.remote.root}/{self.path[len('/usr'):]}"
if pathlib.Path(candidate).is_file():
return candidate

Expand Down Expand Up @@ -9315,7 +9317,7 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:
args : argparse.Namespace = kwargs["arguments"]
vmmap = gef.memory.maps
mapfiles = [mapfile for mapfile in vmmap if
(True if args.all else mapfile.path == str(gef.session.file)) and
(args.all or mapfile.path == str(gef.session.file)) and
pathlib.Path(mapfile.realpath).is_file() and
mapfile.permission & Permission.EXECUTE]
for mapfile in mapfiles:
Expand Down

0 comments on commit c37d58a

Please sign in to comment.