1 # $DragonFly: src/sys/dev/raid/vinum/.gdbinit.kernel,v 1.8 2007/05/09 00:53:34 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:0x%x data 0x%x bcount 0x%x doffset 0x%llx resid 0x%x\n", \
234 $bp->b_dev->si_umajor, \
235 $bp->b_dev->si_uminor, \
238 $bp->b_bio_array[1].bio_offset, \
241 printf " Buffer at 0x%x: dev (none) data 0x%x bcount 0x%x doffset 0x%llx resid 0x%x\n", \
245 $bp->b_bio_array[1].bio_offset, \
248 printf " flags 0x%x: ", $bp->b_flags
249 if $bp->b_flags & 0x10
252 if $bp->b_flags & 0x40
255 if $bp->b_flags & 0x200
258 if $bp->b_flags & 0x800
261 if $bp->b_flags & 0x40000
264 if $bp->b_flags & 0x100000
270 set $bp = (struct buf *) $arg0
275 printf "\nb_qindex: "
277 printf "\nb_usecount: "
278 output $bp->b_usecount
281 printf "\nb_bufsize: "
282 output $bp->b_bufsize
283 printf "\nb_bcount: "
291 printf "\nb_kvasize: "
292 output $bp->b_kvasize
293 printf "\nb_loffset: "
294 output $bp->b_bio_array[0].bio_offset
295 printf "\nb_doffset: "
296 output $bp->b_bio_array[1].bio_offset
297 printf "\nb_iodone: "
298 output $bp->b_bio->bio_done
301 printf "\nb_dirtyoff: "
302 output $bp->b_dirtyoff
303 printf "\nb_dirtyend: "
304 output $bp->b_dirtyend
305 printf "\nb_generation: "
306 output $bp->b_generation
307 printf "\nb_validoff: "
308 output $bp->b_validoff
309 printf "\nb_validend: "
310 output $bp->b_validend
311 printf "\nb_poffset: "
312 output $bp->b_bio_array[2].bio_offset
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
377 printf "\n b_doffset "
378 output/x bp->b_bio_array[1].bio_offset
381 printf "\n b_dirtyoff "
382 output/x bp->b_dirtyoff
383 printf "\n b_validoff "
384 output/x bp->b_validoff
388 set boothowto=0x80000000
396 set $aproc = allproc.lh_first
397 set $proc = allproc.lh_first
398 printf " pid proc uid ppid pgrp flag stat comm wchan\n"
399 while (--$nproc >= 0)
400 set $pptr = $proc.p_pptr
405 printf "%5d %08x %4d %5d %5d %06x %d %-10s ", \
406 $proc.p_pid, $aproc, \
407 $proc.p_cred->p_ruid, $pptr->p_pid, \
408 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
412 printf "%s ", $proc.p_wmesg
414 printf "%x", $proc.p_wchan
418 set $aproc = $proc.p_list.le_next
419 if ($aproc == 0 && $nproc > 0)
420 set $aproc = zombproc
426 "ps" -- when kernel debugging, type out a ps-like listing of active processes.
430 set $aproc = allproc.lh_first
431 set $proc = allproc.lh_first
432 while (--$nproc >= 0)
433 set $pptr = $proc.p_pptr
434 if ($proc->p_pid == $arg0)
435 set $pcba = $pptr->p_addr->u_pcb
436 printf "ip: %08x sp: %08x bp: %08x bx: %08x\n", $pcba->pcb_eip, $pcba->pcb_esp, $pcba->pcb_ebp, $pcba->pcb_ebx
440 set $aproc = $proc.p_list.le_next
441 if ($aproc == 0 && $nproc > 0)
442 set $aproc = zombproc
448 Show some pcb contents of process whose pid is specified.
453 while (*(int *) $frame > 0xc0000000)
454 set $myebp = *(int *) $frame
455 set $myeip = *(int *) ($frame + 4)
456 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
463 Show a backtrace from the ebp address specified. This can be used to
464 get a backtrace from any stack resident in memory.
468 set $aproc = allproc.lh_first
469 set $proc = allproc.lh_first
470 while (--$nproc >= 0)
471 if ($proc->p_pid == $arg0)
472 btr $proc->p_addr->u_pcb->pcb_ebp
475 set $aproc = $proc.p_list.le_next
476 if ($aproc == 0 && $nproc > 0)
477 set $aproc = zombproc
484 Show a backtrace for the process whose pid is specified as a parameter.
488 set $aproc = allproc.lh_first
489 set $proc = allproc.lh_first
490 printf " pid proc uid ppid pgrp flag stat comm wchan\n"
491 while (--$nproc >= 0)
492 set $pptr = $proc.p_pptr
497 printf "%5d %08x %4d %5d %5d %06x %d %-10s ", \
498 $proc.p_pid, $aproc, \
499 $proc.p_cred->p_ruid, $pptr->p_pid, \
500 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
504 printf "%s ", $proc.p_wmesg
506 printf "%x", $proc.p_wchan
509 if ($proc->p_flag & 4)
510 btr $proc->p_addr->u_pcb->pcb_ebp
515 set $aproc = $proc.p_list.le_next
516 if ($aproc == 0 && $nproc > 0)
517 set $aproc = zombproc
523 Show backtraces for all processes in the system.
526 if ($myvectorproc->p_flag & 4)
527 btr $myvectorproc->p_addr->u_pcb->pcb_ebp
533 Show a backtrace for the process previously selected with 'defproc'.
537 set $aproc = allproc.lh_first
538 set $proc = allproc.lh_first
539 while (--$nproc >= 0)
540 if ($proc->p_pid == $arg0)
541 set $pptr = $proc.p_pptr
545 set $myvectorproc = $proc
547 printf "%5d %08x %4d %5d %5d %06x %d %-10s ", \
548 $proc.p_pid, $aproc, \
549 $proc.p_cred->p_ruid, $pptr->p_pid, \
550 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
554 printf "%s ", $proc.p_wmesg
556 printf "%x", $proc.p_wchan
563 set $proc = $proc.p_list.le_next
568 Specify a process for btpp and fr commands.
573 if ($myvectorproc->p_flag & 4)
574 set $frame = $myvectorproc->p_addr->u_pcb->pcb_ebp
575 while (($searching == 1) && (*(int *) $frame > 0xc0000000))
576 set $myebp = *(int *) $frame
577 set $myeip = *(int *) ($frame + 4)
579 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
581 printf "Called from %8x, stack frame at %8x\n", *(int *) ($myebp+4), *(int *) $myebp
582 printf "last 20 local variables:\n"
584 printf "call parameters:\n"
593 echo frame not found\n
596 printf "process %d is not loaded in memory\n", $myvectorproc->p_pid
600 Show the frame of the stack of the process previously selected with 'defproc'.
605 if (vp->v_type == VBLK)
606 p *vp->v_un.vu_cdev.vu_cdevinfo
607 printf "numoutput: %d\n", vp->v_numoutput
609 echo "Not a block device"
613 Show some information of the vnode pointed to by the local variable vp.
616 echo Check your .gdbinit, it contains a y command\n
619 set $file = files.tqh_first
620 printf "Id Refs Address Size Name\n"
622 printf "%2d %4d 0x%8x %8x %s\n", \
628 set $file = $file->link.tqe_next
632 Equivalent of the kldstat(9) command, without options.
635 printf "%s", msgbufp->msg_ptr
638 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.