Skip to content

Commit

Permalink
Revert to non-chaining __parse_maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather committed Sep 1, 2023
1 parent a615d6b commit 1a3c54c
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -10365,15 +10365,35 @@ def maps(self) -> List[Section]:
return self.__maps

def __parse_maps(self) -> List[Section]:
"""Return the mapped memory sections"""
"""Return the mapped memory sections. If the current arch has its maps
method defined, then defer to that to generated maps, otherwise, try to
figure it out from procfs, then info sections, then monitor info
mem."""
if gef.arch.maps is not None:
# print("Trying to call architecture's map provider")
maps = list(gef.arch.maps())
return maps

return list(itertools.chain(self.parse_monitor_info_mem(),
self.parse_procfs_maps(),
self.parse_gdb_info_sections()))
try:
return list(self.parse_procfs_maps())
except:
pass

try:
return list(self.parse_gdb_info_sections())
except:
pass

try:
return list(self.parse_monitor_info_mem())
except:
pass

# This provides duplicates
# return list(itertools.chain(
# self.parse_procfs_maps(),
# self.parse_monitor_info_mem(),
# self.parse_gdb_info_sections(),
# ))

# TODO: GefMemoryMapProvider
# TODO: Might be easier to just return nothing on error so we can 'chain' to the next
Expand Down

0 comments on commit 1a3c54c

Please sign in to comment.