24 #include <rtl/ustrbuf.hxx>
27 #include <com/sun/star/uno/genfunc.hxx>
28 #include <com/sun/star/uno/RuntimeException.hpp>
29 #include <typelib/typedescription.hxx>
36 using namespace ::
std;
46 #if OSL_DEBUG_LEVEL > 1
52 OUStringBuffer buf( 64 );
60 while (
'0' <= *p &&
'9' >= *p)
65 buf.appendAscii( p, n );
71 #if OSL_DEBUG_LEVEL > 1
72 OUString ret( buf.makeStringAndClear() );
74 fprintf( stderr,
"> toUNOname(): %s => %s\n", start, c_ret.getStr() );
77 return buf.makeStringAndClear();
85 #if defined _LIBCPPABI_VERSION // detect libc++abi
123 reinterpret_cast<char const *
>(header) - 8);
128 reinterpret_cast<char const *
>(header) + 8);
140 ::typelib_typedescription_getByName( &pTD, unoName.pData );
141 assert(pTD &&
"### unknown exception type! leaving out destruction => leaking!!!");
144 ::uno_destructData( pExc, pTD, cpp_release );
145 ::typelib_typedescription_release( pTD );
152 #if OSL_DEBUG_LEVEL > 1
155 OUString::unacquired( &pUnoExc->pType->pTypeName ),
156 RTL_TEXTENCODING_ASCII_US ) );
157 fprintf( stderr,
"> uno exception occurred: %s\n", cstr.getStr() );
165 TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
170 "cannot get typedescription for type " +
171 OUString::unacquired( &pUnoExc->pType->pTypeName ) );
175 ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
178 ::uno_any_destruct( pUnoExc,
nullptr );
181 TYPELIB_DANGER_RELEASE( pTypeDescr );
182 assert(rtti &&
"### no rtti for throwing exception!");
186 "no rtti for type " +
187 OUString::unacquired( &pUnoExc->pType->pTypeName ) );
206 #if defined _LIBCPPABI_VERSION // detect libc++abi
229 if (*reinterpret_cast<void **>(header) ==
nullptr) {
237 OUString unoName(
toUNOname( exceptionType->name() ) );
238 #if OSL_DEBUG_LEVEL > 1
240 fprintf( stderr,
"> c++ exception occurred: %s\n", cstr_unoName.getStr() );
243 if (pExcTypeDescr ==
nullptr)
static void deleteException(void *pExc)
static OUString toUNOname(char const *p)
std::type_info * getRtti(typelib_TypeDescription const &type)
struct _uno_Mapping uno_Mapping
void fillUnoException(uno_Any *pExc, uno_Mapping *pCpp2Uno)
std::type_info * __cxa_current_exception_type()
void SAL_CALL uno_type_any_constructAndConvert(uno_Any *pDest, void *pSource, typelib_TypeDescriptionReference *pType, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
void SAL_CALL uno_any_constructAndConvert(uno_Any *pDest, void *pSource, typelib_TypeDescription *pTypeDescr, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
__cxa_exception * caughtExceptions
#define _GLIBCXX_CDTOR_CALLABI
struct _typelib_TypeDescription typelib_TypeDescription
void SAL_CALL typelib_typedescription_release(typelib_TypeDescription *pTD) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescription_getByName(typelib_TypeDescription **ppRet, rtl_uString *pName) SAL_THROW_EXTERN_C()
void * __cxa_allocate_exception(size_t thrown_size)
void raiseException(uno_Any *pUnoExc, uno_Mapping *pUno2Cpp)
__cxa_eh_globals * __cxa_get_globals()
void(* exceptionDestructor)(void *)
std::type_info * exceptionType
#define SAL_WARN(area, stream)
void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void *)) __attribute__((noreturn))