Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2013 09:46:27 +0100
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Kirk McKusick <mckusick@mckusick.com>, Adrian Chadd <adrian@freebsd.org>, Andriy Gapon <avg@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: Proposal: Unify printing the function name in panic messages()
Message-ID:  <511CA463.6070407@gmx.de>
In-Reply-To: <201302111705.08350.jhb@freebsd.org>
References:  <51141E33.4080103@gmx.de> <201302111203.19422.jhb@freebsd.org> <CAJ-Vmokt%2Byq7WMpW0S5Kzy7y1EFGU6g6pHt=QuoZ-zs%2BG-U0BQ@mail.gmail.com> <201302111705.08350.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?511CA463.6070407>