Annotation of XNU/bsd/.gdbinit, revision 1.1

1.1     ! root        1: define ststack
        !             2:         set $f=(long*)*$r1
        !             3:        p/x $f
        !             4:        x/i *($f+2)-4
        !             5: end
        !             6: 
        !             7: define tstack
        !             8:     if (*(long*)$f) != 0
        !             9:         set $f=*(long*)$f
        !            10:         p/x $f
        !            11:         x/i *($f+8)-4
        !            12:     else
        !            13:         echo end of stack\n
        !            14:     end
        !            15: end
        !            16: 
        !            17: define pcb
        !            18:     p *(pcb_t)$arg0
        !            19: end
        !            20: 
        !            21: define pth
        !            22:     p *(thread_t)$arg0
        !            23: end
        !            24: 
        !            25: define pta
        !            26:     p *(task_t)$arg0
        !            27: end
        !            28: 
        !            29: define dcz
        !            30:     p *(zone_t)$arg0
        !            31: end
        !            32: 
        !            33: define dmapent
        !            34:     echo "  map_entry"
        !            35:     p $arg0
        !            36:     echo "    start "
        !            37:     p ((vm_map_entry_t)$arg0)->links.start
        !            38:     echo "    end "
        !            39:     p ((vm_map_entry_t)$arg0)->links.end
        !            40:     if ( $arg0->is_a_map != 0)
        !            41:         echo "    object is a map"\n
        !            42:         echo "    share"
        !            43:        p $arg0->object.share_map
        !            44:         echo "    offset"
        !            45:        p $arg0->offset
        !            46:     end
        !            47:     if ( $arg0->is_shared != 0)
        !            48:         echo "    region is shared"\n
        !            49:     end
        !            50:     if ( $arg0->is_sub_map != 0)
        !            51:         echo "    object is a sub map"\n
        !            52:     end
        !            53:     if ( $arg0->copy_on_write != 0)
        !            54:         echo "    data is copy on write"\n
        !            55:     end
        !            56:     if ( $arg0->in_transition != 0)
        !            57:         echo "    Entry is being changed"\n
        !            58:     end
        !            59:     if ( $arg0->needs_wakeup != 0)
        !            60:         echo "    Waiters on in_transition"\n
        !            61:     end
        !            62:     if ( $arg0->needs_copy != 0)
        !            63:         echo "    object needs to be copied"\n
        !            64:     end
        !            65:     echo "    protection "
        !            66:     p ((vm_map_entry_t)$arg0)->protection
        !            67:     echo "    max protection "
        !            68:     p ((vm_map_entry_t)$arg0)->max_protection
        !            69:     echo "    inheritance "
        !            70:     p ((vm_map_entry_t)$arg0)->inheritance
        !            71:     echo "    wired count "
        !            72:     p ((vm_map_entry_t)$arg0)->wired_count
        !            73:     echo "    user_wired_count "
        !            74:     p ((vm_map_entry_t)$arg0)->user_wired_count
        !            75: end
        !            76: 
        !            77: define dmap
        !            78:     set $vmmapptr=$arg0
        !            79:     set $iter=0
        !            80:     if (((vm_map_t)$vmmapptr)->is_main_map != 0)
        !            81:        echo "    this is a main map"\n
        !            82:     end
        !            83:     echo "    start "
        !            84:     p ((vm_map_t)$vmmapptr)->hdr.links.start
        !            85:     echo "    end "
        !            86:     p ((vm_map_t)$vmmapptr)->hdr.links.end
        !            87:     if ((vm_map_t)$vmmapptr->entries_pageable != 0)
        !            88:         echo "    map entries are pageable"\n
        !            89:     else 
        !            90:         echo "    map entries are NOT pageable"\n
        !            91:     end
        !            92:     echo "    size "
        !            93:     p ((vm_map_t)$vmmapptr)->size
        !            94:     echo "    pmap "
        !            95:     p ((vm_map_t)$vmmapptr)->pmap
        !            96:     set $mapentptr=$vmmapptr->hdr.links.next
        !            97:     echo "    number of map entries "
        !            98:     p ((vm_map_t)$vmmapptr)->hdr.nentries
        !            99:     while ($iter < ((vm_map_t)$arg0)->hdr.nentries)
        !           100:        echo \n
        !           101:        echo "  entry "
        !           102:        p $iter
        !           103:        dmapent $mapentptr
        !           104:        set $mapentptr=((vm_map_entry_t)$mapentptr)->links.next
        !           105:        set $iter=$iter+1
        !           106:     end
        !           107: 
        !           108: end
        !           109: 
        !           110: define dzleak
        !           111:     if (((zone_t)$arg0)->zone_name != 0)
        !           112:        p (char *)(((zone_t)($arg0))->zone_name)
        !           113:     end
        !           114:     echo "    num elem used "
        !           115:     p/x $arg0->count
        !           116:     echo "    curr zone size "
        !           117:     p/x $arg0->cur_size
        !           118:     echo "    max zone size "
        !           119:     p/x $arg0->max_size
        !           120:     if ($arg0->free_elements !=0)
        !           121:         echo "    next free element"
        !           122:         p/x $arg0->free_elements
        !           123:     end
        !           124:     if ( $arg0->doing_alloc != 0)
        !           125:         echo "    doing allocation"
        !           126:         p/x $arg0->doing_alloc
        !           127:     end
        !           128:     echo "    allocation size"
        !           129:     p/x $arg0->alloc_size
        !           130:     if ( $arg0->pageable != 0)
        !           131:         echo "    zone is pageable\n"
        !           132:     end
        !           133:     if ( $arg0->sleepable != 0)
        !           134:         echo "    zone is sleepable\n"
        !           135:     end
        !           136:     if ( $arg0->exhaustible != 0)
        !           137:         echo "    zone is exhaustible\n"
        !           138:     end
        !           139:     if ( $arg0->expandable != 0)
        !           140:         echo "    zone is expandable\n"
        !           141:     end
        !           142:     set $iter=0
        !           143:     while ($iter < $arg0->num_alloc_callers)
        !           144:        p/x *(struct caller_s *)$arg0->alloc_callers[$iter]
        !           145:        set $iter=$iter+1
        !           146:     end
        !           147:     echo "    number of alloc callers "
        !           148:     p/x $arg0->num_alloc_callers
        !           149:     set $iter=0
        !           150:     while ($iter < $arg0->num_free_callers)
        !           151:        p/x *(struct caller_s *)$arg0->free_callers[$iter]
        !           152:        set $iter=$iter+1
        !           153:     end
        !           154:     echo "    number of free callers "
        !           155:     p/x $arg0->num_free_callers
        !           156: end
        !           157: 
        !           158: define dz
        !           159:     if (((zone_t)$arg0)->zone_name != 0)
        !           160:        p (char *)(((zone_t)($arg0))->zone_name)
        !           161:     end
        !           162:     echo "    num elem used "
        !           163:     p/x $arg0->count
        !           164:     echo "    curr zone size "
        !           165:     p/x $arg0->cur_size
        !           166:     echo "    max zone size "
        !           167:     p/x $arg0->max_size
        !           168:     if ($arg0->free_elements !=0)
        !           169:         echo "    next free element"
        !           170:         p/x $arg0->free_elements
        !           171:     end
        !           172:     if ( $arg0->doing_alloc != 0)
        !           173:         echo "    doing allocation"
        !           174:         p/x $arg0->doing_alloc
        !           175:     end
        !           176:     echo "    allocation size"
        !           177:     p/x $arg0->alloc_size
        !           178:     if ( $arg0->pageable != 0)
        !           179:         echo "    zone is pageable\n"
        !           180:     end
        !           181:     if ( $arg0->sleepable != 0)
        !           182:         echo "    zone is sleepable\n"
        !           183:     end
        !           184:     if ( $arg0->exhaustible != 0)
        !           185:         echo "    zone is exhaustible\n"
        !           186:     end
        !           187:     if ( $arg0->expandable != 0)
        !           188:         echo "    zone is expandable\n"
        !           189:     end
        !           190: end
        !           191: 
        !           192: define daz
        !           193:     set $numtasks=default_pset->task_count
        !           194:     set $iter=0
        !           195:     set $zoneptr=zone_zone
        !           196:     while ($zoneptr != 0)
        !           197:        echo \n
        !           198:        dz $zoneptr
        !           199:        set $zoneptr=((zone_t)($zoneptr))->next_zone
        !           200:        set $iter=$iter+1
        !           201:     end
        !           202:     echo number of zones = 
        !           203:     p $iter
        !           204: end
        !           205: 
        !           206: define dleakaz
        !           207:     set $numtasks=default_pset->task_count
        !           208:     set $iter=0
        !           209:     set $zoneptr=zone_zone
        !           210:     while ($zoneptr != 0)
        !           211:     echo \n
        !           212:     dzleak $zoneptr
        !           213:     set $zoneptr=((zone_t)($zoneptr))->next_zone
        !           214:     set $iter=$iter+1
        !           215:     end
        !           216:     echo number of zones =
        !           217:     p $iter
        !           218: end
        !           219: 
        !           220: define tsaved
        !           221:        p/x *(struct ppc_saved_state *)($f+0x90)
        !           222: end
        !           223: 
        !           224: define sustack
        !           225:        set $u=(long*)((((int)$arg0) & 0x0FFFFFFF) + 0x60000000)
        !           226:        p/x $u
        !           227:        p/x *($u+2)-4
        !           228: end
        !           229: 
        !           230: define ustack
        !           231:        if (*(long*)$u) != 0
        !           232:                set $u=(long*)((((int)(*(long*)$u)) & 0x0FFFFFFF) + 0x60000000)
        !           233:                p/x $u
        !           234:                if (((int)(*($u+2)-4)) & 0xF0000000) == 0
        !           235:                        x/i ((((int)(*($u+2)-4)) & 0x0FFFFFFF) + 0x20000000)
        !           236:                else
        !           237:                        p/x *($u+2)-4
        !           238:                end
        !           239:        else
        !           240:                echo end of user stack\n
        !           241:        end
        !           242: end
        !           243: 
        !           244: define tasks
        !           245:     set $numtasks=default_pset->task_count
        !           246:     set $iter=0
        !           247:     set $taskptr=default_pset->tasks.next
        !           248:     while ($iter < $numtasks)
        !           249:        if ((((struct task *)($taskptr))->proc) != 0)
        !           250:            p (char *)(((struct task *)($taskptr))->proc->p_comm)
        !           251:                p ((struct task *)($taskptr))->map
        !           252:        end
        !           253:        set $taskptr=((struct task *)($taskptr))->pset_tasks.next
        !           254:        set $iter=$iter+1
        !           255:     end
        !           256: end
        !           257: 
        !           258: define threads
        !           259:     set $numthreads=default_pset->thread_count
        !           260:     set $iter=0
        !           261:     set $threadptr=default_pset->threads.next
        !           262:     while ($iter < $numthreads)
        !           263:         if ((((struct thread *)($threadptr))->task->proc) != 0) 
        !           264:                p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           265:                p $threadptr
        !           266:            end
        !           267:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           268:        set $iter=$iter+1
        !           269:     end
        !           270: end
        !           271: 
        !           272: define kstackthreads
        !           273:     set $numthreads=default_pset->thread_count
        !           274:     set $iter=0
        !           275:     set $threadptr=default_pset->threads.next
        !           276:     while ($iter < $numthreads)
        !           277:        if ((((struct thread *)($threadptr))->kernel_stack) != 0)
        !           278:            if ((((struct thread *)($threadptr))->task->proc) != 0)
        !           279:                p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           280:                p $threadptr
        !           281:            end
        !           282:        end
        !           283:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           284:        set $iter=$iter+1
        !           285:     end
        !           286: end
        !           287: 
        !           288: define waitthreads
        !           289:     set $numthreads=default_pset->thread_count
        !           290:     set $iter=0
        !           291:     set $threadptr=default_pset->threads.next
        !           292:     while ($iter < $numthreads)
        !           293:        if ((((struct thread *)($threadptr))->wait_event) != 0)
        !           294:            p (char *)(((struct thread *)($threadptr))->task->proc->p_comm)
        !           295:            p $threadptr
        !           296:                p ((struct thread *)($threadptr))->wait_event
        !           297:                p ((struct thread *)($threadptr))->wait_mesg
        !           298:        end
        !           299:        set $threadptr=((struct thread *)($threadptr))->pset_threads.next
        !           300:        set $iter=$iter+1
        !           301:     end
        !           302: end
        !           303: 
        !           304: define tomkstack
        !           305:     if (( ((thread_t)$arg0)->kernel_stack) == 0)
        !           306:        echo "no kernel stack"
        !           307:     else
        !           308:        if $arg0 == cpu_data->active_thread
        !           309:            ststack
        !           310:        else
        !           311:            p/x ((struct ppc_kernel_state *)((((thread_t)$arg0)->kernel_stack)+0x3f94))->r1
        !           312:            x/i ((struct ppc_kernel_state *)((((thread_t)$arg0)->kernel_stack)+0x3f94))->lr
        !           313:        end
        !           314:     end
        !           315: end
        !           316: 
        !           317: define kstack
        !           318:     if (( ((thread_t)$arg0)->kernel_stack) == 0)
        !           319:        echo "no kernel stack"
        !           320:     else
        !           321:        if $arg0 == cpu_data->active_thread
        !           322:            ststack
        !           323:        else
        !           324:            set $f=((struct ppc_kernel_state *)(($s->kernel_stack)+0x3f94))->r1
        !           325:            p/x $f
        !           326:            x/i ((struct ppc_kernel_state *)(($s->kernel_stack)+0x3f94))->lr
        !           327:        end
        !           328:     end
        !           329: end
        !           330: 
        !           331: define setRegFromSaved
        !           332:        set $s_pc=(long)$pc
        !           333:        set $s_lr=(long)$lr
        !           334:        set $s_r1=(long)$r1
        !           335:        set $s_r13=(long)$r13
        !           336:        set $s_r14=(long)$r14
        !           337:        set $s_r15=(long)$r15
        !           338:        set $s_r16=(long)$r16
        !           339:        set $s_r17=(long)$r17
        !           340:        set $s_r18=(long)$r18
        !           341:        set $s_r19=(long)$r19
        !           342:        set $s_r20=(long)$r20
        !           343:        set $s_r21=(long)$r21
        !           344:        set $s_r22=(long)$r22
        !           345:        set $s_r23=(long)$r23
        !           346:        set $s_r24=(long)$r24
        !           347:        set $s_r25=(long)$r25
        !           348:        set $s_r26=(long)$r26
        !           349:        set $s_r27=(long)$r27
        !           350:        set $s_r28=(long)$r28
        !           351:        set $s_r29=(long)$r29
        !           352:        set $s_r30=(long)$r30
        !           353:        set $s_r31=(long)$r31
        !           354:        x/i $s_pc
        !           355: end
        !           356: 
        !           357: define printReg
        !           358:        printf "pc\t0x%x\n", $s_pc
        !           359:        printf "lr\t0x%x\n", $s_lr
        !           360:        printf "r1\t0x%x\n", $s_r1
        !           361:        printf "r13\t0x%x\n", $s_r13
        !           362:        printf "r14\t0x%x\n", $s_r14
        !           363:        printf "r15\t0x%x\n", $s_r15
        !           364:        printf "r16\t0x%x\n", $s_r16
        !           365:        printf "r17\t0x%x\n", $s_r17
        !           366:        printf "r18\t0x%x\n", $s_r18
        !           367:        printf "r19\t0x%x\n", $s_r19
        !           368:        printf "r20\t0x%x\n", $s_r20
        !           369:        printf "r21\t0x%x\n", $s_r21
        !           370:        printf "r22\t0x%x\n", $s_r22
        !           371:        printf "r23\t0x%x\n", $s_r23
        !           372:        printf "r24\t0x%x\n", $s_r24
        !           373:        printf "r25\t0x%x\n", $s_r25
        !           374:        printf "r26\t0x%x\n", $s_r26
        !           375:        printf "r27\t0x%x\n", $s_r27
        !           376:        printf "r28\t0x%x\n", $s_r28
        !           377:        printf "r29\t0x%x\n", $s_r29
        !           378:        printf "r30\t0x%x\n", $s_r30
        !           379:        printf "r31\t0x%x\n", $s_r31
        !           380: end
        !           381: 
        !           382: define popReg
        !           383:        if (*(long*)$s_r1) == 0
        !           384:                echo end of stack\n
        !           385:        else
        !           386:        set $s_r1=*(long*)$s_r1
        !           387:        set $s_lr=*(long*)($s_r1+8)
        !           388:        set $s_t1=$s_r1
        !           389:        if $arg0 != 0
        !           390:                if $arg0 <= 31
        !           391:                        set $s_t1=$s_t1-4
        !           392:                        set $s_r31=*(long*)$s_t1
        !           393:                end
        !           394:                if $arg0 <= 30
        !           395:                        set $s_t1=$s_t1-4
        !           396:                        set $s_r30=*(long*)$s_t1
        !           397:                end
        !           398:                if $arg0 <= 29
        !           399:                        set $s_t1=$s_t1-4
        !           400:                        set $s_r29=*(long*)$s_t1
        !           401:                end
        !           402:                if $arg0 <= 28
        !           403:                        set $s_t1=$s_t1-4
        !           404:                        set $s_r28=*(long*)$s_t1
        !           405:                end
        !           406:                if $arg0 <= 27
        !           407:                        set $s_t1=$s_t1-4
        !           408:                        set $s_r27=*(long*)$s_t1
        !           409:                end
        !           410:                if $arg0 <= 26
        !           411:                        set $s_t1=$s_t1-4
        !           412:                        set $s_r26=*(long*)$s_t1
        !           413:                end
        !           414:                if $arg0 <= 25
        !           415:                        set $s_t1=$s_t1-4
        !           416:                        set $s_r25=*(long*)$s_t1
        !           417:                end
        !           418:                if $arg0 <= 24
        !           419:                        set $s_t1=$s_t1-4
        !           420:                        set $s_r24=*(long*)$s_t1
        !           421:                end
        !           422:                if $arg0 <= 23
        !           423:                        set $s_t1=$s_t1-4
        !           424:                        set $s_r23=*(long*)$s_t1
        !           425:                end
        !           426:                if $arg0 <= 22
        !           427:                        set $s_t1=$s_t1-4
        !           428:                        set $s_r22=*(long*)$s_t1
        !           429:                end
        !           430:                if $arg0 <= 21
        !           431:                        set $s_t1=$s_t1-4
        !           432:                        set $s_r21=*(long*)$s_t1
        !           433:                end
        !           434:                if $arg0 <= 20
        !           435:                        set $s_t1=$s_t1-4
        !           436:                        set $s_r20=*(long*)$s_t1
        !           437:                end
        !           438:                if $arg0 <= 19
        !           439:                        set $s_t1=$s_t1-4
        !           440:                        set $s_r19=*(long*)$s_t1
        !           441:                end
        !           442:                if $arg0 <= 18
        !           443:                        set $s_t1=$s_t1-4
        !           444:                        set $s_r18=*(long*)$s_t1
        !           445:                end
        !           446:                if $arg0 <= 17
        !           447:                        set $s_t1=$s_t1-4
        !           448:                        set $s_r17=*(long*)$s_t1
        !           449:                end
        !           450:                if $arg0 <= 16
        !           451:                        set $s_t1=$s_t1-4
        !           452:                        set $s_r16=*(long*)$s_t1
        !           453:                end
        !           454:        end
        !           455:        set $s_pc=$s_lr-4
        !           456:        x/i $s_pc
        !           457:        end
        !           458: end
        !           459: 
        !           460: define wherePC
        !           461:        x/i $s_pc
        !           462: end
        !           463: 
        !           464: define popSaved
        !           465:        set $s_t1=(struct ppc_saved_state *)($s_r1+0x90)
        !           466:        set $s_pc=(long)$s_t1->srr0
        !           467:        set $s_lr=(long)$s_t1->lr
        !           468:        set $s_r1=(long)$s_t1->r1
        !           469:        set $s_r13=(long)$s_t1->r13
        !           470:        set $s_r14=(long)$s_t1->r14
        !           471:        set $s_r15=(long)$s_t1->r15
        !           472:        set $s_r16=(long)$s_t1->r16
        !           473:        set $s_r17=(long)$s_t1->r17
        !           474:        set $s_r18=(long)$s_t1->r18
        !           475:        set $s_r19=(long)$s_t1->r19
        !           476:        set $s_r20=(long)$s_t1->r20
        !           477:        set $s_r21=(long)$s_t1->r21
        !           478:        set $s_r22=(long)$s_t1->r22
        !           479:        set $s_r23=(long)$s_t1->r23
        !           480:        set $s_r24=(long)$s_t1->r24
        !           481:        set $s_r25=(long)$s_t1->r25
        !           482:        set $s_r26=(long)$s_t1->r26
        !           483:        set $s_r27=(long)$s_t1->r27
        !           484:        set $s_r28=(long)$s_t1->r28
        !           485:        set $s_r29=(long)$s_t1->r29
        !           486:        set $s_r30=(long)$s_t1->r30
        !           487:        set $s_r31=(long)$s_t1->r31
        !           488:        x/i $s_pc
        !           489: end
        !           490: 
        !           491: define setRegFromThread
        !           492:        set $s_t1=(thread_t)$arg0
        !           493:        set $s_t1=(struct ppc_kernel_state *)(($s_t1->kernel_stack)+0x3f94)
        !           494:        set $s_pc=(long)$s_t1->lr
        !           495:        set $s_lr=(long)$s_t1->lr
        !           496:        set $s_r1=(long)$s_t1->r1
        !           497:        set $s_r13=(long)$s_t1->r13[0]
        !           498:        set $s_r14=(long)$s_t1->r13[1]
        !           499:        set $s_r15=(long)$s_t1->r13[2]
        !           500:        set $s_r16=(long)$s_t1->r13[3]
        !           501:        set $s_r17=(long)$s_t1->r13[4]
        !           502:        set $s_r18=(long)$s_t1->r13[5]
        !           503:        set $s_r19=(long)$s_t1->r13[6]
        !           504:        set $s_r20=(long)$s_t1->r13[7]
        !           505:        set $s_r21=(long)$s_t1->r13[8]
        !           506:        set $s_r22=(long)$s_t1->r13[9]
        !           507:        set $s_r23=(long)$s_t1->r13[10]
        !           508:        set $s_r24=(long)$s_t1->r13[11]
        !           509:        set $s_r25=(long)$s_t1->r13[12]
        !           510:        set $s_r26=(long)$s_t1->r13[13]
        !           511:        set $s_r27=(long)$s_t1->r13[14]
        !           512:        set $s_r28=(long)$s_t1->r13[15]
        !           513:        set $s_r29=(long)$s_t1->r13[16]
        !           514:        set $s_r30=(long)$s_t1->r13[17]
        !           515:        set $s_r31=(long)$s_t1->r13[18]
        !           516:        x/i $s_pc
        !           517: end
        !           518: 
        !           519: define popLR
        !           520:        set $s_pc=$s_lr-4
        !           521:        x/i $s_pc
        !           522: end

unix.superglobalmegacorp.com

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