4 # These gdb macros should be useful during kernel development in
5 # determining what's going on in the kernel.
7 # All the convenience variables used by these macros begin with $kgm_
11 echo Loading Kernel GDB Macros package. Type "help kgm" for more info.\n
14 printf "These are the kernel gdb macros version %d. ", $kgm_vers
15 echo Type "help kgm" for more info.\n
19 | These are the kernel gdb macros. These gdb macros are intended to be
20 | used when debugging a remote kernel via the kdp protocol. Typically, you
21 | would connect to your remote target like so:
22 | (gdb) target remote-kdp
23 | (gdb) attach <name-of-remote-host>
25 | The following macros are available in this package:
27 | showalltasks Display a summary listing of tasks
28 | showallacts Display a summary listing of all activations
29 | showallstacks Display the kernel stacks for all activations
30 | showallvm Display a summary listing of all the vm maps
31 | showallvme Display a summary listing of all the vm map entries
32 | showallipc Display a summary listing of all the ipc spaces
33 | showallrights Display a summary listing of all the ipc rights
34 | showallkmods Display a summary listing of all the kernel modules
36 | showtask Display status of the specified task
37 | showtaskacts Display the status of all activations in the task
38 | showtaskstacks Display all kernel stacks for all activations in the task
39 | showtaskvm Display status of the specified task's vm_map
40 | showtaskvme Display a summary list of the task's vm_map entries
41 | showtaskipc Display status of the specified task's ipc space
42 | showtaskrights Display a summary list of the task's ipc space entries
44 | showact Display status of the specified thread activation
45 | showactstack Display the kernel stack for the specified activation
47 | showmap Display the status of the specified vm_map
48 | showmapvme Display a summary list of the specified vm_map's entries
50 | showipc Display the status of the specified ipc space
51 | showrights Display a summary list of all the rights in an ipc space
53 | showpid Display the status of the process identified by pid
54 | showproc Display the status of the process identified by a proc pointer
56 | showkmod Display information about a kernel module
57 | showkmodaddr Given an address, display the kernel module and offset
59 | zprint Display zone information
61 | Type "help <macro>" for more specific help on a particular macro.
62 | Type "show user <macro>" to see what the macro is really doing.
67 printf "kmod address size "
68 printf "id refs version name\n"
72 set $kgm_kmodp = (struct kmod_info *)$arg0
73 printf "0x%08x ", $arg0
74 printf "0x%08x ", $kgm_kmodp->address
75 printf "0x%08x ", $kgm_kmodp->size
76 printf "%3d ", $kgm_kmodp->id
77 printf "%5d ", $kgm_kmodp->reference_count
78 printf "%10s ", &$kgm_kmodp->version
79 printf "%s\n", &$kgm_kmodp->name
82 set $kgm_kmodmin = 0xffffffff
83 set $kgm_fkmodmin = 0x00000000
84 set $kgm_kmodmax = 0x00000000
85 set $kgm_fkmodmax = 0xffffffff
91 if ((unsigned int)$arg0 >= (unsigned int)$kgm_pkmodst) && ((unsigned int)$arg0 <= (unsigned int)$kgm_pkmoden)
92 set $kgm_off = ((unsigned int)$arg0 - (unsigned int)$kgm_pkmodst)
93 printf " <%s + 0x%x>", $kgm_pkmod->name, $kgm_off
95 if ((unsigned int)$arg0 <= (unsigned int)$kgm_fkmodmax) && ((unsigned int)$arg0 >= (unsigned int)$kgm_fkmodmin)
96 set $kgm_kmodp = (struct kmod_info *)kmod
98 set $kgm_kmod = *$kgm_kmodp
99 if $kgm_kmod.address && ($kgm_kmod.address < $kgm_kmodmin)
100 set $kgm_kmodmin = $kgm_kmod.address
102 if ($kgm_kmod.address + $kgm_kmod.size) > $kgm_kmodmax
103 set $kgm_kmodmax = $kgm_kmod.address
105 set $kgm_off = ((unsigned int)$arg0 - (unsigned int)$kgm_kmod.address)
106 if ($kgm_kmod.address <= $arg0) && ($kgm_off <= $kgm_kmod.size)
107 printf " <%s + 0x%x>", $kgm_kmodp->name, $kgm_off
108 set $kgm_pkmod = $kgm_kmodp
109 set $kgm_pkmodst = $kgm_kmod.address
110 set $kgm_pkmoden = $kgm_pkmodst + $kgm_kmod.size
113 set $kgm_kmodp = $kgm_kmod.next
117 set $kgm_fkmodmin = $kgm_kmodmin
118 set $kgm_fkmodmax = $kgm_kmodmax
123 document showkmodaddr
124 | Given an address, print the offset and name for the kmod containing it
125 | The following is the syntax:
126 | (gdb) showkmodaddr <addr>
134 | Routine to print info about a kernel module
135 | The following is the syntax:
136 | (gdb) showkmod <kmod>
141 set $kgm_kmodp = (struct kmod_info *)kmod
143 showkmodint $kgm_kmodp
144 set $kgm_kmodp = $kgm_kmodp->next
147 document showallkmods
148 | Routine to print a summary listing of all the kernel modules
149 | The following is the syntax:
154 printf " activation "
155 printf "thread pri state wait_queue wait_event\n"
160 printf " 0x%08x ", $arg0
161 set $kgm_actp = *(Thread_Activation *)$arg0
163 set $kgm_thread = *$kgm_actp.thread
164 printf "0x%08x ", $kgm_actp.thread
165 printf "%3d ", $kgm_thread.sched_pri
166 set $kgm_state = $kgm_thread.state
190 printf "0x%08x ", $kgm_thread.wait_queue
191 output /a $kgm_thread.wait_event
194 if ($kgm_thread.kernel_stack != 0)
195 if ($kgm_thread.stack_privilege != 0)
196 printf "\n\t\tstack_privilege=0x%08x", $kgm_thread.stack_privilege
198 printf "\n\t\tkernel_stack=0x%08x", $kgm_thread.kernel_stack
199 set $mysp = $kgm_actp->mact.pcb.ss.r1
201 printf "\n\t\tstacktop=0x%08x", $mysp
202 while ($mysp != 0) && (($mysp & 0xf) == 0) && ($mysp < 0xb0000000) && ($mysp > $prevsp)
203 printf "\n\t\t0x%08x ", $mysp
204 set $kgm_return = *($mysp + 8)
205 if (($kgm_return > end) && ($kgm_return < 0x40000000))
206 showkmodaddr $kgm_return
208 output /a * ($mysp + 8)
213 printf "\n\t\tstackbottom=0x%08x", $prevsp
215 printf "\n\t\t\tcontinuation="
216 output /a $kgm_thread.continuation
230 | Routine to print out the state of a specific thread activation.
231 | The following is the syntax:
232 | (gdb) showact <activation>
240 document showactstack
241 | Routine to print out the stack of a specific thread activation.
242 | The following is the syntax:
243 | (gdb) showactstack <activation>
248 set $kgm_head_taskp = &default_pset.tasks
249 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
250 while $kgm_taskp != $kgm_head_taskp
252 showtaskint $kgm_taskp
254 set $kgm_head_actp = &($kgm_taskp->thr_acts)
255 set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next)
256 while $kgm_actp != $kgm_head_actp
257 showactint $kgm_actp 0
258 set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next)
261 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
265 | Routine to print out a summary listing of all the thread activations.
266 | The following is the syntax:
272 set $kgm_head_taskp = &default_pset.tasks
273 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
274 while $kgm_taskp != $kgm_head_taskp
276 showtaskint $kgm_taskp
277 set $kgm_head_actp = &($kgm_taskp->thr_acts)
278 set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next)
279 while $kgm_actp != $kgm_head_actp
281 showactint $kgm_actp 1
282 set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next)
285 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
288 document showallstacks
289 | Routine to print out a summary listing of all the thread kernel stacks.
290 | The following is the syntax:
291 | (gdb) showallstacks
294 define showwaitqmembercount
295 set $kgm_waitqsubp = (wait_queue_sub_t)$arg0
296 set $kgm_sublinksp = &($kgm_waitqsubp->wqs_sublinks)
297 set $kgm_wql = (wait_queue_link_t)$kgm_sublinksp->next
299 while ( (queue_entry_t)$kgm_wql != (queue_entry_t)$kgm_sublinksp)
300 set $kgm_waitqp = $kgm_wql->wql_element->wqe_queue
302 showwaitqmemberheader
305 showwaitqmemberint $kgm_waitqp
310 define showwaitqmemberint
311 set $kgm_waitqp = (wait_queue_t)$arg0
312 printf " 0x%08x ", $kgm_waitqp
313 printf "0x%08x ", $kgm_waitqp->wq_interlock
314 if ($kgm_waitqp->wq_fifo)
319 if ($kgm_waitqp->wq_issub)
325 showwaitqwaitercount $kgm_waitqp
326 showwaitqmembercount $kgm_waitqp
331 define showwaitqmembers
332 set $kgm_waitqsubp = (wait_queue_sub_t)$arg0
333 set $kgm_sublinksp = &($kgm_waitqsubp->wqs_sublinks)
334 set $kgm_wql = (wait_queue_link_t)$kgm_sublinksp->next
336 while ( (queue_entry_t)$kgm_wql != (queue_entry_t)$kgm_sublinksp)
337 set $kgm_waitqp = $kgm_wql->wql_element->wqe_queue
339 showwaitqmemberheader
342 showwaitqmemberint $kgm_waitqp
347 set $kgm_waitq = (wait_queue_t)$arg0
350 if ($kgm_waitq->wq_issub)
356 printf "vm_map pmap vm_size "
357 printf "#ents rpage hint first_free\n"
361 printf " entry start "
362 printf "prot #page object offset\n"
366 set $kgm_mapp = (vm_map_t)$arg0
367 set $kgm_map = *$kgm_mapp
368 printf "0x%08x ", $arg0
369 printf "0x%08x ", $kgm_map.pmap
370 printf "0x%08x ", $kgm_map.size
371 printf "%3d ", $kgm_map.hdr.nentries
372 printf "%5d ", $kgm_map.pmap->stats.resident_count
373 printf "0x%08x ", $kgm_map.hint
374 printf "0x%08x\n", $kgm_map.first_free
377 set $kgm_head_vmep = &($kgm_mapp->hdr.links)
378 set $kgm_vmep = $kgm_map.hdr.links.next
379 while (($kgm_vmep != 0) && ($kgm_vmep != $kgm_head_vmep))
380 set $kgm_vme = *$kgm_vmep
381 printf " 0x%08x ", $kgm_vmep
382 printf "0x%08x ", $kgm_vme.links.start
383 printf "%1x", $kgm_vme.protection
384 printf "%1x", $kgm_vme.max_protection
385 if $kgm_vme.inheritance == 0x0
388 if $kgm_vme.inheritance == 0x1
391 if $kgm_vme.inheritance == 0x2
394 if $kgm_vme.inheritance == 0x3
397 if $kgm_vme.is_sub_map
400 if $kgm_vme.needs_copy
406 printf "%5d ",($kgm_vme.links.end - $kgm_vme.links.start) >> 12
407 printf "0x%08x ", $kgm_vme.object.vm_object
408 printf "0x%08x\n", $kgm_vme.offset
409 set $kgm_vmep = $kgm_vme.links.next
421 | Routine to print out a summary listing of all the entries in a vm_map
422 | The following is the syntax:
423 | (gdb) showmapvme <vm_map>
432 | Routine to print out a summary description of a vm_map
433 | The following is the syntax:
434 | (gdb) showmap <vm_map>
438 set $kgm_head_taskp = &default_pset.tasks
439 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
440 while $kgm_taskp != $kgm_head_taskp
443 showtaskint $kgm_taskp
444 showvmint $kgm_taskp->map 0
445 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
449 | Routine to print a summary listing of all the vm maps
450 | The following is the syntax:
456 set $kgm_head_taskp = &default_pset.tasks
457 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
458 while $kgm_taskp != $kgm_head_taskp
461 showtaskint $kgm_taskp
462 showvmint $kgm_taskp->map 1
463 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
467 | Routine to print a summary listing of all the vm map entries
468 | The following is the syntax:
474 printf "ipc_space is_table table_next "
475 printf "flags tsize splaytree splaybase\n"
478 define showipceheader
479 printf " name object "
480 printf "rite urefs destname destination\n"
484 set $kgm_ie = *(ipc_entry_t)$arg0
485 printf " 0x%08x ", $arg1
486 printf "0x%08x ", $kgm_ie.ie_object
487 if $kgm_ie.ie_bits & 0x00100000
489 printf "%5d\n", $kgm_ie.ie_bits & 0xffff
491 if $kgm_ie.ie_bits & 0x00080000
493 printf "%5d\n", $kgm_ie.ie_bits & 0xffff
495 if $kgm_ie.ie_bits & 0x00010000
496 if $kgm_ie.ie_bits & 0x00020000
502 if $kgm_ie.ie_bits & 0x00020000
506 if $kgm_ie.ie_bits & 0x00040000
509 if $kgm_ie.index.request
514 if $kgm_ie.ie_bits & 0x00800000
519 printf "%5d ", $kgm_ie.ie_bits & 0xffff
520 showportdest $kgm_ie.ie_object
526 set $kgm_isp = (ipc_space_t)$arg0
527 set $kgm_is = *$kgm_isp
528 printf "0x%08x ", $arg0
529 printf "0x%08x ", $kgm_is.is_table
530 printf "0x%08x ", $kgm_is.is_table_next
531 if $kgm_is.is_growing != 0
536 if $kgm_is.is_fast != 0
541 if $kgm_is.is_active != 0
546 printf "%5d ", $kgm_is.is_table_size
547 printf "0x%08x ", $kgm_is.is_tree_total
548 printf "0x%08x\n", &$kgm_isp->is_tree
552 set $kgm_iep = $kgm_is.is_table
553 set $kgm_destspacep = (ipc_space_t)0
554 while ( $kgm_iindex < $kgm_is.is_table_size )
555 set $kgm_ie = *$kgm_iep
556 if $kgm_ie.ie_bits & 0x001f0000
557 set $kgm_name = (($kgm_iindex << 8)|($kgm_ie.ie_bits >> 24))
558 showipceint $kgm_iep $kgm_name
560 set $kgm_iindex = $kgm_iindex + 1
561 set $kgm_iep = &($kgm_is.is_table[$kgm_iindex])
563 if $kgm_is.is_tree_total
564 printf "Still need to write tree traversal\n"
572 set $kgm_isp = (ipc_space_t)$arg0
574 showipcint $kgm_isp 0
577 | Routine to print the status of the specified ipc space
578 | The following is the syntax:
579 | (gdb) showipc <ipc_space>
583 set $kgm_isp = (ipc_space_t)$arg0
585 showipcint $kgm_isp 1
588 | Routine to print a summary list of all the rights in a specified ipc space
589 | The following is the syntax:
590 | (gdb) showrights <ipc_space>
595 set $kgm_taskp = (task_t)$arg0
598 showtaskint $kgm_taskp
599 showipcint $kgm_taskp->itk_space 0
602 | Routine to print the status of the ipc space for a task
603 | The following is the syntax:
604 | (gdb) showtaskipc <task>
608 define showtaskrights
609 set $kgm_taskp = (task_t)$arg0
612 showtaskint $kgm_taskp
613 showipcint $kgm_taskp->itk_space 1
615 document showtaskrights
616 | Routine to print a summary listing of all the ipc rights for a task
617 | The following is the syntax:
618 | (gdb) showtaskrights <task>
622 set $kgm_head_taskp = &default_pset.tasks
623 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
624 while $kgm_taskp != $kgm_head_taskp
627 showtaskint $kgm_taskp
628 showipcint $kgm_taskp->itk_space 0
629 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
633 | Routine to print a summary listing of all the ipc spaces
634 | The following is the syntax:
640 set $kgm_head_taskp = &default_pset.tasks
641 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
642 while $kgm_taskp != $kgm_head_taskp
645 showtaskint $kgm_taskp
646 showipcint $kgm_taskp->itk_space 1
647 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
650 document showallrights
651 | Routine to print a summary listing of all the ipc rights
652 | The following is the syntax:
653 | (gdb) showallrights
658 set $kgm_taskp = (task_t)$arg0
661 showtaskint $kgm_taskp
662 showvmint $kgm_taskp->map 0
665 | Routine to print out a summary description of a task's vm_map
666 | The following is the syntax:
667 | (gdb) showtaskvm <task>
671 set $kgm_taskp = (task_t)$arg0
674 showtaskint $kgm_taskp
675 showvmint $kgm_taskp->map 1
678 | Routine to print out a summary listing of a task's vm_map_entries
679 | The following is the syntax:
680 | (gdb) showtaskvme <task>
684 define showtaskheader
685 printf "task vm_map ipc_space #acts "
691 set $kgm_task = *(Task *)$arg0
692 printf "0x%08x ", $arg0
693 printf "0x%08x ", $kgm_task.map
694 printf "0x%08x ", $kgm_task.itk_space
695 printf "%3d ", $kgm_task.thr_act_count
696 showprocint $kgm_task.bsd_info
704 | Routine to print out info about a task.
705 | The following is the syntax:
706 | (gdb) showtask <task>
712 set $kgm_taskp = (Task *)$arg0
713 showtaskint $kgm_taskp
715 set $kgm_head_actp = &($kgm_taskp->thr_acts)
716 set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next)
717 while $kgm_actp != $kgm_head_actp
718 showactint $kgm_actp 0
719 set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next)
722 document showtaskacts
723 | Routine to print a summary listing of the activations in a task
724 | The following is the syntax:
725 | (gdb) showtaskacts <task>
729 define showtaskstacks
731 set $kgm_taskp = (Task *)$arg0
732 showtaskint $kgm_taskp
733 set $kgm_head_actp = &($kgm_taskp->thr_acts)
734 set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next)
735 while $kgm_actp != $kgm_head_actp
737 showactint $kgm_actp 1
738 set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next)
741 document showtaskstacks
742 | Routine to print a summary listing of the activations in a task and their stacks
743 | The following is the syntax:
744 | (gdb) showtaskstacks <task>
750 set $kgm_head_taskp = &default_pset.tasks
751 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
752 while $kgm_taskp != $kgm_head_taskp
753 showtaskint $kgm_taskp
754 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
757 document showalltasks
758 | Routine to print a summary listing of all the tasks
759 | The following is the syntax:
764 define showprocheader
765 printf " pid proc command\n"
769 set $kgm_procp = (struct proc *)$arg0
771 printf "%5d ", $kgm_procp->p_pid
772 printf "0x%08x ", $kgm_procp
773 printf "%s\n", $kgm_procp->p_comm
775 printf " *0* 0x00000000 --\n"
781 set $kgm_head_taskp = &default_pset.tasks
782 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
783 while $kgm_taskp != $kgm_head_taskp
784 set $kgm_procp = (struct proc *)$kgm_taskp->bsd_info
785 if (($kgm_procp != 0) && ($kgm_procp->p_pid == $arg0))
786 showtaskint $kgm_taskp
787 set $kgm_taskp = $kgm_head_taskp
789 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
794 | Routine to print a single process by pid
795 | The following is the syntax:
796 | (gdb) showpid <pid>
801 set $kgm_procp = (struct proc *)$arg0
802 showtaskint $kgm_procp->task $arg1 $arg2
807 set switch_debugger=1
811 | kdb - Switch to the inline kernel debugger
815 | The kdb macro allows you to invoke the inline kernel debugger.
818 define showpsetheader
819 printf "portset waitqueue recvname "
820 printf "flags refs recvname process\n"
823 define showportheader
824 printf "port mqueue recvname "
825 printf "flags refs recvname process\n"
828 define showportmemberheader
829 printf " port recvname "
830 printf "flags refs mqueue msgcount\n"
833 define showkmsgheader
835 printf "disp msgid remote-port local-port\n"
839 printf " 0x%08x ", $arg0
840 set $kgm_kmsgh = ((ipc_kmsg_t)$arg0)->ikm_header
841 printf "0x%08x ", $kgm_kmsgh.msgh_size
842 if (($kgm_kmsgh.msgh_bits & 0xff) == 19)
847 if (($kgm_kmsgh.msgh_bits & 0xff00) == (19 < 8))
852 if ($kgm_kmsgh.msgh_bits & 0xf0000000)
857 printf "%5d ", $kgm_kmsgh.msgh_msgid
858 printf "0x%08x ", $kgm_kmsgh.msgh_remote_port
859 printf "0x%08x\n", $kgm_kmsgh.msgh_local_port
865 set $kgm_portp = (ipc_port_t)$arg0
866 printf "0x%08x kobject(", $kgm_portp->ip_kobject
867 set $kgm_kotype = ($kgm_portp->ip_object.io_bits & 0x00000fff)
868 if ($kgm_kotype == 1)
871 if ($kgm_kotype == 2)
874 if ($kgm_kotype == 3)
877 if ($kgm_kotype == 4)
880 if ($kgm_kotype == 5)
883 if ($kgm_kotype == 6)
886 if ($kgm_kotype == 7)
889 if ($kgm_kotype == 8)
892 if ($kgm_kotype == 9)
895 if ($kgm_kotype == 10)
898 if ($kgm_kotype == 11)
901 if ($kgm_kotype == 12)
904 if ($kgm_kotype == 13)
907 if ($kgm_kotype == 14)
910 if ($kgm_kotype == 15)
913 if ($kgm_kotype == 16)
916 if ($kgm_kotype == 17)
919 if ($kgm_kotype == 18)
922 if ($kgm_kotype == 19)
925 if ($kgm_kotype == 20)
928 if ($kgm_kotype == 21)
931 if ($kgm_kotype == 22)
934 if ($kgm_kotype == 23)
937 if ($kgm_kotype == 24)
940 if ($kgm_kotype == 25)
943 if ($kgm_kotype == 26)
946 if ($kgm_kotype == 27)
949 if ($kgm_kotype == 28)
952 if ($kgm_kotype == 29)
955 if ($kgm_kotype == 30)
958 if ($kgm_kotype == 31)
964 define showportdestproc
965 set $kgm_portp = (ipc_port_t)$arg0
966 set $kgm_spacep = $kgm_portp->data.receiver
967 # check against the previous cached value - this is slow
968 if ($kgm_spacep != $kgm_destspacep)
969 set $kgm_destprocp = (struct proc *)0
970 set $kgm_head_taskp = &default_pset.tasks
971 set $kgm_taskp = (Task *)($kgm_head_taskp->next)
972 while (($kgm_destprocp == 0) && ($kgm_taskp != $kgm_head_taskp))
973 set $kgm_destspacep = $kgm_taskp->itk_space
974 if ($kgm_destspacep == $kgm_spacep)
975 set $kgm_destprocp = (struct proc *)$kgm_taskp->bsd_info
977 set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next)
981 if $kgm_destprocp != 0
982 printf "%s(%d)\n", $kgm_destprocp->p_comm, $kgm_destprocp->p_pid
984 printf "task 0x%08x\n", $kgm_taskp
989 set $kgm_portp = (ipc_port_t)$arg0
990 set $kgm_spacep = $kgm_portp->data.receiver
991 if ($kgm_spacep == ipc_space_kernel)
992 showkobject $kgm_portp
994 if ($kgm_portp->ip_object.io_bits & 0x80000000)
995 printf "0x%08x ", $kgm_portp->ip_object.io_receiver_name
996 showportdestproc $kgm_portp
998 printf "0x%08x inactive-port\n", $kgm_portp
1003 define showportmember
1004 printf " 0x%08x ", $arg0
1005 set $kgm_portp = (ipc_port_t)$arg0
1006 printf "0x%08x ", $kgm_portp->ip_object.io_receiver_name
1007 if ($kgm_portp->ip_object.io_bits & 0x80000000)
1012 if ($kgm_portp->ip_object.io_bits & 0x7fff0000)
1017 printf "%5d ", $kgm_portp->ip_object.io_references
1018 printf "0x%08x ", &($kgm_portp->ip_messages)
1019 printf "0x%08x\n", $kgm_portp->ip_messages.data.port.msgcount
1023 printf "0x%08x ", $arg0
1024 set $kgm_portp = (ipc_port_t)$arg0
1025 printf "0x%08x ", &($kgm_portp->ip_messages)
1026 printf "0x%08x ", $kgm_portp->ip_object.io_receiver_name
1027 if ($kgm_portp->ip_object.io_bits & 0x80000000)
1033 printf "%5d ", $kgm_portp->ip_object.io_references
1034 set $kgm_destspacep = (ipc_space_t)0
1035 showportdest $kgm_portp
1036 set $kgm_kmsgp = (ipc_kmsg_t)$kgm_portp->ip_messages.data.port.messages.ikmq_base
1037 if $arg1 && $kgm_kmsgp
1039 showkmsgint $kgm_kmsgp
1040 set $kgm_kmsgheadp = $kgm_kmsgp
1041 set $kgm_kmsgp = $kgm_kmsgp->ikm_next
1042 while $kgm_kmsgp != $kgm_kmsgheadp
1043 showkmsgint $kgm_kmsgp
1044 set $kgm_kmsgp = $kgm_kmsgp->ikm_next
1050 printf "0x%08x ", $arg0
1051 set $kgm_psetp = (ipc_pset_t)$arg0
1052 printf "0x%08x ", &($kgm_psetp->ips_messages)
1053 printf "0x%08x ", $kgm_psetp->ips_object.io_receiver_name
1054 if ($kgm_psetp->ips_object.io_bits & 0x80000000)
1060 printf "%5d ", $kgm_psetp->ips_object.io_references
1061 set $kgm_sublinksp = &($kgm_psetp->ips_messages.data.set_queue.wqs_sublinks)
1062 set $kgm_wql = (wait_queue_link_t)$kgm_sublinksp->next
1064 while ( (queue_entry_t)$kgm_wql != (queue_entry_t)$kgm_sublinksp)
1065 set $kgm_portp = (ipc_port_t)((int)($kgm_wql->wql_element->wqe_queue) - ((int)$kgm_portoff))
1067 set $kgm_destspacep = (ipc_space_t)0
1068 showportdest $kgm_portp
1069 showportmemberheader
1072 showportmember $kgm_portp 0
1073 set $kgm_wql = (wait_queue_link_t)$kgm_wql->wql_sublinks.next
1076 printf "--n/e-- --n/e--\n"
1090 define showipcobject
1091 set $kgm_object = (ipc_object_t)$arg0
1092 if ($kgm_objectp->io_bits & 0x7fff0000)
1093 showpset $kgm_objectp
1095 showport $kgm_objectp
1100 set $kgm_mqueue = *(ipc_mqueue_t)$arg0
1101 set $kgm_psetoff = &(((ipc_pset_t)0)->ips_messages)
1102 set $kgm_portoff = &(((ipc_port_t)0)->ip_messages)
1103 if ($kgm_mqueue.data.set_queue.wqs_wait_queue.wq_issub)
1104 set $kgm_pset = (((int)$arg0) - ((int)$kgm_psetoff))
1106 showpsetint $kgm_pset 1
1109 set $kgm_port = (((int)$arg0) - ((int)$kgm_portoff))
1110 showportint $kgm_port 1
1115 set $kgm_zone = (struct zone *)$arg0
1117 printf "0x%08x ", $kgm_zone
1118 printf "%8d ",$kgm_zone->count
1119 printf "%8x ",$kgm_zone->cur_size
1120 printf "%8x ",$kgm_zone->max_size
1121 printf "%6d ",$kgm_zone->elem_size
1122 printf "%8x ",$kgm_zone->alloc_size
1123 printf "%s ",$kgm_zone->zone_name
1125 if ($kgm_zone->exhaustible)
1128 if ($kgm_zone->collectable)
1131 if ($kgm_zone->expandable)
1139 printf "ZONE COUNT TOT_SZ MAX_SZ ELT_SZ ALLOC_SZ NAME\n"
1140 set $kgm_zone_ptr = (struct zone *)first_zone
1141 while ($kgm_zone_ptr != 0)
1142 zprint_one $kgm_zone_ptr
1143 set $kgm_zone_ptr = $kgm_zone_ptr->next_zone
1148 | Routine to print a summary listing of all the kernel zones
1149 | The following is the syntax: