+define showmapwiredp
+ set $kgm_mapp = (vm_map_t)$arg0
+ set $kgm_map = *$kgm_mapp
+ set $kgm_head_vmep = &($kgm_mapp->hdr.links)
+ set $kgm_vmep = $kgm_map.hdr.links.next
+ set $kgm_objp_prev = (struct vm_object *)0
+ if $arg1 == 0
+ set $kgm_saw_kernel_obj = 0
+ set $kgm_wired_count = 0
+ set $kgm_objp_print_space = 1
+ else
+ set $kgm_objp_print_space = 0
+ end
+ while (($kgm_vmep != 0) && ($kgm_vmep != $kgm_head_vmep))
+ set $kgm_vme = *$kgm_vmep
+ set $kgm_objp = $kgm_vme.object.vm_object
+ if $kgm_vme.is_sub_map
+ if $arg1 == 0
+ set $kgm_mapp_orig = $kgm_mapp
+ set $kgm_vmep_orig = $kgm_vmep
+ set $kgm_vme_orig = $kgm_vme
+ set $kgm_head_vmep_orig = $kgm_head_vmep
+ printf "\n****"
+ showptr $kgm_objp
+ showmapwiredp $kgm_objp 1
+ set $kgm_vme = $kgm_vme_orig
+ set $kgm_vmep = $kgm_vmep_orig
+ set $kgm_mapp = $kgm_mapp_orig
+ set $kgm_head_vmep = $kgm_head_vmep_orig
+ set $kgm_objp = (struct vm_object *)0
+ else
+ printf "\n????"
+ showptr $kgm_mapp
+ printf " "
+ showptr $kgm_vmep
+ set $kgm_objp = (struct vm_object *)0
+ printf "\n"
+ end
+ end
+ if ($kgm_objp == $kgm_objp_prev)
+ set $kgm_objp = (struct vm_object *)0
+ end
+ if $kgm_objp == kernel_object
+ if $kgm_saw_kernel_obj
+ set $kgm_objp = (struct vm_object *)0
+ end
+ set $kgm_saw_kernel_obj = 1
+ end
+ if $kgm_objp && $kgm_objp->wired_page_count
+ if $kgm_objp_print_space == 1
+ printf " "
+ showptr $kgm_mapp
+ end
+ set $kgm_objp_print_space = 1
+ printf " "
+ showptr $kgm_vmep
+ printf " 0x%016llx ", $kgm_vme.links.start
+ printf "%5d", $kgm_vme.alias
+ printf "%6d ",($kgm_vme.links.end - $kgm_vme.links.start) >> 12
+ showptr $kgm_objp
+ printf "[%3d]", $kgm_objp->ref_count
+ printf "%7d\n", $kgm_objp->wired_page_count
+ set $kgm_wired_count = $kgm_wired_count + $kgm_objp->wired_page_count
+ set $kgm_objp_prev = $kgm_objp
+ end
+ set $kgm_vmep = $kgm_vme.links.next
+ end
+ if $arg1 == 0
+ printf "total wired count = %d\n", $kgm_wired_count
+ end
+end
+
+define showmapwired
+ printf " map "
+ showptrhdrpad
+ printf " entry "
+ showptrhdrpad
+ printf " start alias #page object "
+ showptrhdrpad
+ printf " wired\n"
+ showmapwiredp $arg0 0
+end
+document showmapwired
+Syntax: (gdb) showmapwired <vm_map>
+| Routine to print out a summary listing of all the entries with wired pages in a vm_map
+end
+