Re: [PATCH] BUG preserve registers

Brian Gerst
2002-02-10T04:21:26Z

Linus Torvalds wrote:
>
> On Sat, 9 Feb 2002, Andrew Morton wrote:
> > >
> >
> > Is better, except the filename gets expanded multipe times into
> > the object file. How about:
> >
> > #define BUG() \
> > asm( "ud2\n" \
> > "\t.word %0\n" \
> > "\t.long %1\n" \
> > : : "i" (__LINE__), "i" (__FILE__))
>
> Even better.
>
> That way you can actually totally remove the "verbose bug" config option,
> because even the verbose BUG's aren't actually using up any noticeable
> amounts of space.
>
> This is all assuming that gcc doesn't create the string for inline
> functions that aren't used, which it probably cannot, so maybe this
> doesn't work out.
>
> Linus

Note that if you're going to do this you may want to use another vector
(ie. int $0x82) instead of the undefined opcode. That way you know for
certain that there will be valid debugging info following.

--

Brian Gerst