diff options
63 files changed, 253 insertions, 156 deletions
diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx index fe3c1f391147..bde3233e1491 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx @@ -245,13 +245,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/share.hxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/share.hxx index ce2a34c417f9..c34033a53e72 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/share.hxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } namespace ppc diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx index 1c8045fafe26..9e2fa40f1a43 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx @@ -353,7 +353,7 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_ios/except.cxx b/bridges/source/cpp_uno/gcc3_ios/except.cxx index 747ebe3d7144..ae0348957312 100644 --- a/bridges/source/cpp_uno/gcc3_ios/except.cxx +++ b/bridges/source/cpp_uno/gcc3_ios/except.cxx @@ -344,8 +344,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxxabiv1::__cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -355,8 +356,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = nullptr; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_ios/share.hxx b/bridges/source/cpp_uno/gcc3_ios/share.hxx index bcddcdb1f807..120c5d5a5563 100644 --- a/bridges/source/cpp_uno/gcc3_ios/share.hxx +++ b/bridges/source/cpp_uno/gcc3_ios/share.hxx @@ -41,8 +41,7 @@ namespace CPPU_CURRENT_NAMESPACE void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); - void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); + void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive = false); } diff --git a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx index 9287bb4ea224..916961c69caf 100644 --- a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx @@ -412,7 +412,7 @@ static void cpp_call( catch (...) { // fill uno exception - CPPU_CURRENT_NAMESPACE::fillUnoException( abi::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx index 1a51c6e6786a..f0be82713583 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx @@ -242,13 +242,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx b/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx index dc199bdc1b94..944b4fd18859 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx @@ -77,8 +77,7 @@ extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } namespace axp diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx index 143b1533479c..0d77decd722a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx @@ -384,8 +384,7 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx index b4a5117b81c0..d6e4c0daacd3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx @@ -300,6 +300,7 @@ namespace CPPU_CURRENT_NAMESPACE void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -309,8 +310,10 @@ namespace CPPU_CURRENT_NAMESPACE return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = nullptr; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx index 3c3b46bfd6eb..d7b7ff370b52 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx @@ -123,12 +123,17 @@ namespace __cxxabiv1 { } #endif +#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE +namespace __cxxabiv1 { + extern "C" std::type_info *__cxa_current_exception_type() throw(); +} +#endif + namespace CPPU_CURRENT_NAMESPACE { void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); - void fillUnoException( - __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); + void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } extern "C" void privateSnippetExecutor(); diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index b8deb4ba7439..852252969b37 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -585,9 +585,7 @@ static void cpp_call( catch (...) { // fill uno exception - CPPU_CURRENT_NAMESPACE::fillUnoException( - __cxxabiv1::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno()); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx index 3464ad7c3d39..c3033fb49a2a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx @@ -266,8 +266,9 @@ namespace CPPU_CURRENT_NAMESPACE return header->adjustedPtr; } - void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) + void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -277,8 +278,10 @@ namespace CPPU_CURRENT_NAMESPACE return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/share.hxx b/bridges/source/cpp_uno/gcc3_linux_hppa/share.hxx index dd084e340a1e..5a65eeeef275 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx index 656f55c6b29e..d15e47f321d2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx @@ -366,7 +366,7 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx index 27d6bc1a2cbe..9145071519ce 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx @@ -241,13 +241,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_ia64/share.hxx index 59ff09b72621..30111698ec6b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/share.hxx @@ -73,14 +73,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } namespace ia64 diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx index bf9b06bc2952..e1a602e5e766 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx @@ -544,11 +544,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { + catch (...) + { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx index b06bd4b28f35..108c5c843744 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx @@ -265,8 +265,10 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = reinterpret_cast<CPPU_CURRENT_NAMESPACE::__cxa_eh_globals*>( + __cxxabiv1::__cxa_get_globals())->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -276,8 +278,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = nullptr; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx index 307f12a8a922..fb8f25353918 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx @@ -84,6 +84,12 @@ struct __cxa_eh_globals namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); } #endif +#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE +namespace __cxxabiv1 { +extern "C" std::type_info *__cxa_current_exception_type() throw(); +} +#endif + #if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION namespace __cxxabiv1 { extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(); @@ -111,8 +117,7 @@ namespace CPPU_CURRENT_NAMESPACE void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx index ff8618cf8171..1061a00c76c0 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx @@ -211,13 +211,10 @@ void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( - reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >( - __cxxabiv1::__cxa_get_globals())->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno()); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx index 27a587117145..051f5408cba3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx @@ -268,6 +268,7 @@ namespace CPPU_CURRENT_NAMESPACE void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -277,8 +278,10 @@ namespace CPPU_CURRENT_NAMESPACE return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/share.hxx b/bridges/source/cpp_uno/gcc3_linux_m68k/share.hxx index 01655c480e1d..e97a018855d5 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx index ca3a2477ebc5..dbe7896d1ceb 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx @@ -344,7 +344,7 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx index 01a4446eb19c..a2d5cfb67c18 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx @@ -257,8 +257,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -268,8 +269,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if defined BRIDGES_DEBUG OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/share.hxx b/bridges/source/cpp_uno/gcc3_linux_mips/share.hxx index 5c4dac85b249..f27a896cf5a9 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx index 259775f25708..98efa29ecbd8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx @@ -449,8 +449,7 @@ namespace catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx index e17e5fba14bf..8fc4d970bba7 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx @@ -258,8 +258,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -269,8 +270,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if defined BRIDGES_DEBUG OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_mips64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_mips64/share.hxx index 73c60aa05abc..b6821675c320 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips64/share.hxx @@ -75,14 +75,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ); } diff --git a/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx index b65a7819a405..abb43c1fea8a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx @@ -440,8 +440,7 @@ namespace catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx index cd6c79581736..475c6f506b1d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx @@ -243,13 +243,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx index be81af026eac..ad6ca4c946fb 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx index 7fdd362906ce..a08f12389c90 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx @@ -536,11 +536,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx index 27d6bc1a2cbe..9145071519ce 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx @@ -241,13 +241,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx index 21df650f7ae0..b5bc1102bf20 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx @@ -72,14 +72,14 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } namespace ppc64 diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx index b58a515121f2..0933315f91b4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx @@ -512,11 +512,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx index 1a51c6e6786a..f0be82713583 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx @@ -242,13 +242,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/share.hxx b/bridges/source/cpp_uno/gcc3_linux_s390/share.hxx index aacbd05fa568..aa1ecdfdc3d4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/share.hxx @@ -72,13 +72,13 @@ struct __cxa_eh_globals __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx index fda52d056ebc..663cf435d5b3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx @@ -482,11 +482,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx index 9fc893371039..52c8e603a992 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx @@ -242,13 +242,16 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) terminate(); + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/share.hxx b/bridges/source/cpp_uno/gcc3_linux_s390x/share.hxx index 9de4b6f485f6..00dc7201dc90 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/share.hxx @@ -73,12 +73,11 @@ struct __cxa_eh_globals unsigned int uncaughtExceptions; }; extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); - +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } namespace s390x diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx index e7354a4ba8c5..faf5dc044c52 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx @@ -389,8 +389,7 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx index 457ab485d21a..2535da049848 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx @@ -259,8 +259,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -270,8 +271,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if defined BRIDGES_DEBUG OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/share.hxx b/bridges/source/cpp_uno/gcc3_linux_sparc/share.hxx index 95f0c15f660c..da781a3b1ef4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/share.hxx @@ -68,12 +68,12 @@ struct __cxa_eh_globals unsigned int uncaughtExceptions; }; extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); inline char* adjustPointer( char* pIn, typelib_TypeDescription* pType ) { diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx index 39b625fb35c2..43b73257261a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx @@ -456,11 +456,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch( ... ) - { - // get exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch( ... ) + { + // get exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx index 457ab485d21a..2535da049848 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx @@ -259,8 +259,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -270,8 +271,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if defined BRIDGES_DEBUG OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/share.hxx index 5cd1b32f6355..b7f9980d218a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/share.hxx @@ -68,12 +68,12 @@ struct __cxa_eh_globals unsigned int uncaughtExceptions; }; extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ); diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx index 81012dfdcda3..de17e3ca5d07 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx @@ -700,11 +700,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch( ... ) - { - // get exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch( ... ) + { + // get exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index 762d1392b34e..ad2b9f702c5d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -138,8 +138,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxxabiv1::__cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxxabiv1::__cxa_exception * header = __cxxabiv1::__cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -149,8 +150,10 @@ void fillUnoException( __cxxabiv1::__cxa_exception * header, uno_Any * pUnoExc, return; } + std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = nullptr; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx index 55009d5f7480..94ad43ae922c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx @@ -143,6 +143,12 @@ extern "C" __cxa_eh_globals * __cxa_get_globals() throw(); } #endif +#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE +namespace __cxxabiv1 { +extern "C" std::type_info *__cxa_current_exception_type() throw(); +} +#endif + #if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION namespace __cxxabiv1 { extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(); @@ -165,8 +171,7 @@ namespace CPPU_CURRENT_NAMESPACE void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx index 929e0e2945aa..b038a0247963 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -283,9 +283,7 @@ static void cpp_call( catch (...) { // fill uno exception - CPPU_CURRENT_NAMESPACE::fillUnoException( - __cxxabiv1::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno()); + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx index 541e251506dd..12058c53a2a2 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx @@ -341,8 +341,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -352,8 +353,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = nullptr; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx index 3eb88cdc0242..39939ab6be72 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx @@ -136,8 +136,7 @@ namespace CPPU_CURRENT_NAMESPACE void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx index ae1dab7e1702..13002709436d 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx @@ -280,10 +280,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx index 0b484521f7a1..263733677158 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx @@ -260,8 +260,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -271,8 +272,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/share.hxx b/bridges/source/cpp_uno/gcc3_solaris_intel/share.hxx index 0fe413f6827c..2fbbe1989809 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/share.hxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/share.hxx @@ -72,13 +72,12 @@ struct __cxa_eh_globals unsigned int uncaughtExceptions; }; extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); - +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); } #endif diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx index 7ad7d1955a44..5b17378b911f 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx @@ -208,10 +208,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch (...) - { - // fill uno exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch (...) + { + // fill uno exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx index 18326431dbad..6545e4820f11 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx @@ -257,8 +257,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) __cxa_throw( pCppExc, rtti, deleteException ); } -void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno ) +void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno) { + __cxa_exception * header = __cxa_get_globals()->caughtExceptions; if (! header) { RuntimeException aRE( "no exception header!" ); @@ -268,8 +269,10 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } + std::type_info *exceptionType = __cxa_current_exception_type(); + typelib_TypeDescription * pExcTypeDescr = 0; - OUString unoName( toUNOname( header->exceptionType->name() ) ); + OUString unoName( toUNOname( exceptionType->name() ) ); #if defined BRIDGES_DEBUG OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/share.hxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/share.hxx index af42fba6a4ba..b7de110a2b39 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/share.hxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/share.hxx @@ -68,12 +68,12 @@ struct __cxa_eh_globals unsigned int uncaughtExceptions; }; extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +extern "C" std::type_info *__cxa_current_exception_type() throw(); void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); -void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno); inline char* adjustPointer( char* pIn, typelib_TypeDescription* pType ) { diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx index dbfcc1c66b2b..5b42401caed3 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx @@ -451,11 +451,10 @@ static void cpp_call( uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); } } - catch( ... ) - { - // get exception - fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + catch( ... ) + { + // get exception + CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/config_host/config_cxxabi.h.in b/config_host/config_cxxabi.h.in index 74a226b3eb9f..0acaa560529f 100644 --- a/config_host/config_cxxabi.h.in +++ b/config_host/config_cxxabi.h.in @@ -16,6 +16,7 @@ #define HAVE_CXXABI_H_CXA_EH_GLOBALS 0 #define HAVE_CXXABI_H_CXA_EXCEPTION 0 #define HAVE_CXXABI_H_CXA_GET_GLOBALS 0 +#define HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE 0 #define HAVE_CXXABI_H_CXA_THROW 0 #define HAVE_CXXABI_H_SI_CLASS_TYPE_INFO 0 #define HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO 0 diff --git a/configure.ac b/configure.ac index 25d85b435361..9a0c2c3083e3 100644 --- a/configure.ac +++ b/configure.ac @@ -6028,6 +6028,17 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then ], [AC_MSG_RESULT([no])]) AC_LANG_POP([C++]) + AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h]) + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include <cxxabi.h> + void * f() { return __cxxabiv1::__cxa_current_exception_type(); } + ])], [ + AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1]) + AC_MSG_RESULT([yes]) + ], [AC_MSG_RESULT([no])]) + AC_LANG_POP([C++]) + AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ diff --git a/cppuhelper/qa/misc/test_misc.cxx b/cppuhelper/qa/misc/test_misc.cxx index 151eb15ea1f6..0e4fdf9efb42 100644 --- a/cppuhelper/qa/misc/test_misc.cxx +++ b/cppuhelper/qa/misc/test_misc.cxx @@ -19,9 +19,11 @@ class Test : public ::CppUnit::TestFixture { public: void testCatchThrow(); + void testgetCaughtException(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCatchThrow); + CPPUNIT_TEST(testgetCaughtException); CPPUNIT_TEST_SUITE_END(); }; @@ -51,6 +53,36 @@ void Test::testCatchThrow() } } +void Test::testgetCaughtException() +{ + css::uno::Any aSavedExceptionAny; + std::exception_ptr + aSavedException; /// exception caught during unzipping is saved to be thrown during reading + try + { + throw css::uno::RuntimeException("RuntimeException"); + } + catch (...) + { + aSavedException = std::current_exception(); + } + CPPUNIT_ASSERT(bool(aSavedException)); + try + { + std::rethrow_exception(aSavedException); + } + catch (const css::uno::RuntimeException&) + { + // the expected case + aSavedExceptionAny = cppu::getCaughtException(); + } + catch (...) + { + CPPUNIT_ASSERT(false); + } + CPPUNIT_ASSERT(aSavedExceptionAny.hasValue()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |