1 # $DragonFly: src/sys/dev/raid/vinum/.gdbinit.kernel,v 1.3 2006/02/17 19:18:06 dillon Exp $
27 output (((int)$ebp)-(int)$esp)/4-4
28 printf " words on stack)\n ebp: "
34 printf " (maximum of "
35 output ((*(int*)$ebp)-(int)$ebp)/4-4
36 printf " parameters possible)\nSaved eip: "
39 output/x (int) ($ebp+8)
41 output (char*) *(int*)($ebp+8)
43 output/x (int) ($ebp+12)
45 output (char*) *(int*)($ebp+12)
47 output/x (int) ($ebp+16)
49 output (char*) *(int*)($ebp+16)
51 output/x (int) ($ebp+20)
53 output (char*) *(int*)($ebp+20)
57 Show the register contents and the first four parameter
58 words of the current frame.
69 printf " (maximum of "
70 output ((*(int*)$ebp)-(int)$ebp)/4-4
71 printf " parameters possible)\nSaved eip: "
74 output/x (int) ($ebp+8)
76 output (char*) *(int*)($ebp+8)
78 output/x (int) ($ebp+12)
80 output (char*) *(int*)($ebp+12)
82 output/x (int) ($ebp+16)
84 output (char*) *(int*)($ebp+16)
86 output/x (int) ($ebp+20)
88 output (char*) *(int*)($ebp+20)
90 output/x (int) ($ebp+24)
92 output (char*) *(int*)($ebp+24)
94 output/x (int) ($ebp+28)
96 output (char*) *(int*)($ebp+28)
98 output/x (int) ($ebp+32)
100 output (char*) *(int*)($ebp+32)
101 printf "\nParm 8 at "
102 output/x (int) ($ebp+36)
104 output (char*) *(int*)($ebp+36)
105 printf "\nParm 9 at "
106 output/x (int) ($ebp+40)
108 output (char*) *(int*)($ebp+40)
109 printf "\nParm 10 at "
110 output/x (int) ($ebp+44)
112 output (char*) *(int*)($ebp+44)
116 Show the register contents and the first ten parameter
117 words of the current frame.
125 x/12x *(int*)($ebp+4)
130 x/12x *(int*)($ebp+8)
135 x/12x *(int*)($ebp+12)
140 x/12x *(int*)($ebp+16)
145 Show the first parameter of current stack frame in various formats
148 Show the second parameter of current stack frame in various formats
151 Show the third parameter of current stack frame in various formats
154 Show the fourth parameter of current stack frame in various formats
157 Show the fifth parameter of current stack frame in various formats
184 Select stack frame 0 and show assembler-level details
187 Select stack frame 1 and show assembler-level details
190 Select stack frame 2 and show assembler-level details
193 Select stack frame 3 and show assembler-level details
196 Select stack frame 4 and show assembler-level details
199 Select stack frame 5 and show assembler-level details
202 Single step 1 instruction (over calls) and show next instruction.
205 Single step 1 instruction (through calls) and show next instruction.
208 List the next 10 instructions from the current IP value
211 Show the last 12 words on stack in hex
214 Show 12 words starting at current BP value in hex
217 target remote /dev/cuaa1
220 Attach to a remote kernel via /dev/cuaa0
224 p (char *)curproc->p_comm
227 Print the command name of the current process
230 set $bp = (struct buf *) $arg0
232 printf " Buffer at 0x%x: dev 0x%x data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
234 $bp->b_dev->si_udev, \
237 $bp->b_bio->bio_blkno, \
240 printf " Buffer at 0x%x: dev (none) data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
244 $bp->b_bio->bio_blkno, \
247 printf " flags 0x%x: ", $bp->b_flags
248 if $bp->b_flags & 0x10
251 if $bp->b_flags & 0x40
254 if $bp->b_flags & 0x200
257 if $bp->b_flags & 0x800
260 if $bp->b_flags & 0x40000
263 if $bp->b_flags & 0x100000
269 set $bp = (struct buf *) $arg0
274 printf "\nb_qindex: "
276 printf "\nb_usecount: "
277 output $bp->b_usecount
280 printf "\nb_bufsize: "
281 output $bp->b_bufsize
282 printf "\nb_bcount: "
290 printf "\nb_kvasize: "
291 output $bp->b_kvasize
292 printf "\nb_lblkno: "
295 output $bp->b_bio->bio_blkno
296 printf "\nb_iodone: "
297 output $bp->b_bio->bio_done
300 printf "\nb_dirtyoff: "
301 output $bp->b_dirtyoff
302 printf "\nb_dirtyend: "
303 output $bp->b_dirtyend
304 printf "\nb_generation: "
305 output $bp->b_generation
306 printf "\nb_validoff: "
307 output $bp->b_validoff
308 printf "\nb_validend: "
309 output $bp->b_validend
310 printf "\nb_pblkno: "
312 printf "\nb_saveaddr: "
313 output $bp->b_saveaddr
314 printf "\nb_savekva: "
315 output $bp->b_savekva
316 printf "\nb_driver1: "
317 output $bp->b_driver1
318 printf "\nb_driver2: "
319 output $bp->b_driver2
322 printf "\nb_npages: "
330 printf "Buffer data:\n%s", (char *) bp->b_data
333 Show the contents (char*) of bp->data in the current frame.
336 Show information about the buffer header pointed to by the
337 variable bp in the current frame.
340 Show summary information about the buffer header (struct bp) pointed
344 Show detailled information about the buffer header (struct bp) pointed
348 Show detailled information about the buffer header (struct bp) pointed
349 at by the local variable bp.
352 printf "\n b_vnbufs "
353 output/x bp->b_vnbufs
354 printf "\n b_freelist "
355 output/x bp->b_freelist
360 printf "\n b_qindex "
361 output/x bp->b_qindex
362 printf "\n b_usecount "
363 output/x bp->b_usecount
366 printf "\n b_bufsize "
367 output/x bp->b_bufsize
368 printf "\n b_bcount "
369 output/x bp->b_bcount
376 printf "\n b_kvasize "
377 output/x bp->b_kvasize
379 output/x bp->b_bio->bio_blkno
382 printf "\n b_dirtyoff "
383 output/x bp->b_dirtyoff
384 printf "\n b_validoff "
385 output/x bp->b_validoff
389 set boothowto=0x80000000
397 set $aproc = allproc.lh_first
398 set $proc = allproc.lh_first
399 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
400 while (--$nproc >= 0)
401 set $pptr = $proc.p_pptr
406 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
407 $proc.p_pid, $aproc, \
408 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
409 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
413 printf "%s ", $proc.p_wmesg
415 printf "%x", $proc.p_wchan
419 set $aproc = $proc.p_list.le_next
420 if ($aproc == 0 && $nproc > 0)
421 set $aproc = zombproc
427 "ps" -- when kernel debugging, type out a ps-like listing of active processes.
431 set $aproc = allproc.lh_first
432 set $proc = allproc.lh_first
433 while (--$nproc >= 0)
434 set $pptr = $proc.p_pptr
435 if ($proc->p_pid == $arg0)
436 set $pcba = $pptr->p_addr->u_pcb
437 printf "ip: %08x sp: %08x bp: %08x bx: %08x\n", $pcba->pcb_eip, $pcba->pcb_esp, $pcba->pcb_ebp, $pcba->pcb_ebx
441 set $aproc = $proc.p_list.le_next
442 if ($aproc == 0 && $nproc > 0)
443 set $aproc = zombproc
449 Show some pcb contents of process whose pid is specified.
454 while (*(int *) $frame > 0xc0000000)
455 set $myebp = *(int *) $frame
456 set $myeip = *(int *) ($frame + 4)
457 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
464 Show a backtrace from the ebp address specified. This can be used to
465 get a backtrace from any stack resident in memory.
469 set $aproc = allproc.lh_first
470 set $proc = allproc.lh_first
471 while (--$nproc >= 0)
472 if ($proc->p_pid == $arg0)
473 btr $proc->p_addr->u_pcb->pcb_ebp
476 set $aproc = $proc.p_list.le_next
477 if ($aproc == 0 && $nproc > 0)
478 set $aproc = zombproc
485 Show a backtrace for the process whose pid is specified as a parameter.
489 set $aproc = allproc.lh_first
490 set $proc = allproc.lh_first
491 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
492 while (--$nproc >= 0)
493 set $pptr = $proc.p_pptr
498 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
499 $proc.p_pid, $aproc, \
500 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
501 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
505 printf "%s ", $proc.p_wmesg
507 printf "%x", $proc.p_wchan
510 if ($proc->p_flag & 4)
511 btr $proc->p_addr->u_pcb->pcb_ebp
516 set $aproc = $proc.p_list.le_next
517 if ($aproc == 0 && $nproc > 0)
518 set $aproc = zombproc
524 Show backtraces for all processes in the system.
527 if ($myvectorproc->p_flag & 4)
528 btr $myvectorproc->p_addr->u_pcb->pcb_ebp
534 Show a backtrace for the process previously selected with 'defproc'.
538 set $aproc = allproc.lh_first
539 set $proc = allproc.lh_first
540 while (--$nproc >= 0)
541 if ($proc->p_pid == $arg0)
542 set $pptr = $proc.p_pptr
546 set $myvectorproc = $proc
548 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
549 $proc.p_pid, $aproc, \
550 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
551 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
555 printf "%s ", $proc.p_wmesg
557 printf "%x", $proc.p_wchan
564 set $proc = $proc.p_list.le_next
569 Specify a process for btpp and fr commands.
574 if ($myvectorproc->p_flag & 4)
575 set $frame = $myvectorproc->p_addr->u_pcb->pcb_ebp
576 while (($searching == 1) && (*(int *) $frame > 0xc0000000))
577 set $myebp = *(int *) $frame
578 set $myeip = *(int *) ($frame + 4)
580 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
582 printf "Called from %8x, stack frame at %8x\n", *(int *) ($myebp+4), *(int *) $myebp
583 printf "last 20 local variables:\n"
585 printf "call parameters:\n"
594 echo frame not found\n
597 printf "process %d is not loaded in memory\n", $myvectorproc->p_pid
601 Show the frame of the stack of the process previously selected with 'defproc'.
606 if (vp->v_type == VBLK)
607 p *vp->v_un.vu_spec.vu_specinfo
608 printf "numoutput: %d\n", vp->v_numoutput
610 echo "Not a block device"
614 Show some information of the vnode pointed to by the local variable vp.
617 echo Check your .gdbinit, it contains a y command\n
620 set $file = files.tqh_first
621 printf "Id Refs Address Size Name\n"
623 printf "%2d %4d 0x%8x %8x %s\n", \
629 set $file = $file->link.tqe_next
633 Equivalent of the kldstat(9) command, without options.
636 printf "%s", msgbufp->msg_ptr
639 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.