From owner-freebsd-arch@FreeBSD.ORG Thu Feb 14 08:47:27 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 18274600 for ; Thu, 14 Feb 2013 08:47:27 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by mx1.freebsd.org (Postfix) with ESMTP id AC01BE76 for ; Thu, 14 Feb 2013 08:47:25 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.35]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0Lqod2-1Ub8gW3PkY-00ePF8 for ; Thu, 14 Feb 2013 09:47:18 +0100 Received: (qmail invoked by alias); 14 Feb 2013 08:47:12 -0000 Received: from p5B1328E8.dip.t-dialin.net (EHLO rotluchs.lokal) [91.19.40.232] by mail.gmx.net (mp035) with SMTP; 14 Feb 2013 09:47:12 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX19u62orr0FuY3IKKTAiyff4MP4ukpjejqyRNAhqbh sm+ewTVcOwJ29a Message-ID: <511CA463.6070407@gmx.de> Date: Thu, 14 Feb 2013 09:46:27 +0100 From: Christoph Mallon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130129 Thunderbird/17.0.2 MIME-Version: 1.0 To: John Baldwin Subject: Re: Proposal: Unify printing the function name in panic messages() References: <51141E33.4080103@gmx.de> <201302111203.19422.jhb@freebsd.org> <201302111705.08350.jhb@freebsd.org> In-Reply-To: <201302111705.08350.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: Kirk McKusick , Adrian Chadd , Andriy Gapon , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2013 08:47:27 -0000 On 11.02.2013 23:05, John Baldwin wrote: > On Monday, February 11, 2013 4:20:00 pm Adrian Chadd wrote: >> Whoa, whoa. >> >> Are you seriously trying to argue that having a consistent file:line >> isn't a really helpful addition to panic messages? >> >> Yes, you can get it via the crash IP and use of binutils on the kernel >> image. But with modules? You have to fire up kgdb, and that requires a >> dump _and_ a kgdb that matches the kernel image in question. >> >> Even if you don't add it to the panic message, having that information >> passed into panic() so it can print out a file:line would be great. > > He isn't adding that, he's adding __func__, and it isn't a fool proof > replacement. I simply chose __func__, because this is what the majority of panic() calls does (or at least tries to do). One big benefit of the PANIC() macros is, that now there is one central place to define what location info is printed. file and line: #define PANIC(fmt, ...) panic("%s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__) or we can go the full assert(3) way: #define PANIC(fmt, ...) panic(fmt ", function %s, file %s, line %d.", ##__VA_ARGS__, __func__, __FILE__, __LINE__) we can even paint it TARDIS blue: #define PANIC(fmt, ...) panic("\33[34m" fmt "\33[0m", ##__VA_ARGS__) but considering the length of the thread, we are way past this point. Christoph