I noticed recently two problems with gdb/ddb traces that involve an interrupt frame (both of these are in i386-specific code, but maybe similar issues exist on other architectures):
The first is that kgdb sometimes messes up a stack frame that includes an interrupt, e.g in the trace below, the cpu_idle() frame is corrupted. #7 0xc0325246 in siointr1 (com=0xc092a400) at machine/cpufunc.h:63 #8 0xc0325137 in siointr (arg=0xc092a400) at ../../../isa/sio.c:1859 #9 0x8 in ?? () #10 0xc01ff391 in idle_proc (dummy=0x0) at ../../../kern/kern_idle.c:99 #11 0xc01ff210 in fork_exit (callout=0xc01ff370 <idle_proc>, arg=0x0, frame=0xc40ffd48) at ../../../kern/kern_fork.c:785 This is because gdb was never updated when cpl was removed from the interrupt frame (ddb was changed in i386/i386/db_trace.c rev 1.37). The following patch seems to fix it: Index: gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c,v retrieving revision 1.27 diff -u -r1.27 kvm-fbsd.c --- gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c 19 Sep 2001 18:42:19 -0000 1.27 +++ gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c 7 Oct 2001 19:45:28 -0000 @@ -176,7 +176,7 @@ return (read_memory_integer (fr->frame + 8 + oEIP, 4)); case tf_interrupt: - return (read_memory_integer (fr->frame + 16 + oEIP, 4)); + return (read_memory_integer (fr->frame + 12 + oEIP, 4)); case tf_syscall: return (read_memory_integer (fr->frame + 8 + oEIP, 4)); Secondly, fast interrupts do not have an XresumeN style of symbol, so neither gdb nor ddb treat their frames as interrupt frames. This causes the frame listed as XfastintrN to gobble up the frame that was executing at the time of the interrupt, which is especially annoying when a serial console is being used to debug an infinite loop in the kernel. The following patch adds an XresumefastN to fast interrupt handlers, which allows gdb and ddb to correctly see the missing frame. The name Xresumefast is chosen because it involves no ddb or gdb changes (they just check for a name beginning with "Xresume"). Any comments? Ian Index: sys/i386/isa/icu_vector.s =================================================================== RCS file: /dump/FreeBSD-CVS/src/sys/i386/isa/icu_vector.s,v retrieving revision 1.29 diff -u -r1.29 icu_vector.s --- sys/i386/isa/icu_vector.s 12 Sep 2001 08:37:34 -0000 1.29 +++ sys/i386/isa/icu_vector.s 7 Oct 2001 19:48:06 -0000 @@ -60,6 +60,7 @@ mov %ax,%es ; \ mov $KPSEL,%ax ; \ mov %ax,%fs ; \ +__CONCAT(Xresumefast,irq_num): ; \ FAKE_MCOUNT((12+ACTUALLY_PUSHED)*4(%esp)) ; \ movl PCPU(CURTHREAD),%ebx ; \ incl TD_INTR_NESTING_LEVEL(%ebx) ; \ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message