This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: V3 PATCH to __verbose_terminate_handler


On Thu, Dec 19, 2002 at 11:14:18AM +0100, Gabriel Dos Reis wrote:
> Jason Merrill <jason@redhat.com> writes:
> | 
> | Well, the standard (18.6.3.1) says that the default terminate handler just
> | calls abort().  I suppose that if we're not -ansi, we could link in
> | something like
> | 
> |   #include <exception>
> | 
> |   namespace __gnu_cxx
> |   {
> |     extern void __verbose_terminate_handler ();
> |   }
> | 
> |   struct preload_terminate_dummy
> |   {
> |     preload_terminate_dummy()
> |     { std::set_terminate (__gnu_cxx::__verbose_terminate_handler); }
> |   };
> | 
> |   static preload_terminate_dummy dummy;
> | 
> | to override it; what do you think?
> 
> Terrific!  I'm for it.
> 
> Hmm, do you think it will work with separately compiled files
> with/without -ansi? 

With the code as above, it would only take a single file including
<exception> and compiled without -ansi to turn on verbose-mode.  That seems
a bit too fast and loose.  I really like this idea, but perhaps the user
should still be required to explicitly request it (even if he isn't required
to actually write the code in his program).  Alternatives such as having
the ctor do

    if (getenv("GCC_VERBOSE_TERMINATE"))
        std::set_terminate (__gnu_cxx::__verbose_terminate_handler);

would seem to have too much of a speed impact on startup, I would think.


> What do others think?

I've been thinking about having some ancilliary .so's around, so that

    % LD_PRELOAD=..../verbose_terminate.so a.out

would be possible.

Anybody else?


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]