Skip to content

Vmmap

Command to print the virtual memory map a la /proc/self/maps.

integer_types = (int, pwndbg.dbg_mod.Value) module-attribute

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='Print virtual memory map pages.\n\nUnnamed mappings are named as [anon_%#x] where %#x is high part of their start address. This is useful for filtering with `vmmap` or `search` commands.\n\nKnown issues with vmmap:\nFor QEMU user targets, the QEMU\'s gdbstub does not provide memory maps information to GDB until [0] is finished & merged. We try to deal with it without parsing the QEMU process\' /proc/$pid/maps file, but if our approach fails, we simply create a [0, 0xffff...] vmmap which is not great and may result in lack of proper colors or inability to search memory with the `search` command.\n\nFor QEMU kernel, we use gdb-pt-dump that parses page tables from the guest by reading /proc/$pid/mem of QEMU process. If this does not work for you, use `set kernel-vmmap-via-page-tables off` to refer to our old method of reading vmmap info from `monitor info mem` command exposed by QEMU. Note that the latter may be slower and will not give full vmmaps permission information.\n\nFor coredump debugging, GDB also lacks all vmmap info but we do our best to get it back by using the `info proc mappings` and `maintenance info sections` commands.\n\nAs a last resort, we sometimes try to explore the addresses in CPU registers and if they are readable by GDB, we determine their bounds and create an "<explored>" vmmap. However, this method is slow and is not used on each GDB stop.\n\nMemory pages can also be added manually with the use of vmmap_add, vmmap_clear and vmmap_load commands. This may be useful for bare metal debugging.\n\n[0] https://lore.kernel.org/all/20220221030910.3203063-1-dominik.b.czarnota@gmail.com/') module-attribute

calculate_total_memory(pages)

gap_text(page)

pages_filter(gdbval_or_str)

print_adjacent_map(map_start, map_end)

print_gap(current, last_map)

print_guard(page)

print_map(page)

print_vmmap_gaps(pages)

Indicates the size of adjacent memory regions and unmapped gaps between them in process memory

print_vmmap_gaps_table_header()

Prints the table header for the vmmap --gaps command.

print_vmmap_table_header()

Prints the table header for the vmmap command.

vmmap(gdbval_or_str=None, writable=False, executable=False, lines_after=1, lines_before=1, context=None, gaps=False)

vmmap_add(start, size, flags, offset)

vmmap_clear()

vmmap_explore(address)

vmmap_load(filename)