public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>,
	linux-kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] a more efficient BUG() macro
Date: Sun, 18 Feb 2001 11:01:16 +1100	[thread overview]
Message-ID: <18856.982454476@ocs3.ocs-net> (raw)
In-Reply-To: Your message of "Sat, 17 Feb 2001 13:15:42 -0000." <Pine.LNX.4.21.0102171200530.2029-100000@localhost.localdomain>

On Sat, 17 Feb 2001 13:15:42 +0000 (GMT), 
Hugh Dickins <hugh@veritas.com> 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.


  parent reply	other threads:[~2001-02-18  0:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-17  8:51 [PATCH] a more efficient BUG() macro Paul Gortmaker
2001-02-17 12:26 ` Manfred Spraul
2001-02-17 12:57   ` Pauline Middelink
2001-02-17 13:15 ` Hugh Dickins
2001-02-17 14:22   ` J . A . Magallon
2001-02-17 15:14     ` J . A . Magallon
2001-02-17 17:04       ` [PATCH] conditionalize __io_virt_debug Jeff Garzik
2001-02-18  0:01   ` Keith Owens [this message]
2001-02-18  0:33     ` [PATCH] a more efficient BUG() macro J . A . Magallon
2001-02-18  0:48       ` Keith Owens
2001-02-18  1:33         ` Andrew Morton
2001-02-18  1:37           ` J . A . Magallon
2001-02-18  1:50             ` Andrew Morton
2001-02-18  1:47           ` Keith Owens
2001-02-18 14:27     ` Andi Kleen
2001-02-17 16:37 ` J . A . Magallon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18856.982454476@ocs3.ocs-net \
    --to=kaos@ocs.com.au \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p_gortmaker@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox