26 output (((int)$ebp)-(int)$esp)/4-4
27 printf " words on stack)\n ebp: "
33 printf " (maximum of "
34 output ((*(int*)$ebp)-(int)$ebp)/4-4
35 printf " parameters possible)\nSaved eip: "
38 output/x (int) ($ebp+8)
40 output (char*) *(int*)($ebp+8)
42 output/x (int) ($ebp+12)
44 output (char*) *(int*)($ebp+12)
46 output/x (int) ($ebp+16)
48 output (char*) *(int*)($ebp+16)
50 output/x (int) ($ebp+20)
52 output (char*) *(int*)($ebp+20)
56 Show the register contents and the first four parameter
57 words of the current frame.
68 printf " (maximum of "
69 output ((*(int*)$ebp)-(int)$ebp)/4-4
70 printf " parameters possible)\nSaved eip: "
73 output/x (int) ($ebp+8)
75 output (char*) *(int*)($ebp+8)
77 output/x (int) ($ebp+12)
79 output (char*) *(int*)($ebp+12)
81 output/x (int) ($ebp+16)
83 output (char*) *(int*)($ebp+16)
85 output/x (int) ($ebp+20)
87 output (char*) *(int*)($ebp+20)
89 output/x (int) ($ebp+24)
91 output (char*) *(int*)($ebp+24)
93 output/x (int) ($ebp+28)
95 output (char*) *(int*)($ebp+28)
97 output/x (int) ($ebp+32)
99 output (char*) *(int*)($ebp+32)
100 printf "\nParm 8 at "
101 output/x (int) ($ebp+36)
103 output (char*) *(int*)($ebp+36)
104 printf "\nParm 9 at "
105 output/x (int) ($ebp+40)
107 output (char*) *(int*)($ebp+40)
108 printf "\nParm 10 at "
109 output/x (int) ($ebp+44)
111 output (char*) *(int*)($ebp+44)
115 Show the register contents and the first ten parameter
116 words of the current frame.
124 x/12x *(int*)($ebp+4)
129 x/12x *(int*)($ebp+8)
134 x/12x *(int*)($ebp+12)
139 x/12x *(int*)($ebp+16)
144 Show the first parameter of current stack frame in various formats
147 Show the second parameter of current stack frame in various formats
150 Show the third parameter of current stack frame in various formats
153 Show the fourth parameter of current stack frame in various formats
156 Show the fifth parameter of current stack frame in various formats
183 Select stack frame 0 and show assembler-level details
186 Select stack frame 1 and show assembler-level details
189 Select stack frame 2 and show assembler-level details
192 Select stack frame 3 and show assembler-level details
195 Select stack frame 4 and show assembler-level details
198 Select stack frame 5 and show assembler-level details
201 Single step 1 instruction (over calls) and show next instruction.
204 Single step 1 instruction (through calls) and show next instruction.
207 List the next 10 instructions from the current IP value
210 Show the last 12 words on stack in hex
213 Show 12 words starting at current BP value in hex
216 target remote /dev/cuaa1
219 Attach to a remote kernel via /dev/cuaa0
223 p (char *)curproc->p_comm
226 Print the command name of the current process
229 set $bp = (struct buf *) $arg0
231 printf " Buffer at 0x%x: dev 0x%x data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
233 $bp->b_dev->si_udev, \
239 printf " Buffer at 0x%x: dev (none) data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
246 printf " flags 0x%x: ", $bp->b_flags
247 if $bp->b_flags & 0x10
250 if $bp->b_flags & 0x40
253 if $bp->b_flags & 0x200
256 if $bp->b_flags & 0x800
259 if $bp->b_flags & 0x40000
262 if $bp->b_flags & 0x100000
268 set $bp = (struct buf *) $arg0
273 printf "\nb_qindex: "
275 printf "\nb_usecount: "
276 output $bp->b_usecount
279 printf "\nb_bufsize: "
280 output $bp->b_bufsize
281 printf "\nb_bcount: "
289 printf "\nb_kvasize: "
290 output $bp->b_kvasize
291 printf "\nb_lblkno: "
295 printf "\nb_iodone: "
299 printf "\nb_dirtyoff: "
300 output $bp->b_dirtyoff
301 printf "\nb_dirtyend: "
302 output $bp->b_dirtyend
303 printf "\nb_generation: "
304 output $bp->b_generation
305 printf "\nb_validoff: "
306 output $bp->b_validoff
307 printf "\nb_validend: "
308 output $bp->b_validend
309 printf "\nb_pblkno: "
311 printf "\nb_saveaddr: "
312 output $bp->b_saveaddr
313 printf "\nb_savekva: "
314 output $bp->b_savekva
315 printf "\nb_driver1: "
316 output $bp->b_driver1
317 printf "\nb_driver2: "
318 output $bp->b_driver2
321 printf "\nb_npages: "
329 printf "Buffer data:\n%s", (char *) bp->b_data
332 Show the contents (char*) of bp->data in the current frame.
335 Show information about the buffer header pointed to by the
336 variable bp in the current frame.
339 Show summary information about the buffer header (struct bp) pointed
343 Show detailled information about the buffer header (struct bp) pointed
347 Show detailled information about the buffer header (struct bp) pointed
348 at by the local variable bp.
351 printf "\n b_vnbufs "
352 output/x bp->b_vnbufs
353 printf "\n b_freelist "
354 output/x bp->b_freelist
359 printf "\n b_qindex "
360 output/x bp->b_qindex
361 printf "\n b_usecount "
362 output/x bp->b_usecount
365 printf "\n b_bufsize "
366 output/x bp->b_bufsize
367 printf "\n b_bcount "
368 output/x bp->b_bcount
375 printf "\n b_kvasize "
376 output/x bp->b_kvasize
379 printf "\n b_iodone_chain "
380 output/x bp->b_iodone_chain
383 printf "\n b_dirtyoff "
384 output/x bp->b_dirtyoff
385 printf "\n b_validoff "
386 output/x bp->b_validoff
390 set boothowto=0x80000000
398 set $aproc = allproc.lh_first
399 set $proc = allproc.lh_first
400 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
401 while (--$nproc >= 0)
402 set $pptr = $proc.p_pptr
407 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
408 $proc.p_pid, $aproc, \
409 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
410 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
414 printf "%s ", $proc.p_wmesg
416 printf "%x", $proc.p_wchan
420 set $aproc = $proc.p_list.le_next
421 if ($aproc == 0 && $nproc > 0)
422 set $aproc = zombproc
428 "ps" -- when kernel debugging, type out a ps-like listing of active processes.
432 set $aproc = allproc.lh_first
433 set $proc = allproc.lh_first
434 while (--$nproc >= 0)
435 set $pptr = $proc.p_pptr
436 if ($proc->p_pid == $arg0)
437 set $pcba = $pptr->p_addr->u_pcb
438 printf "ip: %08x sp: %08x bp: %08x bx: %08x\n", $pcba->pcb_eip, $pcba->pcb_esp, $pcba->pcb_ebp, $pcba->pcb_ebx
442 set $aproc = $proc.p_list.le_next
443 if ($aproc == 0 && $nproc > 0)
444 set $aproc = zombproc
450 Show some pcb contents of process whose pid is specified.
455 while (*(int *) $frame > 0xc0000000)
456 set $myebp = *(int *) $frame
457 set $myeip = *(int *) ($frame + 4)
458 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
465 Show a backtrace from the ebp address specified. This can be used to
466 get a backtrace from any stack resident in memory.
470 set $aproc = allproc.lh_first
471 set $proc = allproc.lh_first
472 while (--$nproc >= 0)
473 if ($proc->p_pid == $arg0)
474 btr $proc->p_addr->u_pcb->pcb_ebp
477 set $aproc = $proc.p_list.le_next
478 if ($aproc == 0 && $nproc > 0)
479 set $aproc = zombproc
486 Show a backtrace for the process whose pid is specified as a parameter.
490 set $aproc = allproc.lh_first
491 set $proc = allproc.lh_first
492 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
493 while (--$nproc >= 0)
494 set $pptr = $proc.p_pptr
499 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
500 $proc.p_pid, $aproc, \
501 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
502 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
506 printf "%s ", $proc.p_wmesg
508 printf "%x", $proc.p_wchan
511 if ($proc->p_flag & 4)
512 btr $proc->p_addr->u_pcb->pcb_ebp
517 set $aproc = $proc.p_list.le_next
518 if ($aproc == 0 && $nproc > 0)
519 set $aproc = zombproc
525 Show backtraces for all processes in the system.
528 if ($myvectorproc->p_flag & 4)
529 btr $myvectorproc->p_addr->u_pcb->pcb_ebp
535 Show a backtrace for the process previously selected with 'defproc'.
539 set $aproc = allproc.lh_first
540 set $proc = allproc.lh_first
541 while (--$nproc >= 0)
542 if ($proc->p_pid == $arg0)
543 set $pptr = $proc.p_pptr
547 set $myvectorproc = $proc
549 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
550 $proc.p_pid, $aproc, \
551 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
552 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
556 printf "%s ", $proc.p_wmesg
558 printf "%x", $proc.p_wchan
565 set $proc = $proc.p_list.le_next
570 Specify a process for btpp and fr commands.
575 if ($myvectorproc->p_flag & 4)
576 set $frame = $myvectorproc->p_addr->u_pcb->pcb_ebp
577 while (($searching == 1) && (*(int *) $frame > 0xc0000000))
578 set $myebp = *(int *) $frame
579 set $myeip = *(int *) ($frame + 4)
581 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
583 printf "Called from %8x, stack frame at %8x\n", *(int *) ($myebp+4), *(int *) $myebp
584 printf "last 20 local variables:\n"
586 printf "call parameters:\n"
595 echo frame not found\n
598 printf "process %d is not loaded in memory\n", $myvectorproc->p_pid
602 Show the frame of the stack of the process previously selected with 'defproc'.
607 if (vp->v_type == VBLK)
608 p *vp->v_un.vu_spec.vu_specinfo
609 printf "numoutput: %d\n", vp->v_numoutput
611 echo "Not a block device"
615 Show some information of the vnode pointed to by the local variable vp.
618 echo Check your .gdbinit, it contains a y command\n
621 set $file = files.tqh_first
622 printf "Id Refs Address Size Name\n"
624 printf "%2d %4d 0x%8x %8x %s\n", \
630 set $file = $file->link.tqe_next
634 Equivalent of the kldstat(9) command, without options.
637 printf "%s", msgbufp->msg_ptr
640 Print the system message buffer (dmesg). This can take a long time due to the time it takes to transmit the data across a serial line.