hack-pt-dump

This commit is contained in:
Your Name 2021-10-23 06:17:25 -07:00 committed by Disconnect3d
parent 5943c5e16e
commit 9105946b8b
3 changed files with 22 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "gdb-pt-dump"]
path = gdb-pt-dump
url = https://github.com/martinradev/gdb-pt-dump.git

1
gdb-pt-dump Submodule

@ -0,0 +1 @@
Subproject commit f0de535b15c9dc7c4df4cc61ebdd7c379c0ee7c9

View File

@ -231,6 +231,24 @@ def proc_pid_maps():
@pwndbg.memoize.reset_on_stop
def monitor_info_mem():
import sys
sys.path.append('/home/dc/tools/pwndbg/gdb-pt-dump/')
import pt
p = pt.PageTableDump()
p.lazy_init()
pages = p.backend.parse_tables(p.cache, p.parser.parse_args(''))
retpages = []
#import pdb
#pdb.set_trace()
for page in pages:
start = page.va
size = page.page_size
flags = 4 # IMPLY ALWAYS READ
if page.w: flags |= 2
if page.x: flags |= 1
retpages.append(pwndbg.memory.Page(start, size, flags, 0, '<pt>'))
return tuple(retpages)
# NOTE: This works only on X86/X64/RISC-V
# See: https://github.com/pwndbg/pwndbg/pull/685
# (TODO: revisit with future QEMU versions)