Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 17 Feb 2001 19:01:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 17 Feb 2001 19:01:26 -0500 Received: from ppp0.ocs.com.au ([203.34.97.3]:10770 "HELO mail.ocs.com.au") by vger.kernel.org with SMTP id ; Sat, 17 Feb 2001 19:01:23 -0500 X-Mailer: exmh version 2.1.1 10/15/1999 From: Keith Owens To: Hugh Dickins cc: Paul Gortmaker , linux-kernel list Subject: Re: [PATCH] a more efficient BUG() macro In-Reply-To: Your message of "Sat, 17 Feb 2001 13:15:42 -0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 18 Feb 2001 11:01:16 +1100 Message-ID: <18856.982454476@ocs3.ocs-net> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Feb 2001 13:15:42 +0000 (GMT), Hugh Dickins wrote: >On Sat, 17 Feb 2001, Paul Gortmaker wrote: >> Anyway this small patch makes sure there is only one "kernel BUG..." string, >> and dumps __FILE__ in favour of an address value since System.map data is >> needed to make full use of the BUG() dump anyways. The memory stats of two >> otherwise identical kernels: >substitute INLINE_BUG() in inline functions, but use your macro >(with 0x%p address) for it instead of mine. What do others think? >Keith, does the address format need adjusting to suit ksymoops? I would prefer to see extern const char *kernel_bug; printk(kernel_bug, __C_FILE__, __C_LINE__) init/main.c contains const char *kernel_bug = "kernel BUG at %s:%d!\n"; kernel_bug is also exported. __C_FILE__ and __C_LINE__ refer to the .c or .s file that included the header, so you get the exact location of the failing code instead of the name and line number of a common header which is used all over the place. __C_FILE__ would be replaced with the minimum string required to uniquely identify the file, e.g. isdn_audio.c (unique at one level) or romfs/inode.c (unique at two levels). Standard gcc will not do this. But as part of my makefile rewrite I am reading the pre-processed output as it is generated by cpp and before it is read by cc1, to extract data for module symbol versions. It is trivial for my code to look for __C_FILE__ and __C_LINE__ (cpp will have left them alone) and replace them with the relevant string and number. Would people prefer the C/ASM filename in BUG() messages instead of the include header? If so I will add it to my todo list for the makefile rewrite. Of course you can still use __FILE__ and __LINE_ if you really want to report the error against the include file. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/