Implement "info proc mappings" for NetBSD
authorKamil Rytarowski <n54@gmx.com>
Sun, 12 Apr 2020 00:00:14 +0000 (02:00 +0200)
committerKamil Rytarowski <n54@gmx.com>
Sun, 12 Apr 2020 11:06:08 +0000 (13:06 +0200)
commit54b8cbd0e4063846349634aefa8ed1a3c0ac62ca
tree3deec11e19aac2982654f8c2550d10680527ca7f
parent0b07a199018c928f12ddfb8d5f75baf466de389d
Implement "info proc mappings" for NetBSD

Define nbsd_nat_target::find_memory_regions and
nbsd_nat_target::info_proc. info_proc handles as of now only
the "mappings" command.

Define a local static function kinfo_get_vmmap() that reads
the process memory layout of a specified process.
kinfo_get_vmmap() wraps the sysctl(3) call.

nbsd-tdep.c defines now utility functions for printing the
process memory layout:
 * nbsd_info_proc_mappings_header()
 * nbsd_vm_map_entry_flags()
 * nbsd_info_proc_mappings_entry()

gdb/ChangeLog:

* nbsd-nat.c; Include "nbsd-tdep.h" and "gdbarch.h".
* nbsd-nat.c (nbsd_nat_target::find_memory_regions)
(nbsd_nat_target::info_proc): New functions.
* nbsd-nat.c (kinfo_get_vmmap): New function.
* nbsd-nat.c (nbsd_nat_target::info_proc) Use
nbsd_info_proc_mappings_header and nbsd_info_proc_mappings_entry.
* nbsd-tdep.c (nbsd_info_proc_mappings_header)
(nbsd_info_proc_mappings_entry, nbsd_vm_map_entry_flags): New
functions.
* nbsd-tdep.c (KINFO_VME_PROT_READ, KINFO_VME_PROT_WRITE)
(KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW)
(KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP)
(KINFO_VME_FLAG_PAGEABLE, KINFO_VME_FLAG_GROWS_UP)
(KINFO_VME_FLAG_GROWS_DOWN): New.
gdb/ChangeLog
gdb/nbsd-nat.c
gdb/nbsd-nat.h
gdb/nbsd-tdep.c
gdb/nbsd-tdep.h