From 1a3c54cf99c45069cf2528ae924faa0729fac172 Mon Sep 17 00:00:00 2001 From: Grazfather Date: Fri, 1 Sep 2023 13:02:53 +0000 Subject: [PATCH] Revert to non-chaining __parse_maps --- gef.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/gef.py b/gef.py index 91f7bf809..ad936c3b7 100644 --- a/gef.py +++ b/gef.py @@ -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