From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 7 18:08:37 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 D21A11065673 for ; Wed, 7 Sep 2011 18:08:37 +0000 (UTC) (envelope-from crmartin@sgi.com) Received: from relay.sgi.com (relay1.sgi.com [192.48.179.29]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC9E8FC18 for ; Wed, 7 Sep 2011 18:08:37 +0000 (UTC) Received: from xmail.sgi.com (pv-excas3-dc21-nlb.corp.sgi.com [137.38.102.207]) by relay1.corp.sgi.com (Postfix) with ESMTP id BDAB88F8040 for ; Wed, 7 Sep 2011 11:08:36 -0700 (PDT) Received: from [10.3.0.220] (10.3.0.220) by xmail.sgi.com (137.38.102.30) with Microsoft SMTP Server (TLS) id 14.1.289.1; Wed, 7 Sep 2011 13:08:36 -0500 Message-ID: <4E67B323.8000602@sgi.com> Date: Wed, 7 Sep 2011 12:08:35 -0600 From: Charlie Martin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13 MIME-Version: 1.0 To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.3.0.220] Subject: 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 18:08:37 -0000 I'm still pursuing a FreeBSD bug in "7.2-PRERELEASE FreeBSD" -- and yes, we know this is wildly out of date, but it's not feasible to upgrade right now -- and while trying to backport a fix suggested here http://permalink.gmane.org/gmane.os.freebsd.current/134266 I got a situation where the panic calls in one of these two macros from sys/queue.h #define QMD_LIST_CHECK_NEXT(elm, field) do { \ if (LIST_NEXT((elm), field) != NULL && \ LIST_NEXT((elm), field)->field.le_prev != \ &((elm)->field.le_next)) \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) #define QMD_LIST_CHECK_PREV(elm, field) do { \ if (*(elm)->field.le_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ } while (0) print the message, but *don't* then proceed to drop to the debugger -- instead the system hangs, with the CPU running but I had no luck getting its attention to force it to the debugger. I'm not clear just what could be causing the hangup. For my immediate purposes, I'd be happy with any way in which I could brutally kill the kernel and force it to the debugger, say by replacing the panic call with a printf followed by "1/0;". But I'm a little confused by the panic.c code -- it prints the arguments using a var_args, and then calls "exit(1);' So my questions: (1) will my brutal method actually force what I want or am I misunderstanding something (2) *which* of the several implementations of "int exit(int)" or similar is the one called in the FreeBSD kernel? (3) and how then does exit work? -- Charles R. (Charlie) Martin Senior Software Engineer SGI logo 1900 Pike Road Longmont, CO 80501 Phone: 303-532-0209 E-Mail: CRMartin@sgi.com Website: www.sgi.com