+2001-11-18 Jason Merrill <jason@redhat.com>
+
+ * libsupc++/eh_personality.cc (__cxa_call_unexpected): Take void*.
+ * libsupc++/eh_catch.cc (__cxa_begin_catch): Likewise.
+ * libsupc++/unwind-cxx.h: Adjust.
+ * src/Makefile.am (strstream.o): Pass -Wno-deprecated.
+
+ * libsupc++/eh_type.cc (__cxa_current_exception_type): New file.
+ * libsupc++/cxxabi.h: Declare it.
+ * libsupc++/Makefile.am (sources): Add it.
+ * src/vterminate.cc (verbose_terminate_handler): New file.
+ * libsupc++/exception: Declare it.
+ * src/Makefile.am (sources): Add it.
+
+ * src/Makefile.am (VPATH): Check the src directory before the top one.
+
2001-11-16 Paolo Carlini <pcarlini@unitus.it>
* include/bits/stl_deque.h (deque::erase()): Fix memory leak.
eh_personality.cc \
eh_terminate.cc \
eh_throw.cc \
+ eh_type.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
eh_personality.cc \
eh_terminate.cc \
eh_throw.cc \
+ eh_type.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
libsupc__convenience_la_LIBADD =
libsupc__convenience_la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo \
del_opvnt.lo eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo \
-eh_globals.lo eh_personality.lo eh_terminate.lo eh_throw.lo \
+eh_globals.lo eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo \
new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo \
tinfo.lo tinfo2.lo vec.lo
libsupc___la_LDFLAGS =
libsupc___la_LIBADD =
libsupc___la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \
eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo eh_globals.lo \
-eh_personality.lo eh_terminate.lo eh_throw.lo new_handler.lo new_op.lo \
-new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo tinfo2.lo vec.lo
+eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo new_handler.lo \
+new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo \
+tinfo2.lo vec.lo
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
__SIZE_TYPE__ *__length,
int *__status);
+// Returns the type_info for the currently handled exception [15.3/8], or
+// null if there is none.
+extern "C"
+std::type_info *__cxa_current_exception_type ();
+
} /* namespace __cxxabiv1 */
/* User programs should use the alias `abi'. */
extern "C" void *
-__cxa_begin_catch (_Unwind_Exception *exceptionObject)
+__cxa_begin_catch (void *exc_obj_in)
{
+ _Unwind_Exception *exceptionObject
+ = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
+
// ??? Foreign exceptions can't be stacked here, and there doesn't
// appear to be any place to store for __cxa_end_catch to destroy.
}
extern "C" void
-__cxa_call_unexpected (_Unwind_Exception *exc_obj)
+__cxa_call_unexpected (void *exc_obj_in)
{
+ _Unwind_Exception *exc_obj
+ = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
+
__cxa_begin_catch (exc_obj);
// This function is a handler for our exception argument. If we exit
--- /dev/null
+// -*- C++ -*- Exception handling routines for catching.
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of GNU CC.
+//
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <typeinfo>
+#include "unwind-cxx.h"
+
+namespace __cxxabiv1 {
+
+// Returns the type_info for the currently handled exception [15.3/8], or
+// null if there is none.
+extern "C"
+std::type_info *__cxa_current_exception_type ()
+{
+ __cxa_eh_globals *globals = __cxa_get_globals ();
+ __cxa_exception *header = globals->caughtExceptions;
+ if (header)
+ return header->exceptionType;
+ else
+ return 0;
+}
+
+} // namespace __cxxabiv1
bool uncaught_exception() throw();
} // namespace std
+namespace __gnu_cxx {
+ /** A replacement for the standard terminate_handler which prints more
+ information about the terminating exception (if any) on stderr. */
+ void verbose_terminate_handler ();
+} // namespace __gnu_cxx
+
} // extern "C++"
#endif
__attribute__((noreturn));
// Used to implement exception handlers.
-extern "C" void *__cxa_begin_catch (_Unwind_Exception *) throw();
+extern "C" void *__cxa_begin_catch (void *) throw();
extern "C" void __cxa_end_catch ();
extern "C" void __cxa_rethrow () __attribute__((noreturn));
// Handles re-checking the exception specification if unexpectedHandler
// throws, and if bad_exception needs to be thrown. Called from the
// compiler.
-extern "C" void __cxa_call_unexpected (_Unwind_Exception *)
- __attribute__((noreturn));
+extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
// Invokes given handler, dying appropriately if the user handler was
// so inconsiderate as to return.
locale.cc locale-inst.cc localename.cc \
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
- valarray-inst.cc wstring-inst.cc concept-inst.cc
+ valarray-inst.cc wstring-inst.cc concept-inst.cc vterminate.cc
-VPATH = $(top_srcdir):$(top_srcdir)/src
+VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
# deprecated include files.
GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
# Use special rules for the concept-checking instantiations so that all
# the generated template functions are also instantiated. Force the checks
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
locale.cc locale-inst.cc localename.cc \
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
- valarray-inst.cc wstring-inst.cc concept-inst.cc
+ valarray-inst.cc wstring-inst.cc concept-inst.cc vterminate.cc
-VPATH = $(top_srcdir):$(top_srcdir)/src
+VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
locale.lo locale-inst.lo localename.lo collate.lo messages.lo \
moneypunct.lo numpunct.lo time.lo misc-inst.lo stdexcept.lo stl-inst.lo \
string-inst.lo strstream.lo valarray-inst.lo wstring-inst.lo \
-concept-inst.lo
+concept-inst.lo vterminate.lo
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
# Use special rules for the concept-checking instantiations so that all
# the generated template functions are also instantiated. Force the checks
--- /dev/null
+// Verbose terminate_handler -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <exception>
+#include <cstdlib>
+#include <cstdio>
+#include <cxxabi.h>
+
+using namespace std;
+using namespace abi;
+
+namespace __gnu_cxx {
+
+/** This is a replacement for the standard terminate_handler which prints
+ more information about the terminating exception (if any) on stderr. */
+void verbose_terminate_handler ()
+{
+ // Make sure there was an exception; terminate is also called for an
+ // attempt to rethrow when there is no suitable exception.
+ type_info *t = __cxa_current_exception_type ();
+ if (t)
+ {
+ char const *name = t->name ();
+ // Note that "name" is the mangled name.
+
+ {
+ int status = -1;
+ char *dem = 0;
+
+#if 0
+ // Disabled until __cxa_demangle gets the runtime GPL exception.
+ dem = __cxa_demangle (name, 0, 0, &status);
+#endif
+
+ printf ("terminate called after throwing a `%s'\n",
+ status == 0 ? dem : name);
+
+ if (status == 0)
+ free (dem);
+ }
+
+ // If the exception is derived from std::exception, we can give more
+ // information.
+ try { throw; }
+ catch (exception &exc)
+ { fprintf (stderr, " what(): %s\n", exc.what()); }
+ catch (...) { }
+ }
+ else
+ fprintf (stderr, "terminate called without an active exception\n");
+
+ abort ();
+}
+
+} // namespace __gnu_cxx