X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d1ecb069dfe24481e4a83f44cb5217a2b06746d7..0b4c1975fb5e4eccf1012a35081f7e7799b81046:/kgmacros diff --git a/kgmacros b/kgmacros index 5a4897abd..53e0a769a 100644 --- a/kgmacros +++ b/kgmacros @@ -781,7 +781,7 @@ define showwaitqwaitercount set $kgm_wc_wqe = (WaitQueueElement *)$kgm_wc_linksp->next set $kgm_wc_count = 0 while ( (queue_entry_t)$kgm_wc_wqe != (queue_entry_t)$kgm_wc_linksp) - if ($kgm_wc_wqe->wqe_type != &_wait_queue_link) + if ($kgm_wc_wqe->wqe_type != &_wait_queue_link) && ($kgm_wc_wqe->wqe_type != &_wait_queue_link_noalloc) set $kgm_wc_count = $kgm_wc_count + 1 end set $kgm_wc_wqe = (WaitQueueElement *)$kgm_wc_wqe->wqe_links.next @@ -790,7 +790,7 @@ define showwaitqwaitercount end define showwaitqmembercount - set $kgm_mc_waitqsetp = (WaitQueueSet*)$arg0 + set $kgm_mc_waitqsetp = (struct wait_queue_set *)$arg0 set $kgm_mc_setlinksp = &($kgm_mc_waitqsetp->wqs_setlinks) set $kgm_mc_wql = (WaitQueueLink *)$kgm_mc_setlinksp->next set $kgm_mc_count = 0 @@ -852,7 +852,7 @@ define showwaitqmemberof end define showwaitqmembers - set $kgm_ms_waitqsetp = (WaitQueueSet*)$arg0 + set $kgm_ms_waitqsetp = (struct wait_queue_set *)$arg0 set $kgm_ms_setlinksp = &($kgm_ms_waitqsetp->wqs_setlinks) set $kgm_ms_wql = (WaitQueueLink *)$kgm_ms_setlinksp->next set $kgm_ms_found = 0 @@ -868,15 +868,15 @@ define showwaitqmembers end define showwaitqheader - printf "wait_queue ref_count interlock " + printf "wait_queue prepostq interlock " printf "pol type member_cnt waiter_cnt\n" end define showwaitqint - set $kgm_waitqp = (WaitQueue*)$arg0 + set $kgm_waitqp = (WaitQueue *)$arg0 printf "0x%08x ", $kgm_waitqp if ($kgm_waitqp->wq_type == 0xf1d1) - printf "0x%08x ", ((WaitQueueSet*)$kgm_waitqp)->wqs_refcount + printf "0x%08x ", &((struct wait_queue_set *)$kgm_waitqp)->wqs_preposts else printf "0x00000000 " end @@ -988,6 +988,93 @@ define showvmint end +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 +| Routine to print out a summary listing of all the entries with wired pages in a vm_map +end + define showmapvme showmapheader showvmint $arg0 1 @@ -1138,9 +1225,11 @@ define showipcint if $kgm_ie.ie_bits & 0x001f0000 set $kgm_name = (($kgm_iindex << 8)|($kgm_ie.ie_bits >> 24)) showipceint $kgm_iep $kgm_name - if $arg2 != 0 && $kgm_ie.ie_object != 0 && ($kgm_ie.ie_bits & 0x00070000) && ((ipc_port_t) $kgm_ie.ie_object)->ip_callstack[0] != 0 - printf " user bt: " - showportbt $kgm_ie.ie_object $kgm_is.is_task + if $arg2 != 0 && ipc_portbt != 0 + if $kgm_ie.ie_object != 0 && ($kgm_ie.ie_bits & 0x00070000) && ((ipc_port_t) $kgm_ie.ie_object)->ip_callstack[0] != 0 + printf " user bt: " + showportbt $kgm_ie.ie_object $kgm_is.is_task + end end end set $kgm_iindex = $kgm_iindex + 1 @@ -1711,11 +1800,11 @@ define showpsetint printf "Set " printf "%5d ", $kgm_psetp->ips_object.io_references printf "0x%08x ", $kgm_psetp->ips_messages.data.pset.local_name - set $kgm_setlinksp = &($kgm_psetp->ips_messages.data.set_queue.wqs_setlinks) + set $kgm_setlinksp = &($kgm_psetp->ips_messages.data.pset.set_queue.wqs_setlinks) set $kgm_wql = (WaitQueueLink *)$kgm_setlinksp->next set $kgm_found = 0 while ( (queue_entry_t)$kgm_wql != (queue_entry_t)$kgm_setlinksp) - set $kgm_portp = (struct ipc_port *)((int)($kgm_wql->wql_element->wqe_queue) - ((int)$kgm_portoff)) + set $kgm_portp = (struct ipc_port *)((uintptr_t)$kgm_wql->wql_element.wqe_queue - $kgm_portoff) if !$kgm_found set $kgm_destspacep = (struct ipc_space *)0 showportdestproc $kgm_portp @@ -1751,17 +1840,17 @@ end define showmqueue set $kgm_mqueue = *(struct ipc_mqueue *)$arg0 + set $kgm_psetoff = (uintptr_t)&(((struct ipc_pset *)0)->ips_messages) + set $kgm_portoff = (uintptr_t)&(((struct ipc_port *)0)->ip_messages) if ($kgm_mqueue.data.pset.set_queue.wqs_wait_queue.wq_type == 0xf1d1) - set $kgm_psetoff = &(((struct ipc_pset *)0)->ips_messages) - set $kgm_pset = (((long)$arg0) - ((long)$kgm_psetoff)) + set $kgm_psetp = (struct ipc_pset *)(((uintptr_t)$arg0) - $kgm_psetoff) showpsetheader - showpsetint $kgm_pset 1 + showpsetint $kgm_psetp 1 end if ($kgm_mqueue.data.pset.set_queue.wqs_wait_queue.wq_type == 0xf1d0) - set $kgm_portoff = &(((struct ipc_port *)0)->ip_messages) - set $kgm_port = (((long)$arg0) - ((long)$kgm_portoff)) + set $kgm_portp = (struct ipc_port *)(((uintptr_t)$arg0) - $kgm_portoff) showportheader - showportint $kgm_port 1 + showportint $kgm_portp 1 end end @@ -1785,6 +1874,9 @@ define zprint_one if ($kgm_zone->expandable) printf "X" end + if ($kgm_zone->noencrypt) + printf "$" + end printf "\n" end