From owner-freebsd-current@FreeBSD.ORG Mon May 19 08:44:24 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B976337B401; Mon, 19 May 2003 08:44:24 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8894A43FAF; Mon, 19 May 2003 08:44:22 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id BAA26073; Tue, 20 May 2003 01:44:13 +1000 Date: Tue, 20 May 2003 01:44:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Ian Dowse In-Reply-To: <200305191029.aa55037@salmon.maths.tcd.ie> Message-ID: <20030520001750.T23718@gamplex.bde.org> References: <200305191029.aa55037@salmon.maths.tcd.ie> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: kgdb missing stack frames X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2003 15:44:25 -0000 On Mon, 19 May 2003, Ian Dowse wrote: > In message <20030519161526.T22357@gamplex.bde.org>, Bruce Evans writes: > >On Sun, 18 May 2003, Ian Dowse wrote: > >> #0 mi_switch () at ../../../kern/kern_synch.c:530 > >> #1 0xc01edb92 in ithread_schedule (ithread=0xc1898280, do_switch=1) > >> at ../../../kern/kern_intr.c:402 > >> #2 0xc034ad43 in sched_ithd (cookie=0xc1898280) > >> at ../../../i386/isa/ithread.c:77 > >> #3 0xc033e242 in cpu_idle () at ../../../i386/i386/machdep.c:1074 > >> #4 0xc01ed16c in idle_proc (dummy=0x0) at ../../../kern/kern_idle.c:11 > >4 > >> #5 0xc01ecea0 in fork_exit (callout=0xc01ed130 , arg=0x0, > >> frame=0x0) at ../../../kern/kern_fork.c:792 > >> > >> i.e, the cpu_idle() frame now appears instead of Xintr14(). > > > >This is no better, since it loses Xintr14()'s frame instead of cpu_idle()'s > >frame. > > True, although Xintr14() doesn't have a real stack frame (and I > don't know to make gdb expand one frame with an associated trap > frame into two frames in the backtrace :-). In the case of traps > (which are more common in bug reports), the frame that actually > caused the trap is generally far more useful than seeing that > calltrap() was called by trap(). Neither do I, but I know that it more or less works in ddb using the magic names "Xintr*" and "calltrap" to decide when to do special frame handling. At least on i386's ddb's special frame handling for interrupts starts working when Xintr* calls the interrupt handler and the interrupt handler sets up its frame. ddb doesn't have the detailed knowledge of the stack state at every instruction in Xintr* that it would need to do better. gdb knows about the magic names too, but apparently doesn't do as much with them as ddb (kvm-fbsd.c seems to only understand tf_eip in trap frames, while db_nextframe() understands tf_ebp and tf_esp too. I may have broken this in kvm-fbsd.c rev.1.9. Rev.1.8 seems to be the last version that references tf_ebp. Rev.1.8 uses code much like the current code that finds tf_eip to find tf_ebp instead. Bruce