|
|
1.1 ! root 1: # ! 2: # Kernel gdb macros ! 3: # ! 4: # These gdb macros should be useful during kernel development in ! 5: # determining what's going on in the kernel. ! 6: # ! 7: # All the convenience variables used by these macros begin with $kgm_ ! 8: ! 9: set $kgm_vers = 2 ! 10: ! 11: echo Loading Kernel GDB Macros package. Type "help kgm" for more info.\n ! 12: ! 13: define kgm ! 14: printf "These are the kernel gdb macros version %d. ", $kgm_vers ! 15: echo Type "help kgm" for more info.\n ! 16: end ! 17: ! 18: document kgm ! 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> ! 24: | ! 25: | The following macros are available in this package: ! 26: | ! 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: | ! 35: | showtask Display status of the specified task ! 36: | showtaskacts Display the status of all activations in the task ! 37: | showtaskstacks Display all kernel stacks for all activations in the task ! 38: | showtaskvm Display status of the specified task's vm_map ! 39: | showtaskvme Display a summary list of the task's vm_map entries ! 40: | showtaskipc Display status of the specified task's ipc space ! 41: | showtaskrights Display a summary list of the task's ipc space entries ! 42: | ! 43: | showact Display status of the specified thread activation ! 44: | showactstack Display the kernel stack for the specified activation ! 45: | ! 46: | showmap Display the status of the specified vm_map ! 47: | showmapvme Display a summary list of the specified vm_map's entries ! 48: | ! 49: | showipc Display the status of the specified ipc space ! 50: | showrights Display a summary list of all the rights in an ipc space ! 51: | ! 52: | showpid Display the status of the process identified by pid ! 53: | showproc Display the status of the process identified by a proc pointer ! 54: | ! 55: | Type "help <macro>" for more specific help on a particular macro. ! 56: | Type "show user <macro>" to see what the macro is really doing. ! 57: end ! 58: ! 59: ! 60: define showactheader ! 61: printf " activation " ! 62: printf "thread pri state wait_queue wait_event\n" ! 63: end ! 64: ! 65: ! 66: define showactint ! 67: printf " 0x%08x ", $arg0 ! 68: set $kgm_actp = *(Thread_Activation *)$arg0 ! 69: if $kgm_actp.thread ! 70: set $kgm_thread = *$kgm_actp.thread ! 71: printf "0x%08x ", $kgm_actp.thread ! 72: printf "%3d ", $kgm_thread.sched_pri ! 73: set $kgm_state = $kgm_thread.state ! 74: if $kgm_state & 0x80 ! 75: printf "I" ! 76: end ! 77: if $kgm_state & 0x40 ! 78: printf "P" ! 79: end ! 80: if $kgm_state & 0x20 ! 81: printf "A" ! 82: end ! 83: if $kgm_state & 0x10 ! 84: printf "H" ! 85: end ! 86: if $kgm_state & 0x08 ! 87: printf "U" ! 88: end ! 89: if $kgm_state & 0x04 ! 90: printf "R" ! 91: end ! 92: if $kgm_state & 0x02 ! 93: printf "S" ! 94: end ! 95: if $kgm_state & 0x01 ! 96: printf "W\t" ! 97: printf "0x%08x ", $kgm_thread.wait_queue ! 98: output /a $kgm_thread.wait_event ! 99: end ! 100: if $arg1 != 0 ! 101: if ($kgm_thread.kernel_stack != 0) ! 102: set $mysp = $kgm_actp->mact.pcb.ss.r1 ! 103: while ($mysp != 0) && (($mysp & 0xf) == 0) ! 104: printf "\n\t\t\t" ! 105: output /a * ($mysp + 8) ! 106: set $mysp = * $mysp ! 107: end ! 108: else ! 109: printf "\n\t\t\tcontinuation=" ! 110: output /a $kgm_thread.continuation ! 111: end ! 112: printf "\n" ! 113: else ! 114: printf "\n" ! 115: end ! 116: end ! 117: end ! 118: ! 119: define showact ! 120: showactheader ! 121: showactint $arg0 0 ! 122: end ! 123: document showact ! 124: | Routine to print out the state of a specific thread activation. ! 125: | The following is the syntax: ! 126: | (gdb) showact <activation> ! 127: end ! 128: ! 129: ! 130: define showactstack ! 131: showactheader ! 132: showactint $arg0 1 ! 133: end ! 134: document showactstack ! 135: | Routine to print out the stack of a specific thread activation. ! 136: | The following is the syntax: ! 137: | (gdb) showactstack <activation> ! 138: end ! 139: ! 140: ! 141: define showallacts ! 142: set $kgm_head_taskp = &default_pset.tasks ! 143: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 144: while $kgm_taskp != $kgm_head_taskp ! 145: showtaskheader ! 146: showtaskint $kgm_taskp ! 147: showactheader ! 148: set $kgm_head_actp = &($kgm_taskp->thr_acts) ! 149: set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next) ! 150: while $kgm_actp != $kgm_head_actp ! 151: showactint $kgm_actp 0 ! 152: set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next) ! 153: end ! 154: printf "\n" ! 155: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 156: end ! 157: end ! 158: document showallacts ! 159: | Routine to print out a summary listing of all the thread activations. ! 160: | The following is the syntax: ! 161: | (gdb) showallacts ! 162: end ! 163: ! 164: ! 165: define showallstacks ! 166: set $kgm_head_taskp = &default_pset.tasks ! 167: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 168: while $kgm_taskp != $kgm_head_taskp ! 169: showtaskheader ! 170: showtaskint $kgm_taskp ! 171: set $kgm_head_actp = &($kgm_taskp->thr_acts) ! 172: set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next) ! 173: while $kgm_actp != $kgm_head_actp ! 174: showactheader ! 175: showactint $kgm_actp 1 ! 176: set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next) ! 177: end ! 178: printf "\n" ! 179: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 180: end ! 181: end ! 182: document showallstacks ! 183: | Routine to print out a summary listing of all the thread kernel stacks. ! 184: | The following is the syntax: ! 185: | (gdb) showallstacks ! 186: end ! 187: ! 188: ! 189: ! 190: ! 191: define showmapheader ! 192: printf "vm_map pmap vm_size " ! 193: printf "#ents rpage hint first_free\n" ! 194: end ! 195: ! 196: define showvmeheader ! 197: printf " entry start " ! 198: printf "prot #page object offset\n" ! 199: end ! 200: ! 201: define showvmint ! 202: set $kgm_mapp = (vm_map_t)$arg0 ! 203: set $kgm_map = *$kgm_mapp ! 204: printf "0x%08x ", $arg0 ! 205: printf "0x%08x ", $kgm_map.pmap ! 206: printf "0x%08x ", $kgm_map.size ! 207: printf "%3d ", $kgm_map.hdr.nentries ! 208: printf "%5d ", $kgm_map.pmap->stats.resident_count ! 209: printf "0x%08x ", $kgm_map.hint ! 210: printf "0x%08x\n", $kgm_map.first_free ! 211: if $arg1 != 0 ! 212: showvmeheader ! 213: set $kgm_head_vmep = &($kgm_mapp->hdr.links) ! 214: set $kgm_vmep = $kgm_map.hdr.links.next ! 215: while (($kgm_vmep != 0) && ($kgm_vmep != $kgm_head_vmep)) ! 216: set $kgm_vme = *$kgm_vmep ! 217: printf " 0x%08x ", $kgm_vmep ! 218: printf "0x%08x ", $kgm_vme.links.start ! 219: printf "%1x", $kgm_vme.protection ! 220: printf "%1x", $kgm_vme.max_protection ! 221: if $kgm_vme.inheritance == 0x0 ! 222: printf "S" ! 223: end ! 224: if $kgm_vme.inheritance == 0x1 ! 225: printf "C" ! 226: end ! 227: if $kgm_vme.inheritance == 0x2 ! 228: printf "-" ! 229: end ! 230: if $kgm_vme.inheritance == 0x3 ! 231: printf "D" ! 232: end ! 233: if $kgm_vme.is_sub_map ! 234: printf "s " ! 235: else ! 236: if $kgm_vme.needs_copy ! 237: printf "n " ! 238: else ! 239: printf " " ! 240: end ! 241: end ! 242: printf "%5d ",($kgm_vme.links.end - $kgm_vme.links.start) >> 12 ! 243: printf "0x%08x ", $kgm_vme.object.vm_object ! 244: printf "0x%08x\n", $kgm_vme.offset ! 245: set $kgm_vmep = $kgm_vme.links.next ! 246: end ! 247: end ! 248: printf "\n" ! 249: end ! 250: ! 251: ! 252: define showmapvme ! 253: showmapheader ! 254: showvmint $arg0 1 ! 255: end ! 256: document showmapvme ! 257: | Routine to print out a summary listing of all the entries in a vm_map ! 258: | The following is the syntax: ! 259: | (gdb) showmapvme <vm_map> ! 260: end ! 261: ! 262: ! 263: define showmap ! 264: showmapheader ! 265: showvmint $arg0 0 ! 266: end ! 267: document showmap ! 268: | Routine to print out a summary description of a vm_map ! 269: | The following is the syntax: ! 270: | (gdb) showmap <vm_map> ! 271: end ! 272: ! 273: define showallvm ! 274: set $kgm_head_taskp = &default_pset.tasks ! 275: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 276: while $kgm_taskp != $kgm_head_taskp ! 277: showtaskheader ! 278: showmapheader ! 279: showtaskint $kgm_taskp ! 280: showvmint $kgm_taskp->map 0 ! 281: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 282: end ! 283: end ! 284: document showallvm ! 285: | Routine to print a summary listing of all the vm maps ! 286: | The following is the syntax: ! 287: | (gdb) showallvm ! 288: end ! 289: ! 290: ! 291: define showallvme ! 292: set $kgm_head_taskp = &default_pset.tasks ! 293: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 294: while $kgm_taskp != $kgm_head_taskp ! 295: showtaskheader ! 296: showmapheader ! 297: showtaskint $kgm_taskp ! 298: showvmint $kgm_taskp->map 1 ! 299: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 300: end ! 301: end ! 302: document showallvme ! 303: | Routine to print a summary listing of all the vm map entries ! 304: | The following is the syntax: ! 305: | (gdb) showallvme ! 306: end ! 307: ! 308: ! 309: define showipcheader ! 310: printf "ipc_space is_table table_next " ! 311: printf "flags tsize splaytree splaybase\n" ! 312: end ! 313: ! 314: define showipceheader ! 315: printf " entry name " ! 316: printf "rite urefs object request\n" ! 317: end ! 318: ! 319: define showipceint ! 320: set $kgm_ie = *(ipc_entry_t)$arg0 ! 321: printf " 0x%08x ", $arg0 ! 322: printf "0x%08x ", $arg1 ! 323: if $kgm_ie.ie_bits & 0x00010000 ! 324: if $kgm_ie.ie_bits & 0x00020000 ! 325: printf " SR" ! 326: else ! 327: printf " S" ! 328: end ! 329: else ! 330: if $kgm_ie.ie_bits & 0x00020000 ! 331: printf " R" ! 332: end ! 333: end ! 334: if $kgm_ie.ie_bits & 0x00040000 ! 335: printf " O" ! 336: end ! 337: if $kgm_ie.ie_bits & 0x00080000 ! 338: printf "SET" ! 339: end ! 340: if $kgm_ie.ie_bits & 0x00100000 ! 341: printf " D" ! 342: end ! 343: if $kgm_ie.ie_bits & 0x00800000 ! 344: printf "c " ! 345: else ! 346: printf " " ! 347: end ! 348: printf "%5d ", $kgm_ie.ie_bits & 0xffff ! 349: printf "0x%08x ", $kgm_ie.ie_object ! 350: printf "0x%08x\n", $kgm_ie.index.request ! 351: end ! 352: ! 353: define showipcint ! 354: set $kgm_isp = (ipc_space_t)$arg0 ! 355: set $kgm_is = *$kgm_isp ! 356: printf "0x%08x ", $arg0 ! 357: printf "0x%08x ", $kgm_is.is_table ! 358: printf "0x%08x ", $kgm_is.is_table_next ! 359: if $kgm_is.is_growing != 0 ! 360: printf "G" ! 361: else ! 362: printf " " ! 363: end ! 364: if $kgm_is.is_fast != 0 ! 365: printf "F" ! 366: else ! 367: printf " " ! 368: end ! 369: if $kgm_is.is_active != 0 ! 370: printf "A " ! 371: else ! 372: printf " " ! 373: end ! 374: printf "%5d ", $kgm_is.is_table_size ! 375: printf "0x%08x ", $kgm_is.is_tree_total ! 376: printf "0x%08x\n", &$kgm_isp->is_tree ! 377: if $arg1 != 0 ! 378: showipceheader ! 379: set $kgm_iindex = 0 ! 380: set $kgm_iep = $kgm_is.is_table ! 381: while ( $kgm_iindex < $kgm_is.is_table_size ) ! 382: set $kgm_ie = *$kgm_iep ! 383: if $kgm_ie.ie_bits & 0x001f0000 ! 384: set $kgm_name = (($kgm_iindex << 8)|($kgm_ie.ie_bits >> 24)) ! 385: showipceint $kgm_iep $kgm_name ! 386: end ! 387: set $kgm_iindex = $kgm_iindex + 1 ! 388: set $kgm_iep = &($kgm_is.is_table[$kgm_iindex]) ! 389: end ! 390: if $kgm_is.is_tree_total ! 391: printf "Still need to write tree traversal\n" ! 392: end ! 393: end ! 394: printf "\n" ! 395: end ! 396: ! 397: ! 398: define showipc ! 399: set $kgm_isp = (ipc_space_t)$arg0 ! 400: showipcheader ! 401: showipcint $kgm_isp 0 ! 402: end ! 403: document showipc ! 404: | Routine to print the status of the specified ipc space ! 405: | The following is the syntax: ! 406: | (gdb) showipc <ipc_space> ! 407: end ! 408: ! 409: define showrights ! 410: set $kgm_isp = (ipc_space_t)$arg0 ! 411: showipcheader ! 412: showipcint $kgm_isp 1 ! 413: end ! 414: document showrights ! 415: | Routine to print a summary list of all the rights in a specified ipc space ! 416: | The following is the syntax: ! 417: | (gdb) showrights <ipc_space> ! 418: end ! 419: ! 420: ! 421: define showtaskipc ! 422: set $kgm_taskp = (task_t)$arg0 ! 423: showtaskheader ! 424: showipcheader ! 425: showtaskint $kgm_taskp ! 426: showipcint $kgm_taskp->itk_space 0 ! 427: end ! 428: document showtaskipc ! 429: | Routine to print the status of the ipc space for a task ! 430: | The following is the syntax: ! 431: | (gdb) showtaskipc <task> ! 432: end ! 433: ! 434: ! 435: define showtaskrights ! 436: set $kgm_taskp = (task_t)$arg0 ! 437: showtaskheader ! 438: showipcheader ! 439: showtaskint $kgm_taskp ! 440: showipcint $kgm_taskp->itk_space 1 ! 441: end ! 442: document showtaskrights ! 443: | Routine to print a summary listing of all the ipc rights for a task ! 444: | The following is the syntax: ! 445: | (gdb) showtaskrights <task> ! 446: end ! 447: ! 448: define showallipc ! 449: set $kgm_head_taskp = &default_pset.tasks ! 450: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 451: while $kgm_taskp != $kgm_head_taskp ! 452: showtaskheader ! 453: showipcheader ! 454: showtaskint $kgm_taskp ! 455: showipcint $kgm_taskp->itk_space 0 ! 456: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 457: end ! 458: end ! 459: document showallipc ! 460: | Routine to print a summary listing of all the ipc spaces ! 461: | The following is the syntax: ! 462: | (gdb) showallipc ! 463: end ! 464: ! 465: ! 466: define showallrights ! 467: set $kgm_head_taskp = &default_pset.tasks ! 468: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 469: while $kgm_taskp != $kgm_head_taskp ! 470: showtaskheader ! 471: showipcheader ! 472: showtaskint $kgm_taskp ! 473: showipcint $kgm_taskp->itk_space 1 ! 474: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 475: end ! 476: end ! 477: document showallrights ! 478: | Routine to print a summary listing of all the ipc rights ! 479: | The following is the syntax: ! 480: | (gdb) showallrights ! 481: end ! 482: ! 483: ! 484: define showtaskvm ! 485: set $kgm_taskp = (task_t)$arg0 ! 486: showtaskheader ! 487: showmapheader ! 488: showtaskint $kgm_taskp ! 489: showvmint $kgm_taskp->map 0 ! 490: end ! 491: document showtaskvm ! 492: | Routine to print out a summary description of a task's vm_map ! 493: | The following is the syntax: ! 494: | (gdb) showtaskvm <task> ! 495: end ! 496: ! 497: define showtaskvme ! 498: set $kgm_taskp = (task_t)$arg0 ! 499: showtaskheader ! 500: showmapheader ! 501: showtaskint $kgm_taskp ! 502: showvmint $kgm_taskp->map 1 ! 503: end ! 504: document showtaskvme ! 505: | Routine to print out a summary listing of a task's vm_map_entries ! 506: | The following is the syntax: ! 507: | (gdb) showtaskvme <task> ! 508: end ! 509: ! 510: ! 511: define showtaskheader ! 512: printf "task vm_map ipc_space #acts " ! 513: showprocheader ! 514: end ! 515: ! 516: ! 517: define showtaskint ! 518: set $kgm_task = *(Task *)$arg0 ! 519: printf "0x%08x ", $arg0 ! 520: printf "0x%08x ", $kgm_task.map ! 521: printf "0x%08x ", $kgm_task.itk_space ! 522: printf "%3d ", $kgm_task.thr_act_count ! 523: showprocint $kgm_task.bsd_info ! 524: end ! 525: ! 526: define showtask ! 527: showtaskheader ! 528: showtaskint $arg0 ! 529: end ! 530: document showtask ! 531: | Routine to print out info about a task. ! 532: | The following is the syntax: ! 533: | (gdb) showtask <task> ! 534: end ! 535: ! 536: ! 537: define showtaskacts ! 538: showtaskheader ! 539: set $kgm_taskp = (Task *)$arg0 ! 540: showtaskint $kgm_taskp ! 541: showactheader ! 542: set $kgm_head_actp = &($kgm_taskp->thr_acts) ! 543: set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next) ! 544: while $kgm_actp != $kgm_head_actp ! 545: showactint $kgm_actp 0 ! 546: set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next) ! 547: end ! 548: end ! 549: document showtaskacts ! 550: | Routine to print a summary listing of the activations in a task ! 551: | The following is the syntax: ! 552: | (gdb) showtaskacts <task> ! 553: end ! 554: ! 555: ! 556: define showtaskstacks ! 557: showtaskheader ! 558: set $kgm_taskp = (Task *)$arg0 ! 559: showtaskint $kgm_taskp ! 560: set $kgm_head_actp = &($kgm_taskp->thr_acts) ! 561: set $kgm_actp = (Thread_Activation *)($kgm_taskp->thr_acts.next) ! 562: while $kgm_actp != $kgm_head_actp ! 563: showactheader ! 564: showactint $kgm_actp 1 ! 565: set $kgm_actp = (Thread_Activation *)($kgm_actp->thr_acts.next) ! 566: end ! 567: end ! 568: document showtaskstacks ! 569: | Routine to print a summary listing of the activations in a task and their stacks ! 570: | The following is the syntax: ! 571: | (gdb) showtaskstacks <task> ! 572: end ! 573: ! 574: ! 575: define showalltasks ! 576: showtaskheader ! 577: set $kgm_head_taskp = &default_pset.tasks ! 578: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 579: while $kgm_taskp != $kgm_head_taskp ! 580: showtaskint $kgm_taskp ! 581: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 582: end ! 583: end ! 584: document showalltasks ! 585: | Routine to print a summary listing of all the tasks ! 586: | The following is the syntax: ! 587: | (gdb) showalltasks ! 588: end ! 589: ! 590: ! 591: define showprocheader ! 592: printf " pid proc command\n" ! 593: end ! 594: ! 595: define showprocint ! 596: set $kgm_procp = (struct proc *)$arg0 ! 597: if $kgm_procp != 0 ! 598: printf "%5d ", $kgm_procp->p_pid ! 599: printf "0x%08x ", $kgm_procp ! 600: printf "%s\n", $kgm_procp->p_comm ! 601: else ! 602: printf " *0* 0x00000000 --\n" ! 603: end ! 604: end ! 605: ! 606: define showpid ! 607: showtaskheader ! 608: set $kgm_head_taskp = &default_pset.tasks ! 609: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 610: while $kgm_taskp != $kgm_head_taskp ! 611: set $kgm_procp = (struct proc *)$kgm_taskp->bsd_info ! 612: if (($kgm_procp != 0) && ($kgm_procp->p_pid == $arg0)) ! 613: showtaskint $kgm_taskp ! 614: set $kgm_taskp = $kgm_head_taskp ! 615: else ! 616: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 617: end ! 618: end ! 619: end ! 620: document showpid ! 621: | Routine to print a summary listing of all the tasks ! 622: | The following is the syntax: ! 623: | (gdb) showalltasks ! 624: end ! 625: ! 626: define showproc ! 627: showtaskheader ! 628: set $kgm_procp = (struct proc *)$arg0 ! 629: showtaskint $kgm_procp->task $arg1 $arg2 ! 630: end ! 631: ! 632: ! 633: define kdb ! 634: set switch_debugger=1 ! 635: continue ! 636: end ! 637: document kdb ! 638: | kdb - Switch to the inline kernel debugger ! 639: | ! 640: | usage: kdb ! 641: | ! 642: | The kdb macro allows you to invoke the inline kernel debugger. ! 643: end ! 644: ! 645: define showpsetheader ! 646: printf "portset waitqueue recvname " ! 647: printf "flags refs recvspace process\n" ! 648: end ! 649: ! 650: define showportheader ! 651: printf "port mqueue recvname " ! 652: printf "flags refs recvspace process\n" ! 653: end ! 654: ! 655: define showportmemberheader ! 656: printf " port recvname " ! 657: printf "flags refs mqueue msgcount\n" ! 658: end ! 659: ! 660: define showkmsgheader ! 661: printf " kmsg size " ! 662: printf "disp msgid remote-port local-port\n" ! 663: end ! 664: ! 665: define showkmsgint ! 666: printf " 0x%08x ", $arg0 ! 667: set $kgm_kmsgh = ((ipc_kmsg_t)$arg0)->ikm_header ! 668: printf "0x%08x ", $kgm_kmsgh.msgh_size ! 669: if (($kgm_kmsgh.msgh_bits & 0xff) == 19) ! 670: printf "rC" ! 671: else ! 672: printf "rM" ! 673: end ! 674: if (($kgm_kmsgh.msgh_bits & 0xff00) == (19 < 8)) ! 675: printf "lC" ! 676: else ! 677: printf "lM" ! 678: end ! 679: if ($kgm_kmsgh.msgh_bits & 0xf0000000) ! 680: printf "c" ! 681: else ! 682: printf "s" ! 683: end ! 684: printf "%5d ", $kgm_kmsgh.msgh_msgid ! 685: printf "0x%08x ", $kgm_kmsgh.msgh_remote_port ! 686: printf "0x%08x\n", $kgm_kmsgh.msgh_local_port ! 687: end ! 688: ! 689: define showprocforspace ! 690: set $kgm_spacep = (ipc_space_t)$arg0 ! 691: set $kgm_found = 0 ! 692: set $kgm_head_taskp = &default_pset.tasks ! 693: set $kgm_taskp = (Task *)($kgm_head_taskp->next) ! 694: while (!$kgm_found && ($kgm_taskp != $kgm_head_taskp)) ! 695: if ($kgm_taskp->itk_space == $kgm_spacep) ! 696: set $kgm_found = 1 ! 697: set $kgm_procp = (struct proc *)$kgm_taskp->bsd_info ! 698: if $kgm_procp != 0 ! 699: printf "%s\n", $kgm_procp->p_comm ! 700: else ! 701: printf "task 0x%08x\n", $kgm_taskp ! 702: end ! 703: end ! 704: set $kgm_taskp = (Task *)($kgm_taskp->pset_tasks.next) ! 705: end ! 706: end ! 707: ! 708: define showportmember ! 709: printf " 0x%08x ", $arg0 ! 710: set $kgm_portp = (ipc_port_t)$arg0 ! 711: printf "0x%08x ", $kgm_portp->ip_object.io_receiver_name ! 712: if ($kgm_portp->ip_object.io_bits & 0x80000000) ! 713: printf "A" ! 714: else ! 715: printf " " ! 716: end ! 717: if ($kgm_portp->ip_object.io_bits & 0x7fff0000) ! 718: printf "Set " ! 719: else ! 720: printf "Port" ! 721: end ! 722: printf "%5d ", $kgm_portp->ip_object.io_references ! 723: printf "0x%08x ", &($kgm_portp->ip_messages) ! 724: printf "0x%08x\n", $kgm_portp->ip_messages.data.port.msgcount ! 725: end ! 726: ! 727: define showportint ! 728: printf "0x%08x ", $arg0 ! 729: set $kgm_portp = (ipc_port_t)$arg0 ! 730: printf "0x%08x ", &($kgm_portp->ip_messages) ! 731: printf "0x%08x ", $kgm_portp->ip_object.io_receiver_name ! 732: if ($kgm_portp->ip_object.io_bits & 0x80000000) ! 733: printf "A" ! 734: else ! 735: printf "D" ! 736: end ! 737: if ($kgm_portp->ip_object.io_bits & 0x7fff0000) ! 738: printf "Set " ! 739: else ! 740: printf "Port" ! 741: end ! 742: printf "%5d ", $kgm_portp->ip_object.io_references ! 743: printf "0x%08x ", $kgm_portp->data.receiver ! 744: showprocforspace $kgm_portp->data.receiver ! 745: set $kgm_kmsgp = (ipc_kmsg_t)$kgm_portp->ip_messages.data.port.messages.ikmq_base ! 746: if $arg1 && $kgm_kmsgp ! 747: showkmsgheader ! 748: showkmsgint $kgm_kmsgp ! 749: set $kgm_kmsgheadp = $kgm_kmsgp ! 750: set $kgm_kmsgp = $kgm_kmsgp->ikm_next ! 751: while $kgm_kmsgp != $kgm_kmsgheadp ! 752: showkmsgint $kgm_kmsgp ! 753: set $kgm_kmsgp = $kgm_kmsgp->ikm_next ! 754: end ! 755: end ! 756: end ! 757: ! 758: define showpsetint ! 759: printf "0x%08x ", $arg0 ! 760: set $kgm_psetp = (ipc_pset_t)$arg0 ! 761: printf "0x%08x ", &($kgm_psetp->ips_messages) ! 762: printf "0x%08x ", $kgm_psetp->ips_object.io_receiver_name ! 763: if ($kgm_psetp->ips_object.io_bits & 0x80000000) ! 764: printf "A" ! 765: else ! 766: printf "D" ! 767: end ! 768: if ($kgm_psetp->ips_object.io_bits & 0x7fff0000) ! 769: printf "Set " ! 770: else ! 771: printf "Port" ! 772: end ! 773: printf "%5d ", $kgm_psetp->ips_object.io_references ! 774: set $kgm_sublinksp = &($kgm_psetp->ips_messages.data.set_queue.wqs_sublinks) ! 775: set $kgm_wql = (wait_queue_link_t)$kgm_sublinksp->next ! 776: set $kgm_found = 0 ! 777: while ( (queue_entry_t)$kgm_wql != (queue_entry_t)$kgm_sublinksp) ! 778: set $kgm_portp = (ipc_port_t)((int)($kgm_wql->wql_element->wqe_queue) - ((int)$kgm_portoff)) ! 779: if !$kgm_found ! 780: printf "0x%08x ", $kgm_portp->data.receiver ! 781: showprocforspace $kgm_portp->data.receiver ! 782: showportmemberheader ! 783: set $kgm_found = 1 ! 784: end ! 785: showportmember $kgm_portp 0 ! 786: set $kgm_wql = (wait_queue_link_t)$kgm_wql->wql_sublinks.next ! 787: end ! 788: if !$kgm_found ! 789: printf "--n/e-- --n/e--\n" ! 790: end ! 791: end ! 792: ! 793: define showpset ! 794: showpsetheader ! 795: showpsetint $arg0 1 ! 796: end ! 797: ! 798: define showport ! 799: showportheader ! 800: showportint $arg0 1 ! 801: end ! 802: ! 803: define showmqueue ! 804: set $kgm_mqueue = *(ipc_mqueue_t)$arg0 ! 805: set $kgm_psetoff = &(((ipc_pset_t)0)->ips_messages) ! 806: set $kgm_portoff = &(((ipc_port_t)0)->ip_messages) ! 807: if ($kgm_mqueue.data.set_queue.wqs_wait_queue.wq_issub) ! 808: set $kgm_pset = (((int)$arg0) - ((int)$kgm_psetoff)) ! 809: showpsetheader ! 810: showpsetint $kgm_pset 1 ! 811: else ! 812: showportheader ! 813: set $kgm_port = (((int)$arg0) - ((int)$kgm_portoff)) ! 814: showportint $kgm_port 1 ! 815: end ! 816: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.