From 54b8cbd0e4063846349634aefa8ed1a3c0ac62ca Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sun, 12 Apr 2020 02:00:14 +0200 Subject: 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/nbsd-nat.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/nbsd-nat.h') diff --git a/gdb/nbsd-nat.h b/gdb/nbsd-nat.h index 3606048cd07..256db4b9017 100644 --- a/gdb/nbsd-nat.h +++ b/gdb/nbsd-nat.h @@ -35,6 +35,9 @@ struct nbsd_nat_target : public inf_ptrace_target void post_attach (int pid) override; void update_thread_list () override; std::string pid_to_str (ptid_t ptid) override; + + int find_memory_regions (find_memory_region_ftype func, void *data) override; + bool info_proc (const char *, enum info_proc_what) override; }; #endif /* nbsd-nat.h */ -- cgit v1.2.1