aboutsummaryrefslogtreecommitdiff
path: root/gdb/fbsd-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2018-10-17 11:41:30 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2018-10-17 11:42:00 -0700
commit6f3b1098e820cef84709ef71c287c4b72e6c671b (patch)
tree6c32813cdedcfb6114f14779cc2f2e49f815fb1a /gdb/fbsd-nat.c
parentd500b4f23fc329f5c8cce6ee8fa3629c0f130038 (diff)
downloadgdb-6f3b1098e820cef84709ef71c287c4b72e6c671b.zip
gdb-6f3b1098e820cef84709ef71c287c4b72e6c671b.tar.gz
gdb-6f3b1098e820cef84709ef71c287c4b72e6c671b.tar.bz2
Share the code to format "info proc mappings" entries for FreeBSD.
gdb/ChangeLog: * fbsd-nat.c (fbsd_nat_target::info_proc) Use fbsd_info_proc_mappings_header and fbsd_info_proc_mappings_entry. * fbsd-tdep.c (fbsd_vm_map_entry_flags): Mark static. (fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry): New functions. (fbsd_core_info_proc_mappings): Use fbsd_info_proc_mappings_header and fbsd_info_proc_mappings_header. * fbsd-tdep.h (fbsd_vm_map_entry_flags): Remove. (fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry): New.
Diffstat (limited to 'gdb/fbsd-nat.c')
-rw-r--r--gdb/fbsd-nat.c43
1 files changed, 6 insertions, 37 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 24e40e2..107a729 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -413,46 +413,15 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (vmentl != nullptr)
{
- printf_filtered (_("Mapped address spaces:\n\n"));
-#ifdef __LP64__
- printf_filtered (" %18s %18s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "Flags ", "File");
-#else
- printf_filtered ("\t%10s %10s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "Flags ", "File");
-#endif
+ int addr_bit = TARGET_CHAR_BIT * sizeof (void *);
+ fbsd_info_proc_mappings_header (addr_bit);
struct kinfo_vmentry *kve = vmentl.get ();
for (int i = 0; i < nvment; i++, kve++)
- {
- ULONGEST start, end;
-
- start = kve->kve_start;
- end = kve->kve_end;
-#ifdef __LP64__
- printf_filtered (" %18s %18s %10s %10s %9s %s\n",
- hex_string (start),
- hex_string (end),
- hex_string (end - start),
- hex_string (kve->kve_offset),
- fbsd_vm_map_entry_flags (kve->kve_flags,
- kve->kve_protection),
- kve->kve_path);
-#else
- printf_filtered ("\t%10s %10s %10s %10s %9s %s\n",
- hex_string (start),
- hex_string (end),
- hex_string (end - start),
- hex_string (kve->kve_offset),
- fbsd_vm_map_entry_flags (kve->kve_flags,
- kve->kve_protection),
- kve->kve_path);
-#endif
- }
+ fbsd_info_proc_mappings_entry (addr_bit, kve->kve_start,
+ kve->kve_end, kve->kve_offset,
+ kve->kve_flags, kve->kve_protection,
+ kve->kve_path);
}
else
warning (_("unable to fetch virtual memory map"));