From owner-freebsd-hackers Tue Nov 9 14:17:22 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id D50471515E for ; Tue, 9 Nov 1999 14:17:03 -0800 (PST) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (cs1-gw.cs.binghamton.edu [128.226.171.72]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with SMTP id RAA03283; Tue, 9 Nov 1999 17:16:53 -0500 (EST) Date: Tue, 9 Nov 1999 16:04:34 -0500 (EST) From: Zhihui Zhang To: Greg Lehey , archie@whistle.com Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to use gdb to catch a panic In-Reply-To: <19991109164507.31840@mojave.sitaranetworks.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 9 Nov 1999, Greg Lehey wrote: > On Tuesday, 9 November 1999 at 13:36:56 -0800, Archie Cobbs wrote: > > Zhihui Zhang writes: > >> Thanks for your reply. What confuses me is that when I use commands "gdb" > >> (enter remote protocol mode) and "step" on the target machine, the > >> debugging machine takes control (it executes "target remote /dev/cuaa1"). > >> In this case, how can I run anything on the target machine to trigger a > >> panic? > > > > I'm not sure if this answers your question, but the command > > > > sysctl -w debug.cebugger=1 > > > > will cause the kernel to stop and return your gdb prompt. > > Then you could call the function panic() directly if you wanted. > > Take a look at /usr/src/sys/modules/vinum/.gdbinit.kernel. There's > some almost undocumented stuff in there, including a macro called > ddb. Call it from gdb and it'll switch back to ddb. > > Greg > -- Thanks! I will certainly look into them. In the same time, I add a sysctl variable and let my program calls Debugger("some string") if that sysctl variable is true. It seems working. I hope someone will write a hacker's book. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message