Commit afc3bb58 by Mark Mitchell Committed by Mark Mitchell

* libsupc++/vterminate.cc

	(__gnu_cxx::__verbose_terminate_handler): Guard against recursive
	calls to terminate.
	* src/demangle.cc (__cxa_demangle): Wrap in try-catch block.

From-SVN: r78235
parent e1efc7a0
2004-02-21 Mark Mitchell <mark@codesourcery.com> 2004-02-21 Mark Mitchell <mark@codesourcery.com>
* libsupc++/vterminate.cc
(__gnu_cxx::__verbose_terminate_handler): Guard against recursive
calls to terminate.
* src/demangle.cc (__cxa_demangle): Wrap in try-catch block.
* testsuite/testsuite_hooks.cc (__gnu_test::set_memory_limits): Do
not set RLIMIT_AS on HP-UX.
2004-02-21 Mark Mitchell <mark@codesourcery.com>
* testsuite/testsuite_hooks.cc (__gnu_test::set_memory_limits): Do * testsuite/testsuite_hooks.cc (__gnu_test::set_memory_limits): Do
not set RLIMIT_AS on HP-UX. not set RLIMIT_AS on HP-UX.
......
...@@ -51,6 +51,16 @@ namespace __gnu_cxx ...@@ -51,6 +51,16 @@ namespace __gnu_cxx
stderr. */ stderr. */
void __verbose_terminate_handler() void __verbose_terminate_handler()
{ {
static bool terminating;
if (terminating)
{
writestr ("terminate called recursively\n");
abort ();
}
terminating = true;
// Make sure there was an exception; terminate is also called for an // Make sure there was an exception; terminate is also called for an
// attempt to rethrow when there is no suitable exception. // attempt to rethrow when there is no suitable exception.
type_info *t = __cxa_current_exception_type(); type_info *t = __cxa_current_exception_type();
......
...@@ -106,6 +106,7 @@ namespace __cxxabiv1 ...@@ -106,6 +106,7 @@ namespace __cxxabiv1
__cxa_demangle(char const* mangled_name, char* buf, std::size_t* n, __cxa_demangle(char const* mangled_name, char* buf, std::size_t* n,
int* status) int* status)
{ {
try {
using namespace __gnu_cxx; using namespace __gnu_cxx;
typedef demangler::session<std::allocator<char> > session_type; typedef demangler::session<std::allocator<char> > session_type;
...@@ -163,6 +164,9 @@ namespace __cxxabiv1 ...@@ -163,6 +164,9 @@ namespace __cxxabiv1
result = mangled_name; result = mangled_name;
} }
return finish(result.data(), result.size(), buf, n, status); return finish(result.data(), result.size(), buf, n, status);
} catch (std::bad_alloc&) {
return failure(memory_allocation_failure, status);
}
} }
} // namespace __cxxabiv1 } // namespace __cxxabiv1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment