Skip to content

Commit 0313312

Browse files
committed
Have show_mapinfo use get_mapinfo
1 parent 35f9406 commit 0313312

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

qiling/os/memory.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,24 +179,13 @@ def __process(lbound: int, ubound: int, perms: int, label: str) -> Tuple[int, in
179179
def show_mapinfo(self):
180180
"""Emit memory map info in a nicely formatted table.
181181
"""
182-
def _perms_mapping(ps):
183-
perms_d = {1: "r", 2: "w", 4: "x"}
184-
perms_sym = []
185-
for idx, val in perms_d.items():
186-
if idx & ps != 0:
187-
perms_sym.append(val)
188-
else:
189-
perms_sym.append("-")
190-
return "".join(perms_sym)
191-
192-
self.ql.log.info("[+] Start End Perm. Path")
193-
for start, end, perm, info in self.map_info:
194-
_perm = _perms_mapping(perm)
195-
image = self.ql.os.find_containing_image(start)
196-
if image:
197-
info += f" ({image.path})"
198-
self.ql.log.info("[+] %08x - %08x - %s %s" % (start, end, _perm, info))
199182

183+
# emit title row
184+
self.ql.log.info(f'{"Start":8s} {"End":8s} {"Perm":5s} {"Label":12s} {"Image"}')
185+
186+
# emit table rows
187+
for lbound, ubound, perms, label, container in self.get_mapinfo():
188+
self.ql.log.info(f'{lbound:08x} - {ubound:08x} {perms:5s} {label:12s} {container or ""}')
200189

201190
def get_lib_base(self, filename: str) -> int:
202191
for s, e, p, info in self.map_info:

0 commit comments

Comments
 (0)