mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-07 20:17:25 +08:00
eh_personality.cc (__cxa_call_unexpected): Take void*.
* 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. From-SVN: r47132
This commit is contained in:
parent
ed19322d0c
commit
74a3070ffa
@ -1,3 +1,19 @@
|
||||
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.
|
||||
|
@ -78,6 +78,7 @@ sources = \
|
||||
eh_personality.cc \
|
||||
eh_terminate.cc \
|
||||
eh_throw.cc \
|
||||
eh_type.cc \
|
||||
new_handler.cc \
|
||||
new_op.cc \
|
||||
new_opnt.cc \
|
||||
|
@ -206,6 +206,7 @@ sources = \
|
||||
eh_personality.cc \
|
||||
eh_terminate.cc \
|
||||
eh_throw.cc \
|
||||
eh_type.cc \
|
||||
new_handler.cc \
|
||||
new_op.cc \
|
||||
new_opnt.cc \
|
||||
@ -287,15 +288,16 @@ libsupc__convenience_la_LDFLAGS =
|
||||
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)
|
||||
|
@ -509,6 +509,11 @@ char *__cxa_demangle (const char *__mangled_name,
|
||||
__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'. */
|
||||
|
@ -35,8 +35,11 @@ using namespace __cxxabiv1;
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
@ -399,8 +399,11 @@ PERSONALITY_FUNCTION (int version,
|
||||
}
|
||||
|
||||
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
|
||||
|
49
libstdc++-v3/libsupc++/eh_type.cc
Normal file
49
libstdc++-v3/libsupc++/eh_type.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// -*- 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
|
@ -95,6 +95,12 @@ namespace std
|
||||
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
|
||||
|
@ -105,7 +105,7 @@ extern "C" void __cxa_throw (void *thrown_exception,
|
||||
__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));
|
||||
|
||||
@ -118,8 +118,7 @@ extern "C" void __cxa_bad_typeid ();
|
||||
// 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.
|
||||
|
@ -65,9 +65,9 @@ sources = \
|
||||
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)
|
||||
|
||||
@ -84,9 +84,9 @@ libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
|
||||
# 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 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.
|
||||
@ -190,10 +190,10 @@ sources = \
|
||||
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)
|
||||
|
||||
@ -268,7 +268,7 @@ codecvt.lo complex_io.lo functexcept.lo globals.lo ios.lo limits.lo \
|
||||
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)
|
||||
@ -495,9 +495,9 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
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
|
||||
|
82
libstdc++-v3/src/vterminate.cc
Normal file
82
libstdc++-v3/src/vterminate.cc
Normal file
@ -0,0 +1,82 @@
|
||||
// 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
|
Loading…
Reference in New Issue
Block a user