From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 7 19:50:51 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A3001065670 for ; Wed, 7 Sep 2011 19:50:51 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-qw0-f44.google.com (mail-qw0-f44.google.com [209.85.216.44]) by mx1.freebsd.org (Postfix) with ESMTP id BAE898FC0C for ; Wed, 7 Sep 2011 19:50:50 +0000 (UTC) Received: by qwg2 with SMTP id 2so12839qwg.17 for ; Wed, 07 Sep 2011 12:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=OaHr1A1FdcpVlOjls0HIH/mAfMAGxb1oP+N/xQy9keM=; b=aa9E+5DXUynAiifDoEeZBPuB3qdOIWwHKTAOeDhGPbb7JmeXzjFEa+vt/OAXSMOnrs lX9Bay41dEUGyiV7n4rQ0dhcoHjo5sOYyC0Dy/Z4XOdr8+5epMqXTN4Ox2ShJijVJqIp GTChzigJfzWLtdJUwjkmvyttv/CmfGjkn8tjo= MIME-Version: 1.0 Received: by 10.229.87.137 with SMTP id w9mr5073593qcl.284.1315425049919; Wed, 07 Sep 2011 12:50:49 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.229.190.194 with HTTP; Wed, 7 Sep 2011 12:50:49 -0700 (PDT) In-Reply-To: <4E67C4E6.40009@sgi.com> References: <4E67B323.8000602@sgi.com> <4E67C4E6.40009@sgi.com> Date: Wed, 7 Sep 2011 12:50:49 -0700 X-Google-Sender-Auth: jHfiRpExJPo8C3AAHALp-5OSnM4 Message-ID: From: mdf@FreeBSD.org To: Charlie Martin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: Understanding panic and exit in the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 19:50:51 -0000 On Wed, Sep 7, 2011 at 12:24 PM, Charlie Martin wrote: > > > On 2011-09-07 12:53, mdf@FreeBSD.org wrote: >>> >>> For my immediate purposes, I'd be happy with any way in which I could >>> > =A0brutally kill the kernel and force it to the debugger, say by >>> > replacing the >>> > =A0panic call with a printf followed by "1/0;". =A0But I'm a little >>> > confused by >>> > =A0the panic.c code -- it prints the arguments using a var_args, and = then >>> > calls >>> > =A0"exit(1);' >> >> What file are you looking in? =A0The kernel panic() is in >> sys/kern/kern_shutdown.c, not sys/boot/common/panic.c. =A0It will >> optionally call kdb_enter_why() and then boot(). > > Bingo, that's got to help. =A0This makes a lot more sense. > >> Do you have the debug.debugger_on_panic sysctl set to 1? > > Yes -- and panic does so *except* in the version with those changes to > queue.h. If all you need to get started is a backtrace then debug.trace_on_panic=3D1 may be sufficient. I'm not sure of the timeline when 7.2-prerelease was issued, but there have been some reliability improvements to panic handling including marking that a CPU is in panic, etc., that may have come after 7.2-prerelease. You may want to look at the svn history for kern_shutdown.c and locally apply those changes to see if it changes your result. Cheers, matthew