Re: [PATCH] BUG() disassembly tweak

Ingo Oeser (ingo.oeser@informatik.tu-chemnitz.de)
Sat, 11 May 2002 13:42:39 +0200


On Sat, May 11, 2002 at 12:51:15AM +0200, Dave Jones wrote:
> On Fri, May 10, 2002 at 03:10:04PM -0700, Linus Torvalds wrote:
> > If it wants to be changed, I'd actually personally prefer it to be changed
> > to take an explicit string instead of using the filename/linenr at all.
[...]
> Failing that, resurrecting the k_assert() idea someone proposed
> (jgarzik?) a few months back.

Oh? I remember many people having objections against assert.

Personally I like BUG_ON() as is and it helped me already
catching a lot of bugs in my own code and removed the need for
several conditions and cleanup code for situation, that happen only
with wrong arguments/corruption and are bugs instead of user
stupidity.

BUG() is usally used, when we need to print much more information
about the error (like dumping some variables, which have wrong
values). In these cases a BUG_PRINTK() would be much more
useful, since most users of BUG() use printk before and only want
to save cleanup code for "impossible" conditions.

Or at least have a variant of BUG(), which has only triggers the
code path aborting, without printing filename/line_no (because
our own debug statements did this already).

Regards

Ingo Oeser

-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
-
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/