Annotation of kernel/.gdbinit, revision 1.1

1.1     ! root        1: ##
        !             2: # Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3: #
        !             4: # @APPLE_LICENSE_HEADER_START@
        !             5: # 
        !             6: # Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7: # Reserved.  This file contains Original Code and/or Modifications of
        !             8: # Original Code as defined in and that are subject to the Apple Public
        !             9: # Source License Version 1.1 (the "License").  You may not use this file
        !            10: # except in compliance with the License.  Please obtain a copy of the
        !            11: # License at http://www.apple.com/publicsource and read it before using
        !            12: # this file.
        !            13: # 
        !            14: # The Original Code and all software distributed under the License are
        !            15: # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16: # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17: # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18: # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19: # License for the specific language governing rights and limitations
        !            20: # under the License.
        !            21: # 
        !            22: # @APPLE_LICENSE_HEADER_END@
        !            23: ##
        !            24: 
        !            25: #
        !            26: #      .gdbinit for kernel debugging
        !            27: #
        !            28: #      Created and Maintained by :
        !            29: #              Umesh Vaishampayan  ([email protected])
        !            30: #
        !            31: #   Contributions from:
        !            32: #              Conrad Minshall ([email protected])
        !            33: #              Eryk Vershen, Tom Mason
        !            34: #
        !            35: 
        !            36: # Set prettyprinting of structures
        !            37: set print pretty
        !            38: # Set printing of unions interior to structures
        !            39: set print union
        !            40: 
        !            41: # Unlimited page size.
        !            42: set height 0
        !            43: 
        !            44: #
        !            45: # Macros to print stacktrace on PPC
        !            46: # Typical usage :
        !            47: #              kstack <thread-addr>
        !            48: #              tstack
        !            49: #              tstack
        !            50: #              ...
        !            51: #
        !            52: # For the active_thread(), following would be slightly faster
        !            53: #              ststack
        !            54: #              tstack
        !            55: #              tstack
        !            56: #              ....
        !            57: #
        !            58: define kstack
        !            59:     set $s=(thread_t)$arg0
        !            60:     if (($s->kernel_stack) == 0)
        !            61:        echo "no kernel stack\n"
        !            62:     else
        !            63:        if $arg0 == cpu_data->active_thread
        !            64:            ststack
        !            65:        else
        !            66:            set $f=((struct ppc_kernel_state *)(($s->kernel_stack)+0x3f94))->r1
        !            67:            p/x $f
        !            68:            x/i ((struct ppc_kernel_state *)(($s->kernel_stack)+0x3f94))->lr
        !            69:        end
        !            70:     end
        !            71: end
        !            72: document kstack
        !            73:        Start a stack backtrace for the thread passed in as first argument
        !            74:        must be called before calling 'tstack'
        !            75:        (for PPC only)
        !            76: end
        !            77: 
        !            78: define ststack
        !            79:         set $f=(long*)*$r1
        !            80:        p/x $f
        !            81:        x/i *($f+2)-4
        !            82: end
        !            83: document ststack
        !            84:        Start a stack backtrace for the active_thread()
        !            85:        must be called before calling 'tstack'
        !            86:        (for PPC only)
        !            87: end
        !            88: 
        !            89: define tstack
        !            90:     if (*(long*)$f) != 0
        !            91:         set $f=*(long*)$f
        !            92:         p/x $f
        !            93:         x/i *($f+8)-4
        !            94:     else
        !            95:         echo end of stack\n
        !            96:     end
        !            97: end
        !            98: document tstack
        !            99:        Print top of the stack and pop a frame
        !           100:        must be called after 'kstack' or 'ststack'
        !           101:        (for PPC only)
        !           102: end
        !           103: 
        !           104: #
        !           105: # Other stack related macros
        !           106: #
        !           107: 
        !           108: define tsaved
        !           109:        p/x *(struct ppc_saved_state *)($f+0x90)
        !           110: end
        !           111: document tsaved
        !           112:        Print the saved state for the current frame.
        !           113:        must be used after 'tstack' or 'kstack' or ststack'.
        !           114: end
        !           115: 
        !           116: #
        !           117: # Macros to print addresses as various structures
        !           118: #
        !           119: define pcb
        !           120:     p *(pcb_t)$arg0
        !           121: end
        !           122: document pcb
        !           123:        Print first argument as a pcb_t.
        !           124: end
        !           125: 
        !           126: define pth
        !           127:     p *(thread_t)$arg0
        !           128: end
        !           129: document pth
        !           130:        Print first argument as a thread_t.
        !           131: end
        !           132: 
        !           133: define pswapf
        !           134:        p *((thread_t)$arg0)->swap_func
        !           135: end
        !           136: document pswapf
        !           137:        Print the swap_func of a thread
        !           138: end
        !           139: 
        !           140: define pta
        !           141:     p *(task_t)$arg0
        !           142: end
        !           143: document pta
        !           144:        Print first argument as a task_t.
        !           145: end
        !           146: 
        !           147: define dmapent
        !           148:     echo "  map_entry"
        !           149:     p $arg0
        !           150:     echo "    start "
        !           151:     p ((vm_map_entry_t)$arg0)->links.start
        !           152:     echo "    end "
        !           153:     p ((vm_map_entry_t)$arg0)->links.end
        !           154:     if ( $arg0->is_a_map != 0)
        !           155:         echo "    object is a map"\n
        !           156:         echo "    share"
        !           157:        p $arg0->object.share_map
        !           158:         echo "    offset"
        !           159:        p $arg0->offset
        !           160:     end
        !           161:     if ( $arg0->is_shared != 0)
        !           162:         echo "    region is shared"\n
        !           163:     end
        !           164:     if ( $arg0->is_sub_map != 0)
        !           165:         echo "    object is a sub map"\n
        !           166:     end
        !           167:     if ( $arg0->copy_on_write != 0)
        !           168:         echo "    data is copy on write"\n
        !           169:     end
        !           170:     if ( $arg0->in_transition != 0)
        !           171:         echo "    Entry is being changed"\n
        !           172:     end
        !           173:     if ( $arg0->needs_wakeup != 0)
        !           174:         echo "    Waiters on in_transition"\n
        !           175:     end
        !           176:     if ( $arg0->needs_copy != 0)
        !           177:         echo "    object needs to be copied"\n
        !           178:     end
        !           179:     echo "    protection "
        !           180:     p ((vm_map_entry_t)$arg0)->protection
        !           181:     echo "    max protection "
        !           182:     p ((vm_map_entry_t)$arg0)->max_protection
        !           183:     echo "    inheritance "
        !           184:     p ((vm_map_entry_t)$arg0)->inheritance
        !           185:     echo "    wired count "
        !           186:     p ((vm_map_entry_t)$arg0)->wired_count
        !           187:     echo "    user_wired_count "
        !           188:     p ((vm_map_entry_t)$arg0)->user_wired_count
        !           189: end
        !           190: document dmapent
        !           191:        Pretty print the first argument as a vm_map_entry_t.
        !           192: end
        !           193: 
        !           194: define dmap
        !           195:     set $vmmapptr=$arg0
        !           196:     set $iter=0
        !           197:     if (((vm_map_t)$vmmapptr)->is_main_map != 0)
        !           198:        echo "    this is a main map"\n
        !           199:     end
        !           200:     echo "    start "
        !           201:     p ((vm_map_t)$vmmapptr)->hdr.links.start
        !           202:     echo "    end "
        !           203:     p ((vm_map_t)$vmmapptr)->hdr.links.end
        !           204:     if ((vm_map_t)$vmmapptr->entries_pageable != 0)
        !           205:         echo "    map entries are pageable"\n
        !           206:     else 
        !           207:         echo "    map entries are NOT pageable"\n
        !           208:     end
        !           209:     echo "    size "
        !           210:     p ((vm_map_t)$vmmapptr)->size
        !           211:     echo "    pmap "
        !           212:     p ((vm_map_t)$vmmapptr)->pmap
        !           213:     set $mapentptr=$vmmapptr->hdr.links.next
        !           214:     echo "    number of map entries "
        !           215:     p ((vm_map_t)$vmmapptr)->hdr.nentries
        !           216:     while ($iter < ((vm_map_t)$arg0)->hdr.nentries)
        !           217:        echo \n
        !           218:        echo "  entry "
        !           219:        p $iter
        !           220:        dmapent $mapentptr
        !           221:        set $mapentptr=((vm_map_entry_t)$mapentptr)->links.next
        !           222:        set $iter=$iter+1
        !           223:     end
        !           224: end
        !           225: document dmap
        !           226:        Pretty print the first argument as a vm_map_t.
        !           227: end
        !           228: 
        !           229: #
        !           230: # List all the tasks.
        !           231: # Print interesting information in the following order :
        !           232: #      Name of the task    [task->proc->p_comm]
        !           233: #      The task                        [task]
        !           234: #      map                                     [task->map]
        !           235: #
        !           236: define tasks
        !           237:     set $numtasks=default_pset->task_count
        !           238:     set $iter=0
        !           239:     set $taskptr=default_pset->tasks.next
        !           240:     while ($iter < $numtasks)
        !           241:        if ((((struct task *)($taskptr))->proc) != 0)
        !           242:            p (char *)(((struct task *)($taskptr))->proc->p_comm)
        !           243:                p $taskptr
        !           244:                p ((struct task *)($taskptr))->map
        !           245:        end
        !           246:        set $taskptr=((struct task *)($taskptr))->pset_tasks.next
        !           247:        set $iter=$iter+1
        !           248:     end
        !           249: end
        !           250: document tasks
        !           251:        Print all the tasks and maps associated with each one of them.
        !           252: end
        !           253: 
        !           254: #
        !           255: # List all the threads.
        !           256: # Print interesting information in the following order :
        !           257: #      Name of the task    [thread->task->proc->p_comm]
        !           258: #      The thread                      [thread]
        !           259: #      
        !           260: define threads
        !           261:     set $numthreads=default_pset->thread_count
        !           262:     set $iter=0
        !           263:     set $threadptr=default_pset->threads.next
        !           264:     while ($iter < $numthreads)
        !           265:         if ((((struct thread *)($threadptr))->task->proc) != 0) 
        !           266:                p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           267:                p $threadptr
        !           268:            end
        !           269:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           270:        set $iter=$iter+1
        !           271:     end
        !           272: end
        !           273: document threads
        !           274:        Print all the threads and name of the task associated with each one of them.
        !           275: end
        !           276: 
        !           277: #
        !           278: # List all the threads with a nonzero value of kernel_stack.
        !           279: # Print interesting information in the following order :
        !           280: #      Name of the task    [thread->task->proc->p_comm]
        !           281: #      The thread                      [thread]
        !           282: #
        !           283: define kstackthreads
        !           284:     set $numthreads=default_pset->thread_count
        !           285:     set $iter=0
        !           286:     set $threadptr=default_pset->threads.next
        !           287:     while ($iter < $numthreads)
        !           288:        if ((((struct thread *)($threadptr))->kernel_stack) != 0)
        !           289:            if ((((struct thread *)($threadptr))->task->proc) != 0)
        !           290:                p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           291:                p $threadptr
        !           292:            end
        !           293:        end
        !           294:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           295:        set $iter=$iter+1
        !           296:     end
        !           297: end
        !           298: document kstackthreads
        !           299:        Print all the threads with nonzero kernel_stack value,
        !           300:        and name of the task associated with each one of them.
        !           301: end
        !           302: 
        !           303: #
        !           304: # List all the threads with a nonzero value of wait_event.
        !           305: # Print interesting information in the following order :
        !           306: #      Name of the task    [thread->task->proc->p_comm]
        !           307: #      The thread                      [thread]
        !           308: #   The wait event             [thread->wait_event]
        !           309: #      The wait message    [thread->wait_mesg]
        !           310: #
        !           311: define waitthreads
        !           312:     set $numthreads=default_pset->thread_count
        !           313:     set $iter=0
        !           314:     set $threadptr=default_pset->threads.next
        !           315:     while ($iter < $numthreads)
        !           316:        if ((((struct thread *)($threadptr))->wait_event) != 0)
        !           317:            p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           318:            p $threadptr
        !           319:                p ((struct thread *)($threadptr))->wait_event
        !           320:                p ((struct thread *)($threadptr))->wait_mesg
        !           321:        end
        !           322:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           323:        set $iter=$iter+1
        !           324:     end
        !           325: end
        !           326: document waitthreads
        !           327:        Print all the threads with nonzero wait_event value,
        !           328:        and name of the task associated with each one of them.
        !           329:        Also print wait_event and wait_mesg.
        !           330: end
        !           331: 
        !           332: define setRegFromSaved
        !           333:        set $s_pc=(long)$pc
        !           334:        set $s_lr=(long)$lr
        !           335:        set $s_r1=(long)$r1
        !           336:        set $s_r13=(long)$r13
        !           337:        set $s_r14=(long)$r14
        !           338:        set $s_r15=(long)$r15
        !           339:        set $s_r16=(long)$r16
        !           340:        set $s_r17=(long)$r17
        !           341:        set $s_r18=(long)$r18
        !           342:        set $s_r19=(long)$r19
        !           343:        set $s_r20=(long)$r20
        !           344:        set $s_r21=(long)$r21
        !           345:        set $s_r22=(long)$r22
        !           346:        set $s_r23=(long)$r23
        !           347:        set $s_r24=(long)$r24
        !           348:        set $s_r25=(long)$r25
        !           349:        set $s_r26=(long)$r26
        !           350:        set $s_r27=(long)$r27
        !           351:        set $s_r28=(long)$r28
        !           352:        set $s_r29=(long)$r29
        !           353:        set $s_r30=(long)$r30
        !           354:        set $s_r31=(long)$r31
        !           355:        x/i $s_pc
        !           356: end
        !           357: 
        !           358: define printReg
        !           359:        printf "pc\t0x%x\n", $s_pc
        !           360:        printf "lr\t0x%x\n", $s_lr
        !           361:        printf "r1\t0x%x\n", $s_r1
        !           362:        printf "r13\t0x%x\n", $s_r13
        !           363:        printf "r14\t0x%x\n", $s_r14
        !           364:        printf "r15\t0x%x\n", $s_r15
        !           365:        printf "r16\t0x%x\n", $s_r16
        !           366:        printf "r17\t0x%x\n", $s_r17
        !           367:        printf "r18\t0x%x\n", $s_r18
        !           368:        printf "r19\t0x%x\n", $s_r19
        !           369:        printf "r20\t0x%x\n", $s_r20
        !           370:        printf "r21\t0x%x\n", $s_r21
        !           371:        printf "r22\t0x%x\n", $s_r22
        !           372:        printf "r23\t0x%x\n", $s_r23
        !           373:        printf "r24\t0x%x\n", $s_r24
        !           374:        printf "r25\t0x%x\n", $s_r25
        !           375:        printf "r26\t0x%x\n", $s_r26
        !           376:        printf "r27\t0x%x\n", $s_r27
        !           377:        printf "r28\t0x%x\n", $s_r28
        !           378:        printf "r29\t0x%x\n", $s_r29
        !           379:        printf "r30\t0x%x\n", $s_r30
        !           380:        printf "r31\t0x%x\n", $s_r31
        !           381: end
        !           382: 
        !           383: define popReg
        !           384:        if (*(long*)$s_r1) == 0
        !           385:                echo end of stack\n
        !           386:        else
        !           387:        set $s_r1=*(long*)$s_r1
        !           388:        set $s_lr=*(long*)($s_r1+8)
        !           389:        set $s_t1=$s_r1
        !           390:        if $arg0 != 0
        !           391:                if $arg0 <= 31
        !           392:                        set $s_t1=$s_t1-4
        !           393:                        set $s_r31=*(long*)$s_t1
        !           394:                end
        !           395:                if $arg0 <= 30
        !           396:                        set $s_t1=$s_t1-4
        !           397:                        set $s_r30=*(long*)$s_t1
        !           398:                end
        !           399:                if $arg0 <= 29
        !           400:                        set $s_t1=$s_t1-4
        !           401:                        set $s_r29=*(long*)$s_t1
        !           402:                end
        !           403:                if $arg0 <= 28
        !           404:                        set $s_t1=$s_t1-4
        !           405:                        set $s_r28=*(long*)$s_t1
        !           406:                end
        !           407:                if $arg0 <= 27
        !           408:                        set $s_t1=$s_t1-4
        !           409:                        set $s_r27=*(long*)$s_t1
        !           410:                end
        !           411:                if $arg0 <= 26
        !           412:                        set $s_t1=$s_t1-4
        !           413:                        set $s_r26=*(long*)$s_t1
        !           414:                end
        !           415:                if $arg0 <= 25
        !           416:                        set $s_t1=$s_t1-4
        !           417:                        set $s_r25=*(long*)$s_t1
        !           418:                end
        !           419:                if $arg0 <= 24
        !           420:                        set $s_t1=$s_t1-4
        !           421:                        set $s_r24=*(long*)$s_t1
        !           422:                end
        !           423:                if $arg0 <= 23
        !           424:                        set $s_t1=$s_t1-4
        !           425:                        set $s_r23=*(long*)$s_t1
        !           426:                end
        !           427:                if $arg0 <= 22
        !           428:                        set $s_t1=$s_t1-4
        !           429:                        set $s_r22=*(long*)$s_t1
        !           430:                end
        !           431:                if $arg0 <= 21
        !           432:                        set $s_t1=$s_t1-4
        !           433:                        set $s_r21=*(long*)$s_t1
        !           434:                end
        !           435:                if $arg0 <= 20
        !           436:                        set $s_t1=$s_t1-4
        !           437:                        set $s_r20=*(long*)$s_t1
        !           438:                end
        !           439:                if $arg0 <= 19
        !           440:                        set $s_t1=$s_t1-4
        !           441:                        set $s_r19=*(long*)$s_t1
        !           442:                end
        !           443:                if $arg0 <= 18
        !           444:                        set $s_t1=$s_t1-4
        !           445:                        set $s_r18=*(long*)$s_t1
        !           446:                end
        !           447:                if $arg0 <= 17
        !           448:                        set $s_t1=$s_t1-4
        !           449:                        set $s_r17=*(long*)$s_t1
        !           450:                end
        !           451:                if $arg0 <= 16
        !           452:                        set $s_t1=$s_t1-4
        !           453:                        set $s_r16=*(long*)$s_t1
        !           454:                end
        !           455:        end
        !           456:        set $s_pc=$s_lr-4
        !           457:        x/i $s_pc
        !           458:        end
        !           459: end
        !           460: 
        !           461: define wherePC
        !           462:        x/i $s_pc
        !           463: end
        !           464: 
        !           465: define popSaved
        !           466:        set $s_t1=(struct ppc_saved_state *)($s_r1+0x90)
        !           467:        set $s_pc=(long)$s_t1->srr0
        !           468:        set $s_lr=(long)$s_t1->lr
        !           469:        set $s_r1=(long)$s_t1->r1
        !           470:        set $s_r13=(long)$s_t1->r13
        !           471:        set $s_r14=(long)$s_t1->r14
        !           472:        set $s_r15=(long)$s_t1->r15
        !           473:        set $s_r16=(long)$s_t1->r16
        !           474:        set $s_r17=(long)$s_t1->r17
        !           475:        set $s_r18=(long)$s_t1->r18
        !           476:        set $s_r19=(long)$s_t1->r19
        !           477:        set $s_r20=(long)$s_t1->r20
        !           478:        set $s_r21=(long)$s_t1->r21
        !           479:        set $s_r22=(long)$s_t1->r22
        !           480:        set $s_r23=(long)$s_t1->r23
        !           481:        set $s_r24=(long)$s_t1->r24
        !           482:        set $s_r25=(long)$s_t1->r25
        !           483:        set $s_r26=(long)$s_t1->r26
        !           484:        set $s_r27=(long)$s_t1->r27
        !           485:        set $s_r28=(long)$s_t1->r28
        !           486:        set $s_r29=(long)$s_t1->r29
        !           487:        set $s_r30=(long)$s_t1->r30
        !           488:        set $s_r31=(long)$s_t1->r31
        !           489:        x/i $s_pc
        !           490: end
        !           491: 
        !           492: define setRegFromThread
        !           493:        set $s_t1=(thread_t)$arg0
        !           494:        set $s_t1=(struct ppc_kernel_state *)(($s_t1->kernel_stack)+0x3f94)
        !           495:        set $s_pc=(long)$s_t1->lr
        !           496:        set $s_lr=(long)$s_t1->lr
        !           497:        set $s_r1=(long)$s_t1->r1
        !           498:        set $s_r13=(long)$s_t1->r13[0]
        !           499:        set $s_r14=(long)$s_t1->r13[1]
        !           500:        set $s_r15=(long)$s_t1->r13[2]
        !           501:        set $s_r16=(long)$s_t1->r13[3]
        !           502:        set $s_r17=(long)$s_t1->r13[4]
        !           503:        set $s_r18=(long)$s_t1->r13[5]
        !           504:        set $s_r19=(long)$s_t1->r13[6]
        !           505:        set $s_r20=(long)$s_t1->r13[7]
        !           506:        set $s_r21=(long)$s_t1->r13[8]
        !           507:        set $s_r22=(long)$s_t1->r13[9]
        !           508:        set $s_r23=(long)$s_t1->r13[10]
        !           509:        set $s_r24=(long)$s_t1->r13[11]
        !           510:        set $s_r25=(long)$s_t1->r13[12]
        !           511:        set $s_r26=(long)$s_t1->r13[13]
        !           512:        set $s_r27=(long)$s_t1->r13[14]
        !           513:        set $s_r28=(long)$s_t1->r13[15]
        !           514:        set $s_r29=(long)$s_t1->r13[16]
        !           515:        set $s_r30=(long)$s_t1->r13[17]
        !           516:        set $s_r31=(long)$s_t1->r13[18]
        !           517:        x/i $s_pc
        !           518: end
        !           519: 
        !           520: define popLR
        !           521:        set $s_pc=$s_lr-4
        !           522:        x/i $s_pc
        !           523: end
        !           524: 
        !           525: #
        !           526: # Difficult to ducument macros
        !           527: #
        !           528: define sustack
        !           529:        set $u=(long*)((((int)$arg0) & 0x0FFFFFFF) + 0x60000000)
        !           530:        p/x $u
        !           531:        p/x *($u+2)-4
        !           532: end
        !           533: 
        !           534: define ustack
        !           535:        if (*(long*)$u) != 0
        !           536:                set $u=(long*)((((int)(*(long*)$u)) & 0x0FFFFFFF) + 0x60000000)
        !           537:                p/x $u
        !           538:                if (((int)(*($u+2)-4)) & 0xF0000000) == 0
        !           539:                        x/i ((((int)(*($u+2)-4)) & 0x0FFFFFFF) + 0x20000000)
        !           540:                else
        !           541:                        p/x *($u+2)-4
        !           542:                end
        !           543:        else
        !           544:                echo end of user stack\n
        !           545:        end
        !           546: end
        !           547: 
        !           548: #
        !           549: # Obscure macros for printing zones
        !           550: #
        !           551: 
        !           552: define dcz
        !           553:     p *(zone_t)$arg0
        !           554: end
        !           555: document dcz
        !           556:        Print first argument as a zone_t.
        !           557: end
        !           558: 
        !           559: define dzleak
        !           560:     if (((zone_t)$arg0)->zone_name != 0)
        !           561:        p (char *)(((zone_t)($arg0))->zone_name)
        !           562:     end
        !           563:     echo "    num elem used "
        !           564:     p/x $arg0->count
        !           565:     echo "    curr zone size "
        !           566:     p/x $arg0->cur_size
        !           567:     echo "    max zone size "
        !           568:     p/x $arg0->max_size
        !           569:     if ($arg0->free_elements !=0)
        !           570:         echo "    next free element"
        !           571:         p/x $arg0->free_elements
        !           572:     end
        !           573:     if ( $arg0->doing_alloc != 0)
        !           574:         echo "    doing allocation"
        !           575:         p/x $arg0->doing_alloc
        !           576:     end
        !           577:     echo "    allocation size"
        !           578:     p/x $arg0->alloc_size
        !           579:     if ( $arg0->pageable != 0)
        !           580:         echo "    zone is pageable\n"
        !           581:     end
        !           582:     if ( $arg0->sleepable != 0)
        !           583:         echo "    zone is sleepable\n"
        !           584:     end
        !           585:     if ( $arg0->exhaustible != 0)
        !           586:         echo "    zone is exhaustible\n"
        !           587:     end
        !           588:     if ( $arg0->expandable != 0)
        !           589:         echo "    zone is expandable\n"
        !           590:     end
        !           591:     set $iter=0
        !           592:     while ($iter < $arg0->num_alloc_callers)
        !           593:        p/x *(struct caller_s *)$arg0->alloc_callers[$iter]
        !           594:        set $iter=$iter+1
        !           595:     end
        !           596:     echo "    number of alloc callers "
        !           597:     p/x $arg0->num_alloc_callers
        !           598:     set $iter=0
        !           599:     while ($iter < $arg0->num_free_callers)
        !           600:        p/x *(struct caller_s *)$arg0->free_callers[$iter]
        !           601:        set $iter=$iter+1
        !           602:     end
        !           603:     echo "    number of free callers "
        !           604:     p/x $arg0->num_free_callers
        !           605: end
        !           606: 
        !           607: define dz
        !           608:     if (((zone_t)$arg0)->zone_name != 0)
        !           609:        p (char *)(((zone_t)($arg0))->zone_name)
        !           610:     end
        !           611:     echo "    num elem used "
        !           612:     p/x $arg0->count
        !           613:     echo "    curr zone size "
        !           614:     p/x $arg0->cur_size
        !           615:     echo "    max zone size "
        !           616:     p/x $arg0->max_size
        !           617:     if ($arg0->free_elements !=0)
        !           618:         echo "    next free element"
        !           619:         p/x $arg0->free_elements
        !           620:     end
        !           621:     if ( $arg0->doing_alloc != 0)
        !           622:         echo "    doing allocation"
        !           623:         p/x $arg0->doing_alloc
        !           624:     end
        !           625:     echo "    allocation size"
        !           626:     p/x $arg0->alloc_size
        !           627:     if ( $arg0->pageable != 0)
        !           628:         echo "    zone is pageable\n"
        !           629:     end
        !           630:     if ( $arg0->sleepable != 0)
        !           631:         echo "    zone is sleepable\n"
        !           632:     end
        !           633:     if ( $arg0->exhaustible != 0)
        !           634:         echo "    zone is exhaustible\n"
        !           635:     end
        !           636:     if ( $arg0->expandable != 0)
        !           637:         echo "    zone is expandable\n"
        !           638:     end
        !           639: end
        !           640: 
        !           641: define daz
        !           642:     set $numtasks=default_pset->task_count
        !           643:     set $iter=0
        !           644:     set $zoneptr=zone_zone
        !           645:     while ($zoneptr != 0)
        !           646:        echo \n
        !           647:        dz $zoneptr
        !           648:        set $zoneptr=((zone_t)($zoneptr))->next_zone
        !           649:        set $iter=$iter+1
        !           650:     end
        !           651:     echo number of zones = 
        !           652:     p $iter
        !           653: end
        !           654: 
        !           655: define dleakaz
        !           656:     set $numtasks=default_pset->task_count
        !           657:     set $iter=0
        !           658:     set $zoneptr=zone_zone
        !           659:     while ($zoneptr != 0)
        !           660:     echo \n
        !           661:     dzleak $zoneptr
        !           662:     set $zoneptr=((zone_t)($zoneptr))->next_zone
        !           663:     set $iter=$iter+1
        !           664:     end
        !           665:     echo number of zones =
        !           666:     p $iter
        !           667: end
        !           668: 
        !           669: #
        !           670: # prints info about a TAILQ: how many are in the list and total KB
        !           671: #
        !           672: define tqcount
        !           673:     echo $arg0\ $arg2\ length\ is
        !           674:     set $tqptr=($arg0).tqh_first
        !           675:     set $iter=0
        !           676:     set $size=0
        !           677:     while ($tqptr)
        !           678:         set $size=$size + ((struct $arg1 *)$tqptr)->$arg3
        !           679:         set $tqptr=((struct $arg1 *)$tqptr)->$arg2.tqe_next
        !           680:         set $iter=$iter + 1
        !           681:     end
        !           682:     printf " %d kbytes is 0x%x\n",$iter,$size/1024
        !           683: end
        !           684: document tqcount
        !           685:        prints info about a TAILQ: how many are in the list and total KB
        !           686: end
        !           687: 
        !           688: #
        !           689: # prints info about the buffer cache queues
        !           690: #
        !           691: define bufinfo
        !           692:     printf "nbuf is %d\n",nbuf
        !           693:     printf "niobuf is %d\n",niobuf
        !           694:     printf "bufpages is %d\n",bufpages
        !           695:     printf "LOCKED "
        !           696:     tqcount bufqueues[0] buf b_freelist b_bufsize
        !           697:     printf "LRU "
        !           698:     tqcount bufqueues[1] buf b_freelist b_bufsize
        !           699:     printf "AGE "
        !           700:     tqcount bufqueues[2] buf b_freelist b_bufsize
        !           701:     printf "EMPTY "
        !           702:     tqcount bufqueues[3] buf b_freelist b_bufsize
        !           703:     tqcount iobufqueue buf b_freelist b_bufsize
        !           704: end
        !           705: document bufinfo
        !           706:        prints info about the buffer cache queues
        !           707: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.